Skip to content

Commit bf29bc1

Browse files
committed
Add Linear SSP Runge-Kutta class of schemes
Add Linear SSP Runge-Kutta class of schemes: implemented both s-stage/s-1 order and s-stage/s order methods. The class provides schemes for any formal order: the coefficients are computed by means of recursive algorithm (with an original implementation) that does not allocate unnecessary arrays...
1 parent 1df0f08 commit bf29bc1

File tree

6 files changed

+451
-28
lines changed

6 files changed

+451
-28
lines changed

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ cache:
99
- $HOME/.cache/pip
1010
- $HOME/.local
1111

12+
git:
13+
submodules: false
14+
1215
addons:
1316
apt:
1417
sources:

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ FOODIE is aimed to be a KISS-pure-Fortran library for integrating Ordinary Diffe
9999
+ [ ] 4 steps, 9 stages, 9th order accurate;
100100
+ [ ] 3 steps, 20 stages, 10th order accurate;
101101
+ [ ] Runge-Kutta schemes:
102+
+ [+] [Linear SSP (of any order)](http://fortran-foss-programmers.github.io/FOODIE/module/foodie_integrator_runge_kutta_lssp.html) schemes, see [16]:
103+
+ [x] generic s-stages of order (s-1)-th;
104+
+ [x] generic s-stages of order s-th;
102105
+ [ ] [low-storage](http://fortran-foss-programmers.github.io/FOODIE/module/foodie_integrator_runge_kutta_low_storage.html) schemes, see [1, 2, 3]:
103106
+ [x] 1 stage, namely the forward explicit Euler scheme, 1st order accurate;
104107
+ [ ] 2 stages;

src/lib/foodie.f90

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ module foodie
7676
use foodie_integrator_ms_runge_kutta_ssp, only : integrator_ms_runge_kutta_ssp
7777
use foodie_integrator_runge_kutta_emd, only : integrator_runge_kutta_emd
7878
use foodie_integrator_runge_kutta_low_storage, only : integrator_runge_kutta_ls
79+
use foodie_integrator_runge_kutta_lssp, only : integrator_runge_kutta_lssp
7980
use foodie_integrator_runge_kutta_ssp, only : integrator_runge_kutta_ssp
8081
use penf, only : I_P, R_P
8182

@@ -97,19 +98,21 @@ module foodie
9798
public :: integrator_ms_runge_kutta_ssp
9899
public :: integrator_runge_kutta_emd
99100
public :: integrator_runge_kutta_ls
101+
public :: integrator_runge_kutta_lssp
100102
public :: integrator_runge_kutta_ssp
101103
public :: is_available
102104
public :: is_class_available
103105
public :: is_scheme_available
104106

105107
contains
106-
function foodie_integrator(scheme, tolerance, nu, alpha) result(integrator)
108+
function foodie_integrator(scheme, stages, tolerance, nu, alpha) result(integrator)
107109
!< Return a concrete instance of [[integrator_object]] given a scheme selection.
108110
!<
109111
!< This is the FOODIE integrators factory.
110112
!<
111113
!< @note If an error occurs the error status of [[integrator_object]] is updated.
112114
character(*), intent(in) :: scheme !< Selected integrator given.
115+
integer(I_P), intent(in), optional :: stages !< Stages of multi-stage methods.
113116
real(R_P), intent(in), optional :: tolerance !< Tolerance on the local truncation error.
114117
real(R_P), intent(in), optional :: nu !< Williams-Robert-Asselin filter coefficient.
115118
real(R_P), intent(in), optional :: alpha !< Robert-Asselin filter coefficient.
@@ -120,12 +123,13 @@ function foodie_integrator(scheme, tolerance, nu, alpha) result(integrator)
120123
type(integrator_back_df) :: int_back_df !< Integrator back differentiation formula.
121124
type(integrator_euler_explicit) :: int_euler_explicit !< Integrator euler explicit.
122125
type(integrator_leapfrog) :: int_leapfrog !< Integrator leapfrog.
123-
type(integrator_lmm_ssp) :: int_lmm_ssp !< Integrator lmm ssp.
124-
type(integrator_lmm_ssp_vss) :: int_lmm_ssp_vss !< Integrator lmm ssp_vss.
126+
type(integrator_lmm_ssp) :: int_lmm_ssp !< Integrator LMM SSP.
127+
type(integrator_lmm_ssp_vss) :: int_lmm_ssp_vss !< Integrator LMM SSP VSS.
125128
type(integrator_ms_runge_kutta_ssp) :: int_ms_runge_kutta_ssp !< Integrator multistep Runge Kutta ssp.
126129
type(integrator_runge_kutta_emd) :: int_runge_kutta_emd !< Integrator Runge Kutta_embdedded.
127130
type(integrator_runge_kutta_ls) :: int_runge_kutta_ls !< Integrator Runge Kutta low storage.
128-
type(integrator_runge_kutta_ssp) :: int_runge_kutta_ssp !< Integrator Runge Kutta ssp.
131+
type(integrator_runge_kutta_lssp) :: int_runge_kutta_lssp !< Integrator linear Runge Kutta SSP.
132+
type(integrator_runge_kutta_ssp) :: int_runge_kutta_ssp !< Integrator Runge Kutta SSP.
129133

130134
if (index(trim(adjustl(scheme)), trim(int_adams_bashforth_moulton%class_name())) > 0) then
131135
allocate(integrator_adams_bashforth_moulton :: integrator)
@@ -189,6 +193,12 @@ function foodie_integrator(scheme, tolerance, nu, alpha) result(integrator)
189193
type is(integrator_runge_kutta_ls)
190194
call integrator%initialize(scheme=scheme)
191195
endselect
196+
elseif (index(trim(adjustl(scheme)), trim(int_runge_kutta_lssp%class_name())) > 0) then
197+
allocate(integrator_runge_kutta_lssp :: integrator)
198+
select type(integrator)
199+
type is(integrator_runge_kutta_lssp)
200+
call integrator%initialize(scheme=scheme, stages=stages)
201+
endselect
192202
elseif (index(trim(adjustl(scheme)), trim(int_runge_kutta_ssp%class_name())) > 0) then
193203
allocate(integrator_runge_kutta_ssp :: integrator)
194204
select type(integrator)
@@ -210,12 +220,13 @@ pure function foodie_integrator_class_names() result(names)
210220
type(integrator_back_df) :: int_back_df !< Integrator back differentiation formula.
211221
type(integrator_euler_explicit) :: int_euler_explicit !< Integrator euler explicit.
212222
type(integrator_leapfrog) :: int_leapfrog !< Integrator leapfrog.
213-
type(integrator_lmm_ssp) :: int_lmm_ssp !< Integrator lmm ssp.
214-
type(integrator_lmm_ssp_vss) :: int_lmm_ssp_vss !< Integrator lmm ssp_vss.
223+
type(integrator_lmm_ssp) :: int_lmm_ssp !< Integrator lmm SSP.
224+
type(integrator_lmm_ssp_vss) :: int_lmm_ssp_vss !< Integrator lmm SSP VSS.
215225
type(integrator_ms_runge_kutta_ssp) :: int_ms_runge_kutta_ssp !< Integrator multistep Runge Kutta ssp.
216-
type(integrator_runge_kutta_emd) :: int_runge_kutta_emd !< Integrator Runge Kutta_embdedded.
226+
type(integrator_runge_kutta_emd) :: int_runge_kutta_emd !< Integrator Runge Kutta embdedded.
217227
type(integrator_runge_kutta_ls) :: int_runge_kutta_ls !< Integrator Runge Kutta low storage.
218-
type(integrator_runge_kutta_ssp) :: int_runge_kutta_ssp !< Integrator Runge Kutta ssp.
228+
type(integrator_runge_kutta_lssp) :: int_runge_kutta_lssp !< Integrator linear Runge Kutta SSP.
229+
type(integrator_runge_kutta_ssp) :: int_runge_kutta_ssp !< Integrator Runge Kutta SSP.
219230

220231
names = [ int_adams_bashforth % class_name()]
221232
names = [names, int_adams_bashforth_moulton % class_name()]
@@ -228,6 +239,7 @@ pure function foodie_integrator_class_names() result(names)
228239
names = [names, int_ms_runge_kutta_ssp % class_name()]
229240
names = [names, int_runge_kutta_emd % class_name()]
230241
names = [names, int_runge_kutta_ls % class_name()]
242+
names = [names, int_runge_kutta_lssp % class_name()]
231243
names = [names, int_runge_kutta_ssp % class_name()]
232244
endfunction foodie_integrator_class_names
233245

@@ -244,12 +256,13 @@ pure function foodie_integrator_schemes(class_name) result(schemes)
244256
type(integrator_back_df) :: int_back_df !< Integrator back differentiation formula.
245257
type(integrator_euler_explicit) :: int_euler_explicit !< Integrator euler explicit.
246258
type(integrator_leapfrog) :: int_leapfrog !< Integrator leapfrog.
247-
type(integrator_lmm_ssp) :: int_lmm_ssp !< Integrator lmm ssp.
248-
type(integrator_lmm_ssp_vss) :: int_lmm_ssp_vss !< Integrator lmm ssp_vss.
259+
type(integrator_lmm_ssp) :: int_lmm_ssp !< Integrator lmm SSP.
260+
type(integrator_lmm_ssp_vss) :: int_lmm_ssp_vss !< Integrator lmm SSP VSS.
249261
type(integrator_ms_runge_kutta_ssp) :: int_ms_runge_kutta_ssp !< Integrator multistep Runge Kutta ssp.
250-
type(integrator_runge_kutta_emd) :: int_runge_kutta_emd !< Integrator Runge Kutta_embdedded.
262+
type(integrator_runge_kutta_emd) :: int_runge_kutta_emd !< Integrator Runge Kutta embdedded.
251263
type(integrator_runge_kutta_ls) :: int_runge_kutta_ls !< Integrator Runge Kutta low storage.
252-
type(integrator_runge_kutta_ssp) :: int_runge_kutta_ssp !< Integrator Runge Kutta ssp.
264+
type(integrator_runge_kutta_lssp) :: int_runge_kutta_lssp !< Integrator linear Runge Kutta SSP.
265+
type(integrator_runge_kutta_ssp) :: int_runge_kutta_ssp !< Integrator Runge Kutta SSP.
253266

254267
if (present(class_name)) then
255268
if (trim(int_adams_bashforth%class_name()) == trim(adjustl(class_name))) then
@@ -274,6 +287,8 @@ pure function foodie_integrator_schemes(class_name) result(schemes)
274287
schemes = int_runge_kutta_emd%supported_schemes()
275288
elseif (trim(int_runge_kutta_ls%class_name()) == trim(adjustl(class_name))) then
276289
schemes = int_runge_kutta_ls%supported_schemes()
290+
elseif (trim(int_runge_kutta_lssp%class_name()) == trim(adjustl(class_name))) then
291+
schemes = int_runge_kutta_lssp%supported_schemes()
277292
elseif (trim(int_runge_kutta_ssp%class_name()) == trim(adjustl(class_name))) then
278293
schemes = int_runge_kutta_ssp%supported_schemes()
279294
endif
@@ -289,6 +304,7 @@ pure function foodie_integrator_schemes(class_name) result(schemes)
289304
schemes = [schemes, int_ms_runge_kutta_ssp % supported_schemes()]
290305
schemes = [schemes, int_runge_kutta_emd % supported_schemes()]
291306
schemes = [schemes, int_runge_kutta_ls % supported_schemes()]
307+
schemes = [schemes, int_runge_kutta_lssp % supported_schemes()]
292308
schemes = [schemes, int_runge_kutta_ssp % supported_schemes()]
293309
endif
294310
endfunction foodie_integrator_schemes

src/lib/foodie_integrator_lmm_ssp_vss.f90

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ module foodie_integrator_lmm_ssp_vss
7575
procedure, pass(self) :: update_previous !< Cyclic update previous time steps.
7676
! private methods
7777
procedure, pass(self), private :: integrate_order_2 !< Integrate integrand field by 2nd order formula.
78+
procedure, pass(self), private :: integrate_order_3 !< Integrate integrand field by 3rd order formula.
7879
endtype integrator_lmm_ssp_vss
7980

8081
abstract interface

0 commit comments

Comments
 (0)