29 integer,
intent(in) :: ixI^L,ixO^L,idim
30 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wRC,wLC
31 double precision,
dimension(ixI^S,1:nwflux),
intent(in) :: fLC, fRC
32 integer,
dimension(ixI^S),
intent(inout) :: patchf
34 integer :: ixOO^D,TxOO^L
39 {
do ixoo^d= ixo^lim^d\}
44 if(abs(patchf(ixoo^d)) == 1 .or. abs(patchf(ixoo^d)) == 4)
Then
45 if(any(frc(ixoo^d,1:nwflux)*flc(ixoo^d,1:nwflux)<-smalldouble))
Then
46 where(abs(patchf(txoo^s))==1)
55 subroutine mhd_get_lcd(wLC,wRC,fLC,fRC,cmin,cmax,idim,ixI^L,ixO^L, &
56 whll,Fhll,lambdaCD,patchf)
62 integer,
intent(in) :: ixI^L,ixO^L,idim
63 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wLC,wRC
64 double precision,
dimension(ixI^S,1:nwflux),
intent(in) :: fLC,fRC
65 double precision,
dimension(ixI^S),
intent(in) :: cmax,cmin
66 integer ,
dimension(ixI^S),
intent(inout) :: patchf
67 double precision,
dimension(ixI^S,1:nwflux),
intent(out) :: Fhll,whll
68 double precision,
dimension(ixI^S),
intent(out) :: lambdaCD
70 logical ,
dimension(ixO^S) :: Cond_patchf
71 double precision :: Epsilon
80 cond_patchf(ixo^s)=(abs(patchf(ixo^s))==1)
84 where(cond_patchf(ixo^s))
86 fhll(ixo^s,iw)= (cmax(ixo^s)*flc(ixo^s,iw)-cmin(ixo^s)*frc(ixo^s,iw) &
87 + cmin(ixo^s)*cmax(ixo^s)*(wrc(ixo^s,iw)-wlc(ixo^s,iw)))&
88 /(cmax(ixo^s)-cmin(ixo^s))
90 whll(ixo^s,iw) = (cmax(ixo^s)*wrc(ixo^s,iw)-cmin(ixo^s)*wlc(ixo^s,iw)&
91 +flc(ixo^s,iw)-frc(ixo^s,iw))/(cmax(ixo^s)-cmin(ixo^s))
96 where(cond_patchf(ixo^s))
97 lambdacd(ixo^s)=whll(ixo^s,
mom(idim))/whll(ixo^s,
rho_)
100 {
do ix^db=ixomin^db,ixomax^db\}
101 if(cond_patchf(ix^d))
then
104 if(cmin(ix^d)<zero.and.lambdacd(ix^d)>zero&
105 .and.lambdacd(ix^d)<cmax(ix^d))
then
107 else if(cmax(ix^d)>zero.and.lambdacd(ix^d)<zero&
108 .and.lambdacd(ix^d)>cmin(ix^d))
then
110 else if(lambdacd(ix^d)>=cmax(ix^d).or.lambdacd(ix^d) <= cmin(ix^d))
then
111 lambdacd(ix^d) = zero
118 where(patchf(ixo^s)== 3)
119 cond_patchf(ixo^s)=.false.
123 if(any(lambdacd(ixo^s)==zero.and.cond_patchf(ixo^s)))
then
126 {
do ix^db=ixomin^db,ixomax^db\}
127 if(lambdacd(ix^d)==zero.and.cond_patchf(ix^d))
then
128 if(-cmin(ix^d)>=cmax(ix^d))
then
140 where(cond_patchf(ixo^s).and. &
141 dabs(lambdacd(ixo^s))/max(cmax(ixo^s),epsilon)< epsilon .and. &
142 dabs(lambdacd(ixo^s))/max(dabs(cmin(ixo^s)),epsilon)< epsilon)
143 lambdacd(ixo^s) = zero
149 subroutine mhd_get_wcd(wLC,wRC,whll,fRC,fLC,Fhll,patchf,lambdaCD,cmin,cmax,&
158 integer,
intent(in) :: ixI^L,ixO^L,idim
159 double precision,
dimension(ixI^S,1:nw),
intent(in) :: wRC,wLC
160 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: whll, Fhll
161 double precision,
dimension(ixI^S),
intent(in) :: lambdaCD
162 double precision,
dimension(ixI^S),
intent(in) :: cmax,cmin
163 double precision,
dimension(ixI^S,1:nwflux),
intent(in):: fRC,fLC
164 double precision,
dimension(ixI^S,1:nwflux),
intent(out):: f
165 double precision,
dimension(ixI^S,1:nw) :: wCD,wSub
166 double precision,
dimension(ixI^S,1:nwflux) :: fSub
167 double precision,
dimension(ixI^S) :: vSub,cspeed,pCD,VdotBCD
168 integer ,
dimension(ixI^S),
intent(in) :: patchf
170 integer :: n, iw, idir,ix^D
173 {
do ix^db=ixomin^db,ixomax^db\}
174 if(patchf(ix^d)==1)
then
175 cspeed(ix^d)=cmax(ix^d)
176 vsub(ix^d)=wrc(ix^d,mom(idim))/wrc(ix^d,rho_)
177 wsub(ix^d,:)=wrc(ix^d,:)
178 fsub(ix^d,:)=frc(ix^d,:)
179 else if(patchf(ix^d)==-1)
then
180 cspeed(ix^d)=cmin(ix^d)
181 vsub(ix^d)=wlc(ix^d,mom(idim))/wlc(ix^d,rho_)
182 wsub(ix^d,:)=wlc(ix^d,:)
183 fsub(ix^d,:)=flc(ix^d,:)
187 {
do ix^db=ixomin^db,ixomax^db\}
188 if(abs(patchf(ix^d))==1)
then
189 wcd(ix^d,rho_) = wsub(ix^d,rho_)&
190 *(cspeed(ix^d)-vsub(ix^d))/(cspeed(ix^d)-lambdacd(ix^d))
193 wcd(ix^d,iw) = wsub(ix^d,iw)*(cspeed(ix^d)-vsub(ix^d))&
194 /(cspeed(ix^d)-lambdacd(ix^d))
199 wcd(ix^d,mag(idir)) = whll(ix^d,mag(idir))
205 wcd(ix^d,mom(iw))=(cspeed(ix^d)*wsub(ix^d,mom(iw))-fsub(ix^d,mom(iw))&
206 -wcd(ix^d,mag(idim))*wcd(ix^d,mag(iw)))/&
207 (cspeed(ix^d)-lambdacd(ix^d))
210 wcd(ix^d,mom(iw)) = wcd(ix^d,rho_) * lambdacd(ix^d)
214 vdotbcd(ix^d) = sum(whll(ix^d,mom(:))*whll(ix^d,mag(:)))/whll(ix^d,rho_)
216 pcd(ix^d) = wsub(ix^d,rho_)*(cspeed(ix^d)-vsub(ix^d))&
217 *(lambdacd(ix^d)-vsub(ix^d))&
218 +fsub(ix^d,mom(idim))-wsub(ix^d,mom(idim))*vsub(ix^d)&
219 + wcd(ix^d,mag(idim))**2
221 wcd(ix^d,e_) = (cspeed(ix^d)*wsub(ix^d,e_) &
222 -fsub(ix^d,e_)+lambdacd(ix^d)*pcd(ix^d)&
223 -vdotbcd(ix^d)*wcd(ix^d,mag(idim)))&
224 /(cspeed(ix^d)-lambdacd(ix^d))
230 if(iw == mag(idim))
then
232 else if(mhd_glm .and. iw == psi_)
then
235 where(abs(patchf(ixo^s))==1)
237 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.
subroutine, public mhd_hllc_init()
subroutine mhd_get_wcd(wLC, wRC, whll, fRC, fLC, Fhll, patchf, lambdaCD, cmin, cmax, ixIL, ixOL, idim, f)
subroutine mhd_get_lcd(wLC, wRC, fLC, fRC, cmin, cmax, idim, ixIL, ixOL, whll, Fhll, lambdaCD, patchf)
subroutine mhd_diffuse_hllcd(ixIL, ixOL, idim, wLC, wRC, fLC, fRC, patchf)
Magneto-hydrodynamics module.
integer, dimension(:), allocatable, public, protected mom
Indices of the momentum density.
integer, public, protected rho_
Index of the density (in the w array)
procedure(sub_get_wcd), pointer phys_get_wcd
procedure(sub_get_lcd), pointer phys_get_lcd
procedure(sub_diffuse_hllcd), pointer phys_diffuse_hllcd