Skip to content

Commit abd37b7

Browse files
committed
add exact solution computation to linear advection
1 parent 8dc49cd commit abd37b7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

src/lib/foodie_integrator_runge_kutta_lssp.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ subroutine initialize(self, scheme, U, stages, stop_on_fail)
248248
allocate(self%alpha(1:self%stages)) ; self%alpha = 0._R_P
249249
call self%initialize_order_s
250250
endselect
251-
self%description_ = trim(adjustl(scheme))//'_stages_'//trim(str(self%stages))
251+
self%description_ = trim(adjustl(scheme))//'_stages_'//trim(str(self%stages, no_sign=.true.))
252252
self%registers = self%stages
253253
if (present(U)) call self%allocate_integrand_members(U=U)
254254
else

src/tests/tester/foodie_test_integrand_ladvection.f90

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ pure function exact_solution(self, t, U0) result(exact)
152152
class(integrand_object), intent(in), optional :: U0 !< Initial conditions.
153153
real(R_P), allocatable :: exact(:) !< Exact solution.
154154

155+
if (present(U0)) then
156+
select type(U0)
157+
type is(integrand_ladvection)
158+
exact = U0%u(1:self%Ni)
159+
endselect
160+
else
161+
exact = self%u(1:self%Ni) * 0._R_P
162+
endif
155163
endfunction exact_solution
156164

157165
subroutine export_tecplot(self, file_name, t, scheme, close_file)

src/tests/tester/foodie_tester.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ subroutine integrand_compute_error
349349

350350
select type(integrand)
351351
type is(integrand_ladvection)
352+
error = abs(integrand%output() - integrand%exact_solution(t=time))
352353
type is(integrand_oscillation)
353354
error = abs(integrand%output() - integrand%exact_solution(t=time))
354355
endselect

0 commit comments

Comments
 (0)