Fehlberg 8(9) method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rkf89_class), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in) | :: | t |
initial time |
||
real(kind=wp), | intent(in), | dimension(me%n) | :: | x |
initial state |
|
real(kind=wp), | intent(in) | :: | h |
time step |
||
real(kind=wp), | intent(out), | dimension(me%n) | :: | xf |
state at time |
|
real(kind=wp), | intent(out), | dimension(me%n) | :: | terr |
truncation error estimate |
subroutine rkf89(me,t,x,h,xf,terr) implicit none class(rkf89_class),intent(inout) :: me real(wp),intent(in) :: t !! initial time real(wp),dimension(me%n),intent(in) :: x !! initial state real(wp),intent(in) :: h !! time step real(wp),dimension(me%n),intent(out) :: xf !! state at time `t+h` real(wp),dimension(me%n),intent(out) :: terr !! truncation error estimate real(wp),parameter :: a1 = 0.44368940376498183109599404281370_wp real(wp),parameter :: a2 = 0.66553410564747274664399106422055_wp real(wp),parameter :: a3 = 0.99830115847120911996598659633083_wp real(wp),parameter :: a4 = 0.3155_wp real(wp),parameter :: a5 = 0.50544100948169068626516126737384_wp real(wp),parameter :: a6 = 0.17142857142857142857142857142857_wp real(wp),parameter :: a7 = 0.82857142857142857142857142857143_wp real(wp),parameter :: a8 = 0.66543966121011562534953769255586_wp real(wp),parameter :: a9 = 0.24878317968062652069722274560771_wp real(wp),parameter :: a10 = 0.1090_wp real(wp),parameter :: a11 = 0.8910_wp real(wp),parameter :: a12 = 0.3995_wp real(wp),parameter :: a13 = 0.6005_wp real(wp),parameter :: a14 = 1.0_wp real(wp),parameter :: a16 = 1.0_wp real(wp),parameter :: b1 = 0.44368940376498183109599404281370_wp real(wp),parameter :: b20 = 0.16638352641186818666099776605514_wp real(wp),parameter :: b21 = 0.49915057923560455998299329816541_wp real(wp),parameter :: b30 = 0.24957528961780227999149664908271_wp real(wp),parameter :: b32 = 0.74872586885340683997448994724812_wp real(wp),parameter :: b40 = 0.20661891163400602426556710393185_wp real(wp),parameter :: b42 = 0.17707880377986347040380997288319_wp real(wp),parameter :: b43 = -0.68197715413869494669377076815048e-1_wp real(wp),parameter :: b50 = 0.10927823152666408227903890926157_wp real(wp),parameter :: b53 = 0.40215962642367995421990563690087e-2_wp real(wp),parameter :: b54 = 0.39214118169078980444392330174325_wp real(wp),parameter :: b60 = 0.98899281409164665304844765434355e-1_wp real(wp),parameter :: b63 = 0.35138370227963966951204487356703e-2_wp real(wp),parameter :: b64 = 0.12476099983160016621520625872489_wp real(wp),parameter :: b65 = -0.55745546834989799643742901466348e-1_wp real(wp),parameter :: b70 = -0.36806865286242203724153101080691_wp real(wp),parameter :: b74 = -0.22273897469476007645024020944166e+1_wp real(wp),parameter :: b75 = 0.13742908256702910729565691245744e+1_wp real(wp),parameter :: b76 = 0.20497390027111603002159354092206e+1_wp real(wp),parameter :: b80 = 0.45467962641347150077351950603349e-1_wp real(wp),parameter :: b85 = 0.32542131701589147114677469648853_wp real(wp),parameter :: b86 = 0.28476660138527908888182420573687_wp real(wp),parameter :: b87 = 0.97837801675979152435868397271099e-2_wp real(wp),parameter :: b90 = 0.60842071062622057051094145205182e-1_wp real(wp),parameter :: b95 = -0.21184565744037007526325275251206e-1_wp real(wp),parameter :: b96 = 0.19596557266170831957464490662983_wp real(wp),parameter :: b97 = -0.42742640364817603675144835342899e-2_wp real(wp),parameter :: b98 = 0.17434365736814911965323452558189e-1_wp real(wp),parameter :: b100 = 0.54059783296931917365785724111182e-1_wp real(wp),parameter :: b106 = 0.11029825597828926530283127648228_wp real(wp),parameter :: b107 = -0.12565008520072556414147763782250e-2_wp real(wp),parameter :: b108 = 0.36790043477581460136384043566339e-2_wp real(wp),parameter :: b109 = -0.57780542770972073040840628571866e-1_wp real(wp),parameter :: b110 = 0.12732477068667114646645181799160_wp real(wp),parameter :: b117 = 0.11448805006396105323658875721817_wp real(wp),parameter :: b118 = 0.28773020709697992776202201849198_wp real(wp),parameter :: b119 = 0.50945379459611363153735885079465_wp real(wp),parameter :: b1110 = -0.14799682244372575900242144449640_wp real(wp),parameter :: b120 = -0.36526793876616740535848544394333e-2_wp real(wp),parameter :: b125 = 0.81629896012318919777819421247030e-1_wp real(wp),parameter :: b126 = -0.38607735635693506490517694343215_wp real(wp),parameter :: b127 = 0.30862242924605106450474166025206e-1_wp real(wp),parameter :: b128 = -0.58077254528320602815829374733518e-1_wp real(wp),parameter :: b129 = 0.33598659328884971493143451362322_wp real(wp),parameter :: b1210 = 0.41066880401949958613549622786417_wp real(wp),parameter :: b1211 = -0.11840245972355985520633156154536e-1_wp real(wp),parameter :: b130 = -0.12375357921245143254979096135669e+1_wp real(wp),parameter :: b135 = -0.24430768551354785358734861366763e+2_wp real(wp),parameter :: b136 = 0.54779568932778656050436528991173_wp real(wp),parameter :: b137 = -0.44413863533413246374959896569346e+1_wp real(wp),parameter :: b138 = 0.10013104813713266094792617851022e+2_wp real(wp),parameter :: b139 = -0.14995773102051758447170985073142e+2_wp real(wp),parameter :: b1310 = 0.58946948523217013620824539651427e+1_wp real(wp),parameter :: b1311 = 0.17380377503428984877616857440542e+1_wp real(wp),parameter :: b1312 = 0.27512330693166730263758622860276e+2_wp real(wp),parameter :: b140 = -0.35260859388334522700502958875588_wp real(wp),parameter :: b145 = -0.18396103144848270375044198988231_wp real(wp),parameter :: b146 = -0.65570189449741645138006879985251_wp real(wp),parameter :: b147 = -0.39086144880439863435025520241310_wp real(wp),parameter :: b148 = 0.26794646712850022936584423271209_wp real(wp),parameter :: b149 = -0.10383022991382490865769858507427e+1_wp real(wp),parameter :: b1410 = 0.16672327324258671664727346168501e+1_wp real(wp),parameter :: b1411 = 0.49551925855315977067732967071441_wp real(wp),parameter :: b1412 = 0.11394001132397063228586738141784e+1_wp real(wp),parameter :: b1413 = 0.51336696424658613688199097191534e-1_wp real(wp),parameter :: b150 = 0.10464847340614810391873002406755e-2_wp real(wp),parameter :: b158 = -0.67163886844990282237778446178020e-2_wp real(wp),parameter :: b159 = 0.81828762189425021265330065248999e-2_wp real(wp),parameter :: b1510 = -0.42640342864483347277142138087561e-2_wp real(wp),parameter :: b1511 = 0.28009029474168936545976331153703e-3_wp real(wp),parameter :: b1512 = -0.87835333876238676639057813145633e-2_wp real(wp),parameter :: b1513 = 0.10254505110825558084217769664009e-1_wp real(wp),parameter :: b160 = -0.13536550786174067080442168889966e+1_wp real(wp),parameter :: b165 = -0.18396103144848270375044198988231_wp real(wp),parameter :: b166 = -0.65570189449741645138006879985251_wp real(wp),parameter :: b167 = -0.39086144880439863435025520241310_wp real(wp),parameter :: b168 = 0.27466285581299925758962207732989_wp real(wp),parameter :: b169 = -0.10464851753571915887035188572676e+1_wp real(wp),parameter :: b1610 = 0.16714967667123155012004488306588e+1_wp real(wp),parameter :: b1611 = 0.49523916825841808131186990740287_wp real(wp),parameter :: b1612 = 0.11481836466273301905225795954930e+1_wp real(wp),parameter :: b1613 = 0.41082191313833055603981327527525e-1_wp real(wp),parameter :: b1615 = 1.0_wp real(wp),parameter :: c0 = 0.32256083500216249913612900960247e-1_wp real(wp),parameter :: c8 = 0.25983725283715403018887023171963_wp real(wp),parameter :: c9 = 0.92847805996577027788063714302190e-1_wp real(wp),parameter :: c10 = 0.16452339514764342891647731842800_wp real(wp),parameter :: c11 = 0.17665951637860074367084298397547_wp real(wp),parameter :: c12 = 0.23920102320352759374108933320941_wp real(wp),parameter :: c13 = 0.39484274604202853746752118829325e-2_wp real(wp),parameter :: c14 = 0.30726495475860640406368305522124e-1_wp real(wp),dimension(me%n) :: f0,f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16 if (h==zero) then xf = x terr = zero return end if call me%f(t,x,f0) call me%f(t+h*a1,x+f0*b1*h,f1) call me%f(t+h*a2,x+(f0*b20+f1*b21)*h,f2) call me%f(t+h*a3,x+(f0*b30+f2*b32)*h,f3) call me%f(t+h*a4,x+(f0*b40+f2*b42+f3*b43)*h,f4) call me%f(t+h*a5,x+(f0*b50+f3*b53+f4*b54)*h,f5) call me%f(t+h*a6,x+(f0*b60+f3*b63+f4*b64+f5*b65)*h,f6) call me%f(t+h*a7,x+(f0*b70+f4*b74+f5*b75+f6*b76)*h,f7) call me%f(t+h*a8,x+(f0*b80+f5*b85+f6*b86+f7*b87)*h,f8) call me%f(t+h*a9,x+(f0*b90+f5*b95+f6*b96+f7*b97+f8*b98)*h,f9) call me%f(t+h*a10,x+(f0*b100+f6*b106+f7*b107+f8*b108+& f9*b109)*h,f10) call me%f(t+h*a11,x+(f0*b110+f7*b117+f8*b118+f9*b119+& f10*b1110)*h,f11) call me%f(t+h*a12,x+(f0*b120+f5*b125+f6*b126+f7*b127+& f8*b128+f9*b129+f10*b1210+f11*b1211)*h,f12) call me%f(t+h*a13,x+(f0*b130+f5*b135+f6*b136+f7*b137+& f8*b138+f9*b139+f10*b1310+f11*b1311+f12*b1312)*h,f13) call me%f(t+h*a14,x+(f0*b140+f5*b145+f6*b146+f7*b147+f8*b148+& f9*b149+f10*b1410+f11*b1411+f12*b1412+f13*b1413)*h,f14) call me%f(t,x+(f0*b150+f8*b158+f9*b159+f10*b1510+f11*b1511+& f12*b1512+f13*b1513)*h,f15) call me%f(t+h*a16,x+(f0*b160+f5*b165+f6*b166+f7*b167+f8*b168+& f9*b169+f10*b1610+f11*b1611+f12*b1612+f13*b1613+& f15*b1615)*h,f16) xf = x+h*(f0*c0+f8*c8+f9*c9+f10*c10+f11*c11+f12*c12+f13*c13+f14*c14) terr = c14*h*(f0+f14-f15-f16) end subroutine rkf89