Perform the test.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(lcce_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(lcce_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.
integer(I_P) :: last_step !< Last time step computed.
integer(I_P) :: t !< Counter.
print "(A)", trim(adjustl(scheme))
allocate(error(1:size(self%Dt)))
error = 0.0_R_P
if (self%errors_analysis) then
allocate(order(1:size(error, dim=1)-1))
order = 0.0_R_P
endif
do t=1, size(self%Dt, dim=1)
call integrate(scheme=scheme, &
a=self%a, &
b=self%b, &
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,G0,A,G0,A,G0)", " steps: ", last_step, " Dt: ", self%Dt(t), ", error: ", error(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,F7.3)", " observed order: ", order(t-1)
endif
call save_results(results=self%results, &
output=self%output, &
scheme=trim(adjustl(scheme)), &
a=self%a, &
b=self%b, &
U0=self%U0, &
save_exact_solution=self%exact_solution, &
solution=solution(0:1,0:last_step))
endif
enddo
endsubroutine test