14 integer,
allocatable :: i_mom(:)
23 allocate(i_mom(1:
ndir))
31 integer,
intent(in) :: ii
32 integer,
intent(out) :: rho_, mom(1:ndir),e_
39 i_mom(1:ndir) =
mom_c(1:ndir)
46 i_mom(1:ndir) =
mom_n(1:ndir)
67 integer,
intent(in) :: ixI^L,ixO^L,idim
68 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wRC,wLC
69 double precision,
dimension(ixI^S,1:nwflux),
intent(in) :: fLC, fRC
70 integer ,
dimension(ixI^S),
intent(inout) :: patchf
72 integer :: ixOO^D,TxOO^L
76 {
do ixoo^d= ixo^lim^d\}
81 if(abs(patchf(ixoo^d)) == 1 .or. abs(patchf(ixoo^d)) == 4)
Then
82 if(any(frc(ixoo^d,1:nwflux)*flc(ixoo^d,1:nwflux)<-smalldouble))
Then
83 where(abs(patchf(txoo^s))==1)
93 whll,Fhll,lambdaCD,patchf)
101 integer,
intent(in) :: ixI^L,ixO^L,idim
102 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wLC,wRC
103 double precision,
dimension(ixI^S,1:nwflux),
intent(in) :: fLC,fRC
104 double precision,
dimension(ixI^S),
intent(in) :: cmax,cmin
105 integer ,
dimension(ixI^S),
intent(inout) :: patchf
106 double precision,
dimension(ixI^S,1:nwflux),
intent(out) :: Fhll,whll
107 double precision,
dimension(ixI^S),
intent(out) :: lambdaCD
109 logical ,
dimension(ixI^S) :: Cond_patchf
110 double precision :: Epsilon
120 cond_patchf(ixo^s)=(abs(patchf(ixo^s))==1)
124 where(cond_patchf(ixo^s))
126 fhll(ixo^s,iw)= (cmax(ixo^s)*flc(ixo^s,iw)-cmin(ixo^s)*frc(ixo^s,iw) &
127 + cmin(ixo^s)*cmax(ixo^s)*(wrc(ixo^s,iw)-wlc(ixo^s,iw)))&
128 /(cmax(ixo^s)-cmin(ixo^s))
130 whll(ixo^s,iw) = (cmax(ixo^s)*wrc(ixo^s,iw)-cmin(ixo^s)*wlc(ixo^s,iw)&
131 +flc(ixo^s,iw)-frc(ixo^s,iw))/(cmax(ixo^s)-cmin(ixo^s))
136 where(cond_patchf(ixo^s))
137 lambdacd(ixo^s)=whll(ixo^s,i_mom(idim))/whll(ixo^s,i_rho)
140 {
do ix^db=ixomin^db,ixomax^db\}
141 if(cond_patchf(ix^d))
then
144 if(cmin(ix^d) < zero .and. lambdacd(ix^d)>zero&
145 .and.lambdacd(ix^d)<cmax(ix^d))
then
147 else if(cmax(ix^d) > zero .and. lambdacd(ix^d) < zero&
148 .and.lambdacd(ix^d)>cmin(ix^d))
then
150 else if(lambdacd(ix^d) >= cmax(ix^d) .or. &
151 lambdacd(ix^d) <= cmin(ix^d))
then
152 lambdacd(ix^d) = zero
159 where(patchf(ixo^s)== 3)
160 cond_patchf(ixo^s)=.false.
164 if(any(cond_patchf(ixo^s).and.lambdacd(ixo^s)==zero))
then
167 {
do ix^db=ixomin^db,ixomax^db\}
168 if(lambdacd(ix^d)==zero.and.cond_patchf(ix^d))
then
169 if(-cmin(ix^d)>=cmax(ix^d))
then
181 where(cond_patchf(ixo^s).and. &
182 dabs(lambdacd(ixo^s))/max(cmax(ixo^s),epsilon)< epsilon .and. &
183 dabs(lambdacd(ixo^s))/max(dabs(cmin(ixo^s)),epsilon)< epsilon)
184 lambdacd(ixo^s) = zero
190 subroutine twofl_get_wcd_n(wLC,wRC,whll,fRC,fLC,Fhll,patchf,lambdaCD,cmin,cmax,&
201 integer,
intent(in) :: ixI^L,ixO^L,idim
202 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wRC,wLC
203 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: whll, Fhll
204 double precision,
dimension(ixI^S),
intent(in) :: lambdaCD
205 double precision,
dimension(ixI^S),
intent(in) :: cmax,cmin
206 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: fRC,fLC
207 double precision,
dimension(ixI^S,1:nwflux),
intent(out):: f
208 double precision,
dimension(ixI^S,1:nw) :: wCD,wSub
209 double precision,
dimension(ixI^S,1:nwflux) :: fSub
210 double precision,
dimension(ixI^S) :: vSub,cspeed,pCD
211 integer ,
dimension(ixI^S),
intent(in) :: patchf
213 double precision :: csmls
214 integer :: n, iw, ix^D
217 {
do ix^db=ixomin^db,ixomax^db\}
218 if(patchf(ix^d)==1)
then
219 cspeed(ix^d)=cmax(ix^d)
220 vsub(ix^d)=wrc(ix^d,i_mom(idim))/wrc(ix^d,i_rho)
221 wsub(ix^d,:)=wrc(ix^d,:)
222 fsub(ix^d,:)=frc(ix^d,:)
223 else if(patchf(ix^d)==-1)
then
224 cspeed(ix^d)=cmin(ix^d)
225 vsub(ix^d)=wlc(ix^d,i_mom(idim))/wlc(ix^d,i_rho)
226 wsub(ix^d,:)=wlc(ix^d,:)
227 fsub(ix^d,:)=flc(ix^d,:)
231 {
do ix^db=ixomin^db,ixomax^db\}
232 if(abs(patchf(ix^d))==1)
then
233 csmls=one/(cspeed(ix^d)-lambdacd(ix^d))
234 wcd(ix^d,i_rho) = wsub(ix^d,i_rho)&
235 *(cspeed(ix^d)-vsub(ix^d))*csmls
241 wcd(ix^d,i_mom(iw))=(cspeed(ix^d)*wsub(ix^d,i_mom(iw))-fsub(ix^d,i_mom(iw)))*csmls
244 wcd(ix^d,i_mom(iw)) = wcd(ix^d,i_rho) * lambdacd(ix^d)
248 pcd(ix^d) = wsub(ix^d,i_rho)*(cspeed(ix^d)-vsub(ix^d))&
249 *(lambdacd(ix^d)-vsub(ix^d))&
250 +fsub(ix^d,i_mom(idim))-wsub(ix^d,i_mom(idim))*vsub(ix^d)
252 wcd(ix^d,i_e) = (cspeed(ix^d)*wsub(ix^d,i_e) &
253 -fsub(ix^d,i_e)+lambdacd(ix^d)*pcd(ix^d))*csmls
257 f(ix^d,iw)=fsub(ix^d,iw)+cspeed(ix^d)*(wcd(ix^d,iw)-wsub(ix^d,iw))
272 integer,
intent(in) :: ixI^L,ixO^L,idim
273 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wRC,wLC
274 double precision,
dimension(ixI^S,1:nwflux),
intent(in) :: fLC, fRC
275 integer,
dimension(ixI^S),
intent(inout) :: patchf
277 integer :: ixOO^D,TxOO^L
282 {
do ixoo^d= ixo^lim^d\}
287 if(abs(patchf(ixoo^d)) == 1 .or. abs(patchf(ixoo^d)) == 4)
Then
288 if(any(frc(ixoo^d,1:nwflux)*flc(ixoo^d,1:nwflux)<-smalldouble))
Then
289 where(abs(patchf(txoo^s))==1)
299 whll,Fhll,lambdaCD,patchf)
307 integer,
intent(in) :: ixI^L,ixO^L,idim
308 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wLC,wRC
309 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: fLC,fRC
310 double precision,
dimension(ixI^S),
intent(in) :: cmax,cmin
311 integer ,
dimension(ixI^S),
intent(inout) :: patchf
312 double precision,
dimension(ixI^S,1:nwflux),
intent(out) :: Fhll,whll
313 double precision,
dimension(ixI^S),
intent(out) :: lambdaCD
315 logical ,
dimension(ixI^S) :: Cond_patchf
316 double precision :: Epsilon
325 cond_patchf(ixo^s)=(abs(patchf(ixo^s))==1)
328 where(cond_patchf(ixo^s))
330 fhll(ixo^s,iw)= (cmax(ixo^s)*flc(ixo^s,iw)-cmin(ixo^s)*frc(ixo^s,iw) &
331 + cmin(ixo^s)*cmax(ixo^s)*(wrc(ixo^s,iw)-wlc(ixo^s,iw)))&
332 /(cmax(ixo^s)-cmin(ixo^s))
334 whll(ixo^s,iw) = (cmax(ixo^s)*wrc(ixo^s,iw)-cmin(ixo^s)*wlc(ixo^s,iw)&
335 +flc(ixo^s,iw)-frc(ixo^s,iw))/(cmax(ixo^s)-cmin(ixo^s))
340 where(cond_patchf(ixo^s))
341 lambdacd(ixo^s)=whll(ixo^s,i_mom(idim))/whll(ixo^s,i_rho)
345 where(cond_patchf(ixo^s))
348 where(cmin(ixo^s)<zero.and.lambdacd(ixo^s)>zero&
349 .and.lambdacd(ixo^s)<cmax(ixo^s))
351 elsewhere(cmax(ixo^s)>zero.and.lambdacd(ixo^s)<zero&
352 .and.lambdacd(ixo^s)>cmin(ixo^s))
354 elsewhere(lambdacd(ixo^s)>=cmax(ixo^s).or.lambdacd(ixo^s) <= cmin(ixo^s))
355 lambdacd(ixo^s) = zero
362 where(patchf(ixo^s)== 3)
363 cond_patchf(ixo^s)=.false.
368 if(any(lambdacd(ixo^s)==zero.and.cond_patchf(ixo^s)))
then
371 where(lambdacd(ixo^s)==zero.and.cond_patchf(ixo^s))
372 where(-cmin(ixo^s)>=cmax(ixo^s))
383 where(cond_patchf(ixo^s).and. &
384 dabs(lambdacd(ixo^s))/max(cmax(ixo^s),epsilon)< epsilon .and. &
385 dabs(lambdacd(ixo^s))/max(dabs(cmin(ixo^s)),epsilon)< epsilon)
386 lambdacd(ixo^s) = zero
392 subroutine twofl_get_wcd_c(wLC,wRC,whll,fRC,fLC,Fhll,patchf,lambdaCD,cmin,cmax,&
401 integer,
intent(in) :: ixI^L,ixO^L,idim
402 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wRC,wLC
403 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: whll, Fhll
404 double precision,
dimension(ixI^S),
intent(in) :: lambdaCD
405 double precision,
dimension(ixI^S),
intent(in) :: cmax,cmin
406 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: fRC,fLC
407 double precision,
dimension(ixI^S,1:nwflux),
intent(out):: f
408 double precision,
dimension(ixI^S,1:nw) :: wCD,wSub
409 double precision,
dimension(ixI^S,1:nwflux) :: fSub
410 double precision,
dimension(ixI^S) :: vSub,cspeed,pCD,VdotBCD
411 integer ,
dimension(ixI^S),
intent(in) :: patchf
413 integer :: n, iw, idir,ix^D
414 double precision,
dimension(ixI^S) :: rho
418 {
do ix^db=ixomin^db,ixomax^db\}
419 if(patchf(ix^d)==1)
then
420 cspeed(ix^d)=cmax(ix^d)
421 vsub(ix^d)=wrc(ix^d,i_mom(idim))/wrc(ix^d,i_rho)
422 wsub(ix^d,:)=wrc(ix^d,:)
423 fsub(ix^d,:)=frc(ix^d,:)
424 else if(patchf(ix^d)==-1)
then
425 cspeed(ix^d)=cmin(ix^d)
426 vsub(ix^d)=wlc(ix^d,i_mom(idim))/wlc(ix^d,i_rho)
427 wsub(ix^d,:)=wlc(ix^d,:)
428 fsub(ix^d,:)=flc(ix^d,:)
432 {
do ix^db=ixomin^db,ixomax^db\}
433 if(abs(patchf(ix^d))==1)
then
434 wcd(ix^d,i_rho) = wsub(ix^d,i_rho)&
435 *(cspeed(ix^d)-vsub(ix^d))/(cspeed(ix^d)-lambdacd(ix^d))
445 wcd(ix^d,mag(idir)) = whll(ix^d,mag(idir))
451 wcd(ix^d,i_mom(iw))=(cspeed(ix^d)*wsub(ix^d,i_mom(iw))-fsub(ix^d,i_mom(iw))&
452 -wcd(ix^d,mag(idim))*wcd(ix^d,mag(iw)))/&
453 (cspeed(ix^d)-lambdacd(ix^d))
456 wcd(ix^d,i_mom(iw)) = wcd(ix^d,i_rho) * lambdacd(ix^d)
460 vdotbcd(ix^d) = sum(whll(ix^d,i_mom(:))*whll(ix^d,mag(:)))/whll(ix^d,i_rho)
462 pcd(ix^d) = wsub(ix^d,i_rho)*(cspeed(ix^d)-vsub(ix^d))&
463 *(lambdacd(ix^d)-vsub(ix^d))&
464 +fsub(ix^d,i_mom(idim))-wsub(ix^d,i_mom(idim))*vsub(ix^d)&
465 + wcd(ix^d,mag(idim))**2
467 wcd(ix^d,i_e) = (cspeed(ix^d)*wsub(ix^d,i_e) &
468 -fsub(ix^d,i_e)+lambdacd(ix^d)*pcd(ix^d)&
469 -vdotbcd(ix^d)*wcd(ix^d,mag(idim)))&
470 /(cspeed(ix^d)-lambdacd(ix^d))
476 if(iw == mag(idim))
then
478 else if(twofl_glm .and. iw == psi_)
then
481 where(abs(patchf(ixo^s))==1)
483 f(ixo^s,iw)=fsub(ixo^s,iw)+cspeed(ixo^s)*(wcd(ixo^s,iw)-wsub(ixo^s,iw))
integer, dimension(:), allocatable, public mag
Indices of the magnetic field.
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, dimension(3, 3) kr
Kronecker delta tensor.
double precision, dimension(:), allocatable, parameter d
integer ndir
Number of spatial dimensions (components) for vector variables.
procedure(sub_get_wcd), pointer phys_get_wcd
procedure(sub_hllc_init_species), pointer phys_hllc_init_species
procedure(sub_get_lcd), pointer phys_get_lcd
procedure(sub_diffuse_hllcd), pointer phys_diffuse_hllcd
This module defines the procedures of a physics module. It contains function pointers for the various...
subroutine twofl_get_wcd_c(wLC, wRC, whll, fRC, fLC, Fhll, patchf, lambdaCD, cmin, cmax, ixIL, ixOL, idim, f)
subroutine twofl_get_wcd_n(wLC, wRC, whll, fRC, fLC, Fhll, patchf, lambdaCD, cmin, cmax, ixIL, ixOL, idim, f)
subroutine twofl_hllc_init_species(ii, rho_, mom, e_)
subroutine twofl_get_lcd_n(wLC, wRC, fLC, fRC, cmin, cmax, idim, ixIL, ixOL, whll, Fhll, lambdaCD, patchf)
subroutine twofl_get_lcd_c(wLC, wRC, fLC, fRC, cmin, cmax, idim, ixIL, ixOL, whll, Fhll, lambdaCD, patchf)
subroutine, public twofl_hllc_init()
subroutine twofl_diffuse_hllcd_c(ixIL, ixOL, idim, wLC, wRC, fLC, fRC, patchf)
subroutine twofl_diffuse_hllcd_n(ixIL, ixOL, idim, wLC, wRC, fLC, fRC, patchf)
Magneto-hydrodynamics module.
integer, public e_c_
Index of the energy density (-1 if not present)
integer, dimension(:), allocatable, public mom_c
Indices of the momentum density.
integer, dimension(:), allocatable, public mom_n
integer, public rho_c_
Index of the density (in the w array)