73 REAL,
PARAMETER ::
eta(3,3) = &
74 reshape((/ 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 0.0, 0.75, 1.0/3.0 /),(/3,3/))
75 REAL,
PARAMETER ::
zeta(3,3) = &
76 reshape((/ 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.5 /),(/3,3/))
92 CLASS(timedisc_modeuler),
INTENT(INOUT) :: this
93 CLASS(mesh_base),
INTENT(INOUT) :: Mesh
94 CLASS(physics_base),
INTENT(IN) :: Physics
95 TYPE(Dict_TYP),
POINTER :: config, IO
98 CALL getattr(config,
"order", this%order, 3)
102 SELECT CASE(this%GetOrder())
108 this%tol_abs(:) = 1.0
109 CALL this%Warning(
"InitTimedisc_modeuler", &
110 "adaptive step size control not supported in 1st order scheme",0)
112 IF (this%tol_rel.GT.1.0) &
113 CALL this%Warning(
"InitTimedisc_modeuler", &
114 "adaptive step size control disabled (tol_rel>1)",0)
116 CALL this%Error(
"InitTimedisc_modeuler",
"time order must be one of 1,2,3")
118 IF ((this%tol_rel.LT.0.0).OR.minval(this%tol_abs(:)).LT.0.0) &
119 CALL this%Error(
"InitTimedisc_modeuler", &
120 "error tolerance levels must be greater than 0")
125 SUBROUTINE solveode(this,Mesh,Physics,Sources,Fluxes,time,dt,err)
128 CLASS(timedisc_modeuler),
INTENT(INOUT) :: this
129 CLASS(mesh_base),
INTENT(IN) :: Mesh
130 CLASS(physics_base),
INTENT(INOUT) :: Physics
131 CLASS(sources_base),
POINTER :: Sources
132 CLASS(fluxes_base),
INTENT(INOUT) :: Fluxes
139 CLASS(marray_compound),
POINTER :: var
141 TYPE(var_typ) :: p(4),c(4)
144 INTENT(INOUT) :: dt,err
147 order = this%GetOrder()
149 IF (this%tol_rel.GE.1.0)
THEN 154 t = time+
zeta(n,order)*dt
156 CALL this%ComputeCVar(mesh,physics,fluxes,
eta(n,order), &
157 t,dt,this%cold,this%pvar,this%cvar,this%rhs,this%cvar)
159 CALL this%ComputeRHS(mesh,physics,sources,fluxes,t,dt,&
166 p(1)%var => this%pvar
167 p(2)%var => this%ptmp
168 p(3)%var => this%pvar
169 p(4)%var => this%pvar
170 c(1)%var => this%cvar
171 c(2)%var => this%ctmp
172 c(3)%var => this%cvar
173 c(4)%var => this%cvar
177 t = time+
zeta(n,order)*dt
179 CALL this%ComputeCVar(mesh,physics,fluxes,
eta(n,order), &
180 t,dt,this%cold,p(n)%var,c(n)%var,this%rhs,c(n+1)%var)
183 IF (n.EQ.2.AND.order.EQ.3) &
184 this%ctmp%data4d(:,:,:,:) =
updatetimestep_modeuler(
eta(2,2),dt,this%cold%data4d(:,:,:,:), &
185 this%ctmp%data4d(:,:,:,:),this%rhs%data4d(:,:,:,:))
188 CALL this%ComputeRHS(mesh,physics,sources,fluxes,t,dt,p(n+1)%var,c(n+1)%var,&
192 err = this%ComputeError(mesh,physics,this%cvar,this%ctmp)
193 dt = this%AdjustTimestep(err,dt)
203 cold,pvar,cvar,rhs,cnew)
206 CLASS(timedisc_modeuler),
INTENT(INOUT) :: this
207 CLASS(mesh_base),
INTENT(IN) :: Mesh
208 CLASS(physics_base),
INTENT(INOUT) :: Physics
209 CLASS(fluxes_base),
INTENT(INOUT) :: Fluxes
210 CLASS(marray_compound),
INTENT(INOUT) :: cold,pvar,cvar,cnew,rhs
215 INTENT(IN) :: eta,time,dt
223 cold%data2d(:,l),cvar%data2d(:,l),rhs%data2d(:,l))
225 IF(mesh%INUM.GT.1)
THEN 228 DO k=mesh%KMIN,mesh%KMAX
230 DO j=mesh%JMIN,mesh%JMAX
233 fluxes%bxflux(j,k,1,l),rhs%data4d(mesh%IMIN-mesh%IP1,j,k,l))
235 fluxes%bxflux(j,k,2,l),rhs%data4d(mesh%IMAX+mesh%IP1,j,k,l))
239 IF(mesh%JNUM.GT.1)
THEN 242 DO i=mesh%IMIN,mesh%IMAX
244 DO k=mesh%KMIN,mesh%KMAX
247 fluxes%byflux(k,i,1,l),rhs%data4d(i,mesh%JMIN-mesh%Jp1,k,l))
249 fluxes%byflux(k,i,2,l),rhs%data4d(i,mesh%JMAX+mesh%Jp1,k,l))
254 IF(mesh%KNUM.GT.1)
THEN 257 DO j=mesh%JMIN,mesh%JMAX
260 DO i=mesh%IMIN,mesh%IMAX
262 fluxes%bzflux(i,j,1,l),rhs%data4d(i,j,mesh%KMIN-mesh%Kp1,l))
264 fluxes%bzflux(i,j,2,l),rhs%data4d(i,j,mesh%KMAX+mesh%Kp1,l))
275 CLASS(timedisc_modeuler) :: this
277 CALL this%Finalize_base()
284 REAL,
INTENT(IN) :: eta_n,dt,y0,yn,rhs
292 y = yn-dt*rhs+eta_n*(y0-yn+dt*rhs)
integer, parameter, public check_pmin
integer, parameter, public check_all
character(len=32), parameter odesolver_name
generic source terms module providing functionaly common to all source terms
integer, parameter, public dtcause_cfl
derived class for compound of mesh arrays
base class for mesh arrays
elemental real function updatetimestep_modeuler(eta_n, dt, y0, yn, rhs)
real, dimension(3, 3), parameter zeta
subroutine solveode(this, Mesh, Physics, Sources, Fluxes, time, dt, err)
integer, parameter, public check_nothing
integer, parameter, public dtcause_smallerr
subroutine finalize(this)
integer, parameter, public check_csound
integer, parameter, public check_tmin
real, dimension(3, 3), parameter eta
integer, parameter, public dtcause_erradj
integer, parameter, public modified_euler
integer, parameter, public check_invalid
Dictionary for generic data types.
subroutine computecvar_modeuler(this, Mesh, Physics, Fluxes, eta, time, dt, cold, pvar, cvar, rhs, cnew)
performs the time step update using the RHS
subroutines for modified Euler i.e. Runge-Kutta methods
base module for numerical flux functions
integer, parameter, public check_rhomin
subroutine inittimedisc_modeuler(this, Mesh, Physics, config, IO)