2 subroutine bc_phys(iside,idims,time,qdt,s,ixG^L,ixB^L)
9 integer,
intent(in) :: iside, idims, ixG^L,ixB^L
10 double precision,
intent(in) :: time,qdt
11 type(state),
intent(inout) :: s
12 double precision :: wtmp(ixG^S,1:nwflux)
15 integer :: ixOs^L,hxO^L,jxO^L
16 double precision :: Q(ixG^S),Qp(ixG^S)
17 integer :: iw, iB, ix^D, ixO^L, ixM^L, nghostcellsi,iib^D
18 logical :: isphysbound
20 associate(x=>s%x,w=>s%w,ws=>s%ws)
26 ixomin^dd=ixbmax^d+1-
nghostcells^d%ixOmin^dd=ixbmin^dd;
34 do ix^d=ixomin^d,ixomax^d
35 w(ix^d^d%ixO^s,iw) = w(ixomin^d-1^d%ixO^s,iw)
38 w(ixo^s,iw) = w(ixomin^d-1:ixomin^d-
nghostcells:-1^d%ixO^s,iw)
40 w(ixo^s,iw) =-w(ixomin^d-1:ixomin^d-
nghostcells:-1^d%ixO^s,iw)
45 do ix^d=ixomin^d,ixomax^d
46 w(ix^d^d%ixO^s,iw) = max(w(ixomin^d-1^d%ixO^s,iw),zero)
49 do ix^d=ixomin^d,ixomax^d
50 w(ix^d^d%ixO^s,iw) = w(ixomin^d-1^d%ixO^s,iw)
55 w(ixo^s,iw) = - w(ixo^s,iw)
61 write (
unitterm,*)
"Undefined boundarytype found in bc_phys", &
62 "for variable iw=",iw,
" and side iB=",ib
70 ixosmin^dd=ixomin^dd-
kr(^dd,idir);
75 do ix^d=ixosmin^d,ixosmax^d
76 ws(ix^d^d%ixOs^s,idir) = ws(ixosmin^d-1^d%ixOs^s,idir)
79 ws(ixos^s,idir) = ws(ixosmin^d-1:ixosmin^d-
nghostcells:-1^d%ixOs^s,idir)
81 ws(ixos^s,idir) =-ws(ixosmin^d-1:ixosmin^d-
nghostcells:-1^d%ixOs^s,idir)
84 write (
unitterm,*)
"Undefined boundarytype found in bc_phys", &
85 "for variable iw=",iw,
" and side iB=",ib
103 ws(ixosmin^d+ix^d^d%ixOs^s,idir)=&
104 (q(hxomax^d^d%hxO^s)*s%dvolume(hxomax^d^d%hxO^s)&
105 -qp(ixomin^d+ix^d^d%ixO^s)*s%dvolume(ixomin^d+ix^d^d%ixO^s))&
106 /s%surfaceC(ixosmin^d+ix^d^d%ixOs^s,^d)
110 ws(ixos^s,idir)= ws(ixosmin^d-2:ixosmin^d-
nghostcells-1:-1^d%ixOs^s,idir)
113 ws(ixos^s,idir)=-ws(ixosmin^d-2:ixosmin^d-
nghostcells-1:-1^d%ixOs^s,idir)
124 ixomax^dd=ixbmin^d-1+
nghostcells^d%ixOmax^dd=ixbmax^dd;
131 do ix^d=ixomin^d,ixomax^d
132 w(ix^d^d%ixO^s,iw) = w(ixomax^d+1^d%ixO^s,iw)
135 w(ixo^s,iw) = w(ixomax^d+
nghostcells:ixomax^d+1:-1^d%ixO^s,iw)
137 w(ixo^s,iw) =-w(ixomax^d+
nghostcells:ixomax^d+1:-1^d%ixO^s,iw)
142 do ix^d=ixomin^d,ixomax^d
143 w(ix^d^d%ixO^s,iw) = min(w(ixomax^d+1^d%ixO^s,iw),zero)
146 do ix^d=ixomin^d,ixomax^d
147 w(ix^d^d%ixO^s,iw) = w(ixomax^d+1^d%ixO^s,iw)
152 w(ixo^s,iw) = - w(ixo^s,iw)
158 write (
unitterm,*)
"Undefined boundarytype found in bc_phys", &
159 "for variable iw=",iw,
" and side iB=",ib
166 ixosmax^dd=ixomax^dd;
167 ixosmin^dd=ixomin^dd-
kr(^dd,idir);
172 do ix^d=ixosmin^d,ixosmax^d
173 ws(ix^d^d%ixOs^s,idir) = ws(ixosmax^d+1^d%ixOs^s,idir)
176 ws(ixos^s,idir) = ws(ixosmax^d+
nghostcells:ixosmax^d+1:-1^d%ixOs^s,idir)
178 ws(ixos^s,idir) =-ws(ixosmax^d+
nghostcells:ixosmax^d+1:-1^d%ixOs^s,idir)
181 write (
unitterm,*)
"Undefined boundarytype in bc_phys", &
182 "for variable iw=",iw,
" and side iB=",ib
191 ixos^l=ixo^l-
kr(^dd,^d);
200 ws(ixosmax^d-ix^d^d%ixOs^s,idir)=&
201 -(q(jxomin^d^d%jxO^s)*s%dvolume(jxomin^d^d%jxO^s)&
202 -qp(ixomax^d-ix^d^d%ixO^s)*s%dvolume(ixomax^d-ix^d^d%ixO^s))&
203 /s%surfaceC(ixosmax^d-ix^d^d%ixOs^s,^d)
207 ws(ixos^s,idir)= ws(ixosmax^d+
nghostcells+1:ixosmax^d+2:-1^d%ixOs^s,idir)
210 ws(ixos^s,idir)=-ws(ixosmax^d+
nghostcells+1:ixosmax^d+2:-1^d%ixOs^s,idir)
223 call mpistop(
"usr_special_bc not defined")
232 {
#IFDEF EVOLVINGBOUNDARY
235 if(ixgmax1==ixghi1)
then
244 ixomin^dd=ixgmax^d+1-nghostcellsi^d%ixOmin^dd=ixbmin^dd;
246 if(all(w(ixo^s,1:nwflux)==0.d0))
then
247 do ix^d=ixomin^d,ixomax^d
248 w(ix^d^d%ixO^s,1:nwflux) = w(ixomin^d-1^d%ixO^s,1:nwflux)
251 if(qdt>0.d0.and.ixgmax^d==
ixghi^d)
then
252 ixomin^dd=ixomin^d^d%ixOmin^dd=ixmmin^dd;
253 ixomax^dd=ixomax^d^d%ixOmax^dd=ixmmax^dd;
254 wtmp(ixg^s,1:nw)=pso(
block%igrid)%w(ixg^s,1:nw)
255 call characteristic_project(idims,iside,ixg^l,ixo^l,wtmp,x,
dxlevel,qdt)
256 w(ixo^s,1:nwflux)=wtmp(ixo^s,1:nwflux)
261 ixomax^dd=ixgmin^d-1+nghostcellsi^d%ixOmax^dd=ixbmax^dd;
262 if(all(w(ixo^s,1:nwflux)==0.d0))
then
263 do ix^d=ixomin^d,ixomax^d
264 w(ix^d^d%ixO^s,1:nwflux) = w(ixomax^d+1^d%ixO^s,1:nwflux)
267 if(qdt>0.d0.and.ixgmax^d==
ixghi^d)
then
268 ixomin^dd=ixomin^d^d%ixOmin^dd=ixmmin^dd;
269 ixomax^dd=ixomax^d^d%ixOmax^dd=ixmmax^dd;
270 wtmp(ixg^s,1:nw)=pso(
block%igrid)%w(ixg^s,1:nw)
271 call characteristic_project(idims,iside,ixg^l,ixo^l,wtmp,x,
dxlevel,qdt)
272 w(ixo^s,1:nwflux)=wtmp(ixo^s,1:nwflux)
276 if(ixgmax1==ixghi1)
then
277 call identifyphysbound(
block%igrid,isphysbound,iib^d)
278 if(iib1==-1.and.iib2==-1)
then
281 w(ix^d,1:nwflux)=(w(ix1+1,ix2+1,1:nwflux)+w(ix1+1,ix2,1:nwflux)+w(ix1,ix2+1,1:nwflux))/3.d0
285 if(iib1== 1.and.iib2==-1)
then
287 do ix1=ixmmax1+1,ixgmax1
288 w(ix^d,1:nwflux)=(w(ix1-1,ix2+1,1:nwflux)+w(ix1-1,ix2,1:nwflux)+w(ix1,ix2+1,1:nwflux))/3.d0
292 if(iib1==-1.and.iib2== 1)
then
293 do ix2=ixmmax2+1,ixgmax2
295 w(ix^d,1:nwflux)=(w(ix1+1,ix2-1,1:nwflux)+w(ix1+1,ix2,1:nwflux)+w(ix1,ix2-1,1:nwflux))/3.d0
299 if(iib1== 1.and.iib2== 1)
then
300 do ix2=ixmmax2+1,ixgmax2
301 do ix1=ixmmax1+1,ixgmax1
302 w(ix^d,1:nwflux)=(w(ix1-1,ix2-1,1:nwflux)+w(ix1-1,ix2,1:nwflux)+w(ix1,ix2-1,1:nwflux))/3.d0
319 double precision,
intent(in) :: time
320 integer,
intent(in) :: ixG^L
322 integer :: iigrid, igrid, ixO^L
324 ixo^l=ixg^l^lsubnghostcells;
327 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
subroutine bc_phys(iside, idims, time, qdt, s, ixGL, ixBL)
fill ghost cells at a physical boundary
subroutine getintbc(time, ixGL)
fill inner boundary values
subroutine mpistop(message)
Exit MPI-AMRVAC with an error message.
Module to set boundary conditions from user data.
subroutine, public bc_data_set(qt, ixIL, ixOL, iB, w, x)
Set boundary conditions according to user data.
This module contains definitions of global parameters and variables and some generic functions/subrou...
type(state), pointer block
Block pointer for using one block and its previous state.
integer, parameter bc_noinflow
integer ixghi
Upper index of grid block arrays.
integer, parameter bc_asymm
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter bc_character
integer, dimension(:, :), allocatable typeboundary
Array indicating the type of boundary condition per variable and per physical boundary.
logical stagger_grid
True for using stagger grid.
integer, parameter bc_data
integer, parameter plevel_
integer, dimension(:), allocatable, parameter d
integer, parameter bc_periodic
integer, parameter bc_special
boundary condition types
integer, parameter unitterm
Unit for standard output.
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
integer, parameter bc_cont
integer nghostcells
Number of ghost cells surrounding a grid.
integer, parameter bc_symm
integer, parameter bc_aperiodic
integer, dimension(:,:), allocatable node
double precision, dimension(ndim) dxlevel
Magneto-hydrodynamics module.
subroutine, public get_divb(w, ixIL, ixOL, divb, fourthorder)
Calculate div B within ixO.
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_face_to_center), pointer phys_face_to_center
Module with all the methods that users can customize in AMRVAC.
procedure(special_bc), pointer usr_special_bc
procedure(internal_bc), pointer usr_internal_bc