8 logical :: initialized_already = .false.
25 if (initialized_already)
return
43 initialized_already = .true.
55 integer :: igrid, level, ipe, ig^D
88 if ({mod(
ixghi^d,2)/=0|.or.})
then
89 call mpistop(
"mesh widths must give even number grid points")
93 if (
nbufferx^d>(ixmhi^d-ixmlo^d+1)|.or.)
then
94 write(
unitterm,*)
"nbufferx^D bigger than mesh size makes no sense."
95 write(
unitterm,*)
"Decrease nbufferx or increase mesh size"
101 {
dx(^d,level) =
dx(^d,level-1) * half\}
108 ^d&
ng^d(1)=nint((xprobmax^d-xprobmin^d)/
dg^d(1))\
113 dg^d(level)=half*
dg^d(level-1);
114 ng^d(level)=
ng^d(level-1)*2;
118 ok=({(abs(dble(
ng^d(1))*
dg^d(1)-(xprobmax^d-xprobmin^d))<=smalldouble)|.and.})
120 write(
unitterm,*)
"domain cannot be divided by meshes of given gridsize"
121 call mpistop(
"domain cannot be divided by meshes of given gridsize")
131 if(
ng^d(1)==1.and..not.
poleb(1,^d).and.&
133 write(
unitterm,
"(a,i2,a)")
"number of grid blocks at level 1 in dimension",^d,&
134 " be larger than 1 for a rectangular AMR mesh!"
135 write(
unitterm,
"(a,i1)")
"increase domain_nx",^d
178 {
do ig^db=1,
ng^db(1)\}
184 type_send_srl=>type_send_srl_f
185 type_recv_srl=>type_recv_srl_f
186 type_send_r=>type_send_r_f
187 type_recv_r=>type_recv_r_f
188 type_send_p=>type_send_p_f
189 type_recv_p=>type_recv_p_f
190 call create_bc_mpi_datatype(iwstart,nwgc)
type(fake_neighbors), dimension(:^d &,:,:), allocatable, public fine_neighbors
integer, dimension(:,:^d &,:), allocatable, public old_neighbor
type(facealloc), dimension(:,:,:), allocatable, public pface
Module to set boundary conditions from user data.
subroutine, public bc_data_init()
subroutine, public init_comm_types
Create and store the MPI types that will be used for parallel communication.
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for flux conservation near refinement boundaries.
type(fluxalloc), dimension(:,:,:), allocatable, public pflux
store flux to fix conservation
Module with basic grid data structures.
integer, dimension(:), allocatable, save nleafs_level
How many leaves are present per refinement level.
logical, dimension(:,:), allocatable, save refine
integer, dimension(:), allocatable, save morton_start
First Morton number per processor.
integer, dimension(:), allocatable, save morton_sub_start
logical, dimension(:,:), allocatable, save buffer
logical, dimension(:,:), allocatable, save igrid_inuse
integer, dimension(:), allocatable, save igrid_to_sfc
Go from a grid index to Morton number (for a single processor)
integer, dimension(:), allocatable, save morton_sub_stop
logical, dimension(:,:), allocatable, save coarsen
AMR flags and grids-in-use identifier per processor (igrid,ipe)
type(tree_node_ptr), dimension(:), allocatable, save level_tail
The tail pointer of the linked list per refinement level.
integer, dimension(:), allocatable, save morton_stop
Last Morton number per processor.
type(tree_node_ptr), dimension(:^d &), allocatable, save tree_root
Pointers to the coarse grid.
integer, dimension(:,:), allocatable, save sfc
Array to go from a Morton number to an igrid and processor index. Sfc(1:3, MN) contains [igrid,...
type(tree_node_ptr), dimension(:,:), allocatable, save igrid_to_node
Array to go from an [igrid, ipe] index to a node pointer.
type(tree_node_ptr), dimension(:), allocatable, save level_head
The head pointer of the linked list per refinement level.
Module with geometry-related routines (e.g., divergence, curl)
update ghost cells of all blocks including physical boundaries
This module contains definitions of global parameters and variables and some generic functions/subrou...
logical, dimension(ndim) aperiodb
True for dimensions with aperiodic boundaries.
integer ixghi
Upper index of grid block arrays.
double precision global_time
The global simulation time.
double precision time_init
Start time for the simulation.
integer it
Number of time steps taken.
double precision, dimension(:), allocatable dg
extent of grid blocks in domain per dimension, in array over levels
integer it_init
initial iteration count
integer, parameter nlevelshi
The maximum number of levels in the grid refinement.
logical stagger_grid
True for using stagger grid.
logical, dimension(:), allocatable phyboundblock
True if a block has any physical boundary.
logical use_particles
Use particles module or not.
integer, dimension(:), allocatable ng
number of grid blocks in domain per dimension, in array over levels
integer block_nx
number of cells for each dimension in grid block excluding ghostcells
integer, parameter nodehi
grid hierarchy info (level and grid indices)
logical slab
Cartesian geometry or not.
integer npe
The number of MPI tasks.
integer, parameter unitterm
Unit for standard output.
logical, dimension(ndim) periodb
True for dimensions with periodic boundaries.
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
integer nbufferx
Number of cells as buffer zone.
double precision, dimension(:,:), allocatable dx
double precision, dimension(:,:), allocatable rnode_sub
integer, parameter rnodehi
grid location info (corner coordinates and grid spacing)
integer refine_max_level
Maximal number of AMR levels.
integer max_blocks
The maximum number of grid blocks in a processor.
logical, dimension(2, ndim) poleb
Indicates whether there is a pole at a boundary.
integer, dimension(:,:), allocatable node
integer, dimension(:,:), allocatable node_sub
Module to set (or derive) initial conditions from user data We read in a vtk file that provides value...
subroutine, public read_data_init()
This module handles the initialization of various components of amrvac.
subroutine, public initialize_amrvac()
Initialize amrvac: read par files and initialize variables.
subroutine initialize_vars
Initialize (and allocate) simulation and grid variables.
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_check_params), pointer phys_check_params
Module with all the methods that users can customize in AMRVAC.
procedure(p_no_args), pointer usr_set_parameters
Initialize the user's settings (after initializing amrvac)