Perform the test.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(oscillation_test), | intent(in) | :: | self | Test. |
||
character(len=*), | intent(in) | :: | scheme | Selected scheme. |
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed arrows point from an interface to procedures which implement that interface. This could include the module procedures in a generic interface or the implementation in a submodule of an interface in a parent module.
subroutine test(self, scheme)
!< Perform the test.
class(oscillation_test), intent(in) :: self !< Test.
character(*), intent(in) :: scheme !< Selected scheme.
real(R_P), allocatable :: solution(:,:) !< Solution at each time step.
real(R_P), allocatable :: error(:,:) !< Error (norm L2) with respect the exact solution.
real(R_P), allocatable :: order(:,:) !< Observed order based on subsequent refined solutions.
type(integrand_oscillation) :: oscillator !< Molding integrand oscillator.
integer(I_P) :: last_step !< Last time step computed.
integer(I_P) :: t !< Counter.
print "(A)", trim(adjustl(scheme))
allocate(error(1:oscillator%integrand_dimension(), 1:size(self%Dt)))
error = 0.0_R_P
if (self%errors_analysis) then
allocate(order(1:oscillator%integrand_dimension(), 1:size(error, dim=2)-1))
order = 0.0_R_P
endif
do t=1, size(self%Dt, dim=1)
call integrate(scheme=scheme, &
frequency=self%frequency, &
U0=self%U0, &
final_time=self%final_time, &
Dt=self%Dt(t), &
iterations=self%implicit_iterations, &
stages=self%stages, &
is_fast=self%is_fast, &
solution=solution, &
error=error(:, t), &
last_step=last_step)
if (allocated(solution)) then
print "(A,I10,4(A,G10.3))", " steps: ", last_step, &
" Dt: ", self%Dt(t), ", f*Dt: ", self%frequency*self%Dt(t), &
", E(x): ", error(1, t), ", E(y): ", error(2, t)
if (self%errors_analysis .and. t > 1) then
order(:, t-1) = observed_order(error=error(:, t-1:t), Dt=self%Dt(t-1:t))
print "(A,F10.2,A,F10.2)", " Observed order, O(x): ", order(1, t-1), ", O(y): " , order(2, t-1)
endif
call save_results(results=self%results, &
output=self%output, &
scheme=trim(adjustl(scheme)), &
frequency=self%frequency, &
U0=self%U0, &
save_exact_solution=self%exact_solution, &
solution=solution(:, 0:last_step))
endif
enddo
endsubroutine test