MPI-AMRVAC 3.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Loading...
Searching...
No Matches
mod_amr_grid.t
Go to the documentation of this file.
2
3 implicit none
4 private
5
6 public :: settree
7 public :: resettree
8 public :: resettree_convert
9
10contains
11
12 !> Build up AMR
13 subroutine settree
17 use mod_errest, only: errest
18
19 ! create and initialize grids on all levels > 1. On entry, all
20 ! level=1 grids have been formed and initialized. This subroutine
21 ! creates and initializes new level grids
22
23 integer :: igrid, iigrid, levnew
24
25 ! when only one level allowed, there is nothing to do anymore
26 if (refine_max_level == 1) return
27
28 do levnew=2,refine_max_level
29
30 call errest
31
33
34 if (.not.reset_grid) then
35 ! if no finer level grids created: exit
36 if (levmax/=levnew) exit
37 end if
38 end do
39
40 ! set up boundary flux conservation arrays
42
43 end subroutine settree
44
45 !> reset AMR and (de)allocate boundary flux storage at level changes
46 subroutine resettree
49 use mod_amr_fct
51 use mod_errest, only: errest
54
57
58 ! deallocate old grids for particles
59 if(use_particles) then
60 call finish_gridvars()
61 end if
62
63 call errest
64
66
67 ! set up boundary flux conservation arrays
69
70 ! generate new grids for particles
71 if(use_particles) then
72 call init_gridvars()
73 end if
74
75 ! after getbc in amr_coarsen_refine, eos variables of ghost cells are zero for new blocks
76 ! update the additional w state eos variables including ghost cells
78
79 end subroutine resettree
80
81 !> Force the tree to desired level(s) from level_io(_min/_max)
82 !> used for conversion to vtk output
88
89 integer :: igrid,iigrid, my_levmin, my_levmax
90
91 if(level_io > 0) then
92 my_levmin = level_io
93 my_levmax = level_io
94 else
95 my_levmin = max(1,level_io_min)
96 my_levmax = min(refine_max_level,level_io_max)
97 end if
98
99 do while(levmin<my_levmin.or.levmax>my_levmax)
100 call getbc(global_time,0.d0,ps,iwstart,nwgc)
101 do iigrid=1,igridstail; igrid=igrids(iigrid);
102 call forcedrefine_grid_io(igrid,ps(igrid)%w)
103 end do
104
106 end do
107
108 end subroutine resettree_convert
109
110end module mod_amr_grid
subroutine, public deallocatebfaces
subroutine, public resettree
reset AMR and (de)allocate boundary flux storage at level changes
subroutine, public resettree_convert
Force the tree to desired level(s) from level_io(_min/_max) used for conversion to vtk output.
subroutine, public settree
Build up AMR.
Module to coarsen and refine grids for AMR.
subroutine, public amr_coarsen_refine
coarsen and refine blocks to update AMR grid
Equation of state for AMRVAC, handled through a single eos_container object.
Definition mod_eos.t:30
subroutine, public prepare_eos_w_fields()
Definition mod_eos.t:283
subroutine, public errest
Do all local error estimation which determines (de)refinement.
Definition mod_errest.t:12
subroutine, public forcedrefine_grid_io(igrid, w)
Definition mod_errest.t:370
Module for flux conservation near refinement boundaries.
subroutine, public deallocatebflux
subroutine, public allocatebflux
update ghost cells of all blocks including physical boundaries
subroutine getbc(time, qdt, psb, nwstart, nwbc)
do update ghost cells of all blocks including physical boundaries
This module contains definitions of global parameters and variables and some generic functions/subrou...
double precision global_time
The global simulation time.
logical stagger_grid
True for using stagger grid.
logical use_particles
Use particles module or not.
logical reset_grid
If true, rebuild the AMR grid upon restarting.
integer refine_max_level
Maximal number of AMR levels.
Module containing all the particle routines.