10 integer,
intent(in) :: igrid
16 call set_b0_cell(ps(igrid)%B0(ixg^t,:,0),ps(igrid)%x,ixg^
ll,ixg^
ll)
18 call set_j0_cell(igrid,ps(igrid)%J0,ixg^
ll,
ixm^
ll^ladd1)
19 call set_b0_face(igrid,ps(igrid)%x,ixg^
ll,
ixm^
ll)
22 subroutine set_b0_cell(wB0,x,ixI^L,ix^L)
27 integer,
intent(in):: ixi^
l,ix^
l
28 double precision,
intent(inout) :: wb0(ixi^s,1:
ndir)
29 double precision,
intent(in) :: x(ixi^s,1:
ndim)
37 if (dabs(
bdip)>smalldouble)
then
38 wb0(ix^s,1)=2.0d0*
bdip*dcos(x(ix^s,2))/x(ix^s,1)**3
39 wb0(ix^s,2)=
bdip*dsin(x(ix^s,2))/x(ix^s,1)**3
42 if (abs(
bquad)>smalldouble)
then
43 wb0(ix^s,1)=wb0(ix^s,1) &
44 +
bquad*0.5d0*(1.0d0+3.0d0*dcos(2.0d0*x(ix^s,2)))/x(ix^s,1)**4
45 wb0(ix^s,2)=wb0(ix^s,2)+
bquad*dsin(2.0d0*x(ix^s,2))/x(ix^s,1)**4
47 if (abs(
boct)>smalldouble)
then
48 wb0(ix^s,1)=wb0(ix^s,1) &
49 +
boct*(10.0d0*dcos(2.0d0*x(ix^s,2))-2.0d0) &
50 *dcos(x(ix^s,2))/x(ix^s,1)**5
51 wb0(ix^s,2)=wb0(ix^s,2) &
52 +
boct*1.5d0*(3.0d0+5.0d0*dcos(2.0d0*x(ix^s,2))) &
53 *dsin(x(ix^s,2))/x(ix^s,1)**5
58 end subroutine set_b0_cell
60 subroutine set_j0_cell(igrid,wJ0,ixI^L,ix^L)
65 integer,
intent(in):: igrid,ixi^
l,ix^
l
66 double precision,
intent(inout) :: wj0(ixi^s,7-2*
ndir:3)
67 integer :: idirmin0, idirmin
73 call curlvector(ps(igrid)%B0(ixi^s,:,0),ixi^
l,ix^
l,wj0,idirmin,idirmin0,
ndir)
75 end subroutine set_j0_cell
77 subroutine set_b0_face(igrid,x,ixI^L,ixO^L)
80 integer,
intent(in) :: igrid, ixi^
l, ixo^
l
81 double precision,
intent(in) :: x(ixi^s,1:
ndim)
83 double precision :: delx(ixi^s,1:
ndim)
84 double precision :: xc(ixi^s,1:
ndim),xshift^
d
85 integer :: idims, ixc^
l, hxo^
l, ix, idims2
91 delx(ixi^s,1:
ndim)=ps(igrid)%dx(ixi^s,1:
ndim)
95 hxo^
l=ixo^
l-
kr(idims,^
d);
101 ixcmax^
d=ixomax^
d; ixcmin^
d=hxomin^
d;
104 xshift^
d=half*(one-
kr(^
d,idims));
111 xc(ix^
d%ixC^s,^
d)=x(ix^
d%ixC^s,^
d)+(half-xshift^
d)*delx(ix^
d%ixC^s,^
d)
115 call set_b0_cell(ps(igrid)%B0(ixi^s,:,idims),xc,ixi^l,ixc^l)
117 end subroutine set_b0_face
subroutine, public set_b0_grid(igrid)
Module with geometry-related routines (e.g., divergence, curl)
integer, parameter spherical
subroutine curlvector(qvec, ixil, ixol, curlvec, idirmin, idirmin0, ndir0, fourthorder)
Calculate curl of a vector qvec within ixL Options to employ standard second order CD evaluations use...
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer ixghi
Upper index of grid block arrays.
logical b0fieldalloccoarse
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter ndim
Number of spatial dimensions for grid variables.
logical stagger_grid
True for using stagger grid.
double precision bdip
amplitude of background dipolar, quadrupolar, octupolar, user's field
double precision, dimension(:), allocatable, parameter d
integer ndir
Number of spatial dimensions (components) for vector variables.
integer ixm
the mesh range of a physical block without ghost cells
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
integer nghostcells
Number of ghost cells surrounding a grid.
logical slab_uniform
uniform Cartesian geometry or not (stretched Cartesian)
Module with all the methods that users can customize in AMRVAC.
procedure(set_j0), pointer usr_set_j0
procedure(set_b0), pointer usr_set_b0