Feagin's RK8(10) method -- a 10th-order method with an embedded 8th-order method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(rkf108_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 rkf108(me,t,x,h,xf,terr) implicit none class(rkf108_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.100000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: a2 = 0.539357840802981787532485197881302436857273449701009015505500_wp real(wp),parameter :: a3 = 0.809036761204472681298727796821953655285910174551513523258250_wp real(wp),parameter :: a4 = 0.309036761204472681298727796821953655285910174551513523258250_wp real(wp),parameter :: a5 = 0.981074190219795268254879548310562080489056746118724882027805_wp real(wp),parameter :: a6 = 0.833333333333333333333333333333333333333333333333333333333333_wp real(wp),parameter :: a7 = 0.354017365856802376329264185948796742115824053807373968324184_wp real(wp),parameter :: a8 = 0.882527661964732346425501486979669075182867844268052119663791_wp real(wp),parameter :: a9 = 0.642615758240322548157075497020439535959501736363212695909875_wp real(wp),parameter :: a10 = 0.357384241759677451842924502979560464040498263636787304090125_wp real(wp),parameter :: a11 = 0.117472338035267653574498513020330924817132155731947880336209_wp real(wp),parameter :: a12 = 0.833333333333333333333333333333333333333333333333333333333333_wp real(wp),parameter :: a13 = 0.309036761204472681298727796821953655285910174551513523258250_wp real(wp),parameter :: a14 = 0.539357840802981787532485197881302436857273449701009015505500_wp real(wp),parameter :: a15 = 0.100000000000000000000000000000000000000000000000000000000000_wp !real(wp),parameter :: a16 = 1.00000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c0 = 0.0333333333333333333333333333333333333333333333333333333333333_wp real(wp),parameter :: c1 = 0.0250000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c2 = 0.0333333333333333333333333333333333333333333333333333333333333_wp real(wp),parameter :: c4 = 0.0500000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c6 = 0.0400000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c8 = 0.189237478148923490158306404106012326238162346948625830327194_wp real(wp),parameter :: c9 = 0.277429188517743176508360262560654340428504319718040836339472_wp real(wp),parameter :: c10 = 0.277429188517743176508360262560654340428504319718040836339472_wp real(wp),parameter :: c11 = 0.189237478148923490158306404106012326238162346948625830327194_wp real(wp),parameter :: c12 = -0.0400000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c13 = -0.0500000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c14 = -0.0333333333333333333333333333333333333333333333333333333333333_wp real(wp),parameter :: c15 = -0.0250000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: c16 = 0.0333333333333333333333333333333333333333333333333333333333333_wp real(wp),parameter :: b10 = 0.100000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: b20 = -0.915176561375291440520015019275342154318951387664369720564660_wp real(wp),parameter :: b21 = 1.45453440217827322805250021715664459117622483736537873607016_wp real(wp),parameter :: b30 = 0.202259190301118170324681949205488413821477543637878380814562_wp real(wp),parameter :: b32 = 0.606777570903354510974045847616465241464432630913635142443687_wp real(wp),parameter :: b40 = 0.184024714708643575149100693471120664216774047979591417844635_wp real(wp),parameter :: b42 = 0.197966831227192369068141770510388793370637287463360401555746_wp real(wp),parameter :: b43 = -0.0729547847313632629185146671595558023015011608914382961421311_wp real(wp),parameter :: b50 = 0.0879007340206681337319777094132125475918886824944548534041378_wp real(wp),parameter :: b53 = 0.410459702520260645318174895920453426088035325902848695210406_wp real(wp),parameter :: b54 = 0.482713753678866489204726942976896106809132737721421333413261_wp real(wp),parameter :: b60 = 0.0859700504902460302188480225945808401411132615636600222593880_wp real(wp),parameter :: b63 = 0.330885963040722183948884057658753173648240154838402033448632_wp real(wp),parameter :: b64 = 0.489662957309450192844507011135898201178015478433790097210790_wp real(wp),parameter :: b65 = -0.0731856375070850736789057580558988816340355615025188195854775_wp real(wp),parameter :: b70 = 0.120930449125333720660378854927668953958938996999703678812621_wp real(wp),parameter :: b74 = 0.260124675758295622809007617838335174368108756484693361887839_wp real(wp),parameter :: b75 = 0.0325402621549091330158899334391231259332716675992700000776101_wp real(wp),parameter :: b76 = -0.0595780211817361001560122202563305121444953672762930724538856_wp real(wp),parameter :: b80 = 0.110854379580391483508936171010218441909425780168656559807038_wp real(wp),parameter :: b85 = -0.0605761488255005587620924953655516875526344415354339234619466_wp real(wp),parameter :: b86 = 0.321763705601778390100898799049878904081404368603077129251110_wp real(wp),parameter :: b87 = 0.510485725608063031577759012285123416744672137031752354067590_wp real(wp),parameter :: b90 = 0.112054414752879004829715002761802363003717611158172229329393_wp real(wp),parameter :: b95 = -0.144942775902865915672349828340980777181668499748506838876185_wp real(wp),parameter :: b96 = -0.333269719096256706589705211415746871709467423992115497968724_wp real(wp),parameter :: b97 = 0.499269229556880061353316843969978567860276816592673201240332_wp real(wp),parameter :: b98 = 0.509504608929686104236098690045386253986643232352989602185060_wp real(wp),parameter :: b100 = 0.113976783964185986138004186736901163890724752541486831640341_wp real(wp),parameter :: b105 = -0.0768813364203356938586214289120895270821349023390922987406384_wp real(wp),parameter :: b106 = 0.239527360324390649107711455271882373019741311201004119339563_wp real(wp),parameter :: b107 = 0.397774662368094639047830462488952104564716416343454639902613_wp real(wp),parameter :: b108 = 0.0107558956873607455550609147441477450257136782823280838547024_wp real(wp),parameter :: b109 = -0.327769124164018874147061087350233395378262992392394071906457_wp real(wp),parameter :: b110 = 0.0798314528280196046351426864486400322758737630423413945356284_wp real(wp),parameter :: b115 = -0.0520329686800603076514949887612959068721311443881683526937298_wp real(wp),parameter :: b116 = -0.0576954146168548881732784355283433509066159287152968723021864_wp real(wp),parameter :: b117 = 0.194781915712104164976306262147382871156142921354409364738090_wp real(wp),parameter :: b118 = 0.145384923188325069727524825977071194859203467568236523866582_wp real(wp),parameter :: b119 = -0.0782942710351670777553986729725692447252077047239160551335016_wp real(wp),parameter :: b1110 = -0.114503299361098912184303164290554670970133218405658122674674_wp real(wp),parameter :: b120 = 0.985115610164857280120041500306517278413646677314195559520529_wp real(wp),parameter :: b123 = 0.330885963040722183948884057658753173648240154838402033448632_wp real(wp),parameter :: b124 = 0.489662957309450192844507011135898201178015478433790097210790_wp real(wp),parameter :: b125 = -1.37896486574843567582112720930751902353904327148559471526397_wp real(wp),parameter :: b126 = -0.861164195027635666673916999665534573351026060987427093314412_wp real(wp),parameter :: b127 = 5.78428813637537220022999785486578436006872789689499172601856_wp real(wp),parameter :: b128 = 3.28807761985103566890460615937314805477268252903342356581925_wp real(wp),parameter :: b129 = -2.38633905093136384013422325215527866148401465975954104585807_wp real(wp),parameter :: b1210 = -3.25479342483643918654589367587788726747711504674780680269911_wp real(wp),parameter :: b1211 = -2.16343541686422982353954211300054820889678036420109999154887_wp real(wp),parameter :: b130 = 0.895080295771632891049613132336585138148156279241561345991710_wp real(wp),parameter :: b132 = 0.197966831227192369068141770510388793370637287463360401555746_wp real(wp),parameter :: b133 = -0.0729547847313632629185146671595558023015011608914382961421311_wp real(wp),parameter :: b135 = -0.851236239662007619739049371445966793289359722875702227166105_wp real(wp),parameter :: b136 = 0.398320112318533301719718614174373643336480918103773904231856_wp real(wp),parameter :: b137 = 3.63937263181035606029412920047090044132027387893977804176229_wp real(wp),parameter :: b138 = 1.54822877039830322365301663075174564919981736348973496313065_wp real(wp),parameter :: b139 = -2.12221714704053716026062427460427261025318461146260124401561_wp real(wp),parameter :: b1310 = -1.58350398545326172713384349625753212757269188934434237975291_wp real(wp),parameter :: b1311 = -1.71561608285936264922031819751349098912615880827551992973034_wp real(wp),parameter :: b1312 = -0.0244036405750127452135415444412216875465593598370910566069132_wp real(wp),parameter :: b140 = -0.915176561375291440520015019275342154318951387664369720564660_wp real(wp),parameter :: b141 = 1.45453440217827322805250021715664459117622483736537873607016_wp real(wp),parameter :: b144 = -0.777333643644968233538931228575302137803351053629547286334469_wp real(wp),parameter :: b146 = -0.0910895662155176069593203555807484200111889091770101799647985_wp real(wp),parameter :: b1412 = 0.0910895662155176069593203555807484200111889091770101799647985_wp real(wp),parameter :: b1413 = 0.777333643644968233538931228575302137803351053629547286334469_wp real(wp),parameter :: b150 = 0.100000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: b152 = -0.157178665799771163367058998273128921867183754126709419409654_wp real(wp),parameter :: b1514 = 0.157178665799771163367058998273128921867183754126709419409654_wp real(wp),parameter :: b160 = 0.181781300700095283888472062582262379650443831463199521664945_wp real(wp),parameter :: b161 = 0.675000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: b162 = 0.342758159847189839942220553413850871742338734703958919937260_wp real(wp),parameter :: b164 = 0.259111214548322744512977076191767379267783684543182428778156_wp real(wp),parameter :: b165 = -0.358278966717952089048961276721979397739750634673268802484271_wp real(wp),parameter :: b166 = -1.04594895940883306095050068756409905131588123172378489286080_wp real(wp),parameter :: b167 = 0.930327845415626983292300564432428777137601651182965794680397_wp real(wp),parameter :: b168 = 1.77950959431708102446142106794824453926275743243327790536000_wp real(wp),parameter :: b169 = 0.100000000000000000000000000000000000000000000000000000000000_wp real(wp),parameter :: b1610 = -0.282547569539044081612477785222287276408489375976211189952877_wp real(wp),parameter :: b1611 = -0.159327350119972549169261984373485859278031542127551931461821_wp real(wp),parameter :: b1612 = -0.145515894647001510860991961081084111308650130578626404945571_wp real(wp),parameter :: b1613 = -0.259111214548322744512977076191767379267783684543182428778156_wp real(wp),parameter :: b1614 = -0.342758159847189839942220553413850871742338734703958919937260_wp real(wp),parameter :: b1615 = -0.675000000000000000000000000000000000000000000000000000000000_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+a1*h,x+h*(b10*f0),f1) call me%f(t+a2*h,x+h*(b20*f0+b21*f1),f2) call me%f(t+a3*h,x+h*(b30*f0+b32*f2),f3) call me%f(t+a4*h,x+h*(b40*f0+b42*f2+b43*f3),f4) call me%f(t+a5*h,x+h*(b50*f0+b53*f3+b54*f4),f5) call me%f(t+a6*h,x+h*(b60*f0+b63*f3+b64*f4+b65*f5),f6) call me%f(t+a7*h,x+h*(b70*f0+b74*f4+b75*f5+b76*f6),f7) call me%f(t+a8*h,x+h*(b80*f0+b85*f5+b86*f6+b87*f7),f8) call me%f(t+a9*h,x+h*(b90*f0+b95*f5+b96*f6+b97*f7+b98*f8),f9) call me%f(t+a10*h,x+h*(b100*f0+b105*f5+b106*f6+b107*f7+b108*f8+& b109*f9),f10) call me%f(t+a11*h,x+h*(b110*f0+b115*f5+b116*f6+b117*f7+b118*f8+& b119*f9+b1110*f10),f11) call me%f(t+a12*h,x+h*(b120*f0+b123*f3+b124*f4+b125*f5+b126*f6+& b127*f7+b128*f8+b129*f9+b1210*f10+b1211*f11),f12) call me%f(t+a13*h,x+h*(b130*f0+b132*f2+b133*f3+b135*f5+b136*f6+& b137*f7+b138*f8+b139*f9+b1310*f10+b1311*f11+& b1312*f12),f13) call me%f(t+a14*h,x+h*(b140*f0+b141*f1+b144*f4+b146*f6+b1412*f12+& b1413*f13),f14) call me%f(t+a15*h,x+h*(b150*f0+b152*f2+b1514*f14),f15) call me%f(t+h,x+h*(b160*f0+b161*f1+b162*f2+b164*f4+b165*f5+& b166*f6+b167*f7+b168*f8+b169*f9+b1610*f10+b1611*f11+& b1612*f12+b1613*f13+b1614*f14+b1615*f15),f16) xf = x+h*(c0*f0+c1*f1+c2*f2+c4*f4+c6*f6+c8*f8+c9*f9+& c10*f10+c11*f11+c12*f12+c13*f13+c14*f14+c15*f15+c16*f16) terr = (1.0_wp/360.0_wp)*h*(f1-f15) end subroutine rkf108