9 integer,
protected,
public ::
rho_ = 1
28 subroutine nonlinear_params_read(files)
30 character(len=*),
intent(in) :: files(:)
36 open(
unitpar, file=trim(files(n)), status=
'old')
37 read(
unitpar, nonlinear_list,
end=111)
41 end subroutine nonlinear_params_read
44 subroutine nonlinear_write_info(fh)
52 integer,
intent(in) :: fh
53 integer,
dimension(MPI_STATUS_SIZE) :: st
57 call mpi_file_write(fh, 0, 1, mpi_integer, st, er)
59 end subroutine nonlinear_write_info
72 allocate(start_indices(number_species),stop_indices(number_species))
81 stop_indices(1)=nwflux
88 call mpistop(
"phys_check error: flux_type has wrong shape")
107 subroutine nonlinear_check_params
111 use mod_particles,
only: npayload,nusrpayload,ngridvars,num_particles,physics_type_particles
119 write(*,*)
'====NONLINEAR run with settings===================='
120 write(*,*)
'Using mod_nonlinear_phys with settings:'
121 write(*,*)
'Dimensionality :',
ndim
122 write(*,*)
'vector components:',
ndir
124 write(*,*)
'number of variables nw=',nw
125 write(*,*)
' start index iwstart=',iwstart
126 write(*,*)
'number of vector variables=',nvector
127 write(*,*)
'number of stagger variables nws=',nws
128 write(*,*)
'number of variables with BCs=',nwgc
129 write(*,*)
'number of vars with fluxes=',nwflux
130 write(*,*)
'number of vars with flux + BC=',nwfluxbc
131 write(*,*)
'number of auxiliary variables=',nwaux
132 write(*,*)
'number of extra vars without flux=',nwextra
133 write(*,*)
'number of extra vars for wextra=',nw_extra
134 write(*,*)
'number of auxiliary I/O variables=',
nwauxio
137 write(*,*)
'*****Using particles: npayload,ngridvars :', npayload,ngridvars
138 write(*,*)
'*****Using particles: nusrpayload :', nusrpayload
139 write(*,*)
'*****Using particles: num_particles :', num_particles
140 write(*,*)
'*****Using particles: physics_type_particles=',physics_type_particles
143 write(*,*)
'==========================================='
146 end subroutine nonlinear_check_params
148 subroutine nonlinear_to_conserved(ixI^L, ixO^L, w, x)
150 integer,
intent(in) :: ixi^
l, ixo^
l
151 double precision,
intent(inout) :: w(ixi^s, nw)
152 double precision,
intent(in) :: x(ixi^s, 1:^nd)
155 end subroutine nonlinear_to_conserved
157 subroutine nonlinear_to_primitive(ixI^L, ixO^L, w, x)
159 integer,
intent(in) :: ixi^
l, ixo^
l
160 double precision,
intent(inout) :: w(ixi^s, nw)
161 double precision,
intent(in) :: x(ixi^s, 1:^nd)
164 end subroutine nonlinear_to_primitive
168 integer,
intent(in) :: ixi^
l, ixo^
l, idim
169 double precision,
intent(in) :: w(ixi^s, nw), x(ixi^s, 1:^nd)
170 double precision,
intent(out) :: v(ixi^s)
174 v(ixo^s)=w(ixo^s,
rho_)
176 v(ixo^s)=3.0d0*w(ixo^s,
rho_)**2
178 call mpistop(
'Undefined fluxtype: set nonlinear_flux_type to 1 or 2')
183 subroutine nonlinear_get_cmax(w, x, ixI^L, ixO^L, idim, cmax)
185 integer,
intent(in) :: ixi^
l, ixo^
l, idim
186 double precision,
intent(in) :: w(ixi^s, nw), x(ixi^s, 1:^nd)
187 double precision,
intent(inout) :: cmax(ixi^s)
191 cmax(ixo^s) = abs(cmax(ixo^s))
193 end subroutine nonlinear_get_cmax
195 subroutine nonlinear_get_cbounds(wLC, wRC, wLp, wRp, x, ixI^L, ixO^L, idim,Hspeed, cmax, cmin)
198 integer,
intent(in) :: ixi^
l, ixo^
l, idim
199 double precision,
intent(in) :: wlc(ixi^s,
nw), wrc(ixi^s,
nw)
200 double precision,
intent(in) :: wlp(ixi^s,
nw), wrp(ixi^s,
nw)
201 double precision,
intent(in) :: x(ixi^s, 1:^nd)
203 double precision,
intent(inout),
optional :: cmin(ixi^s,1:
number_species)
205 double precision :: wmean(ixi^s,
nw)
212 if (
present(cmin))
then
213 cmin(ixo^s,1) = min(cmax(ixo^s,1), zero)
214 cmax(ixo^s,1) = max(cmax(ixo^s,1), zero)
216 cmax(ixo^s,1) = maxval(abs(cmax(ixo^s,1)))
219 end subroutine nonlinear_get_cbounds
221 subroutine nonlinear_get_dt(w, ixI^L, ixO^L, dtnew, dx^D, x)
225 integer,
intent(in) :: ixi^
l, ixo^
l
226 double precision,
intent(in) ::
dx^
d, x(ixi^s, 1:^nd)
227 double precision,
intent(in) :: w(ixi^s, 1:nw)
228 double precision,
intent(inout) :: dtnew
235 end subroutine nonlinear_get_dt
238 subroutine nonlinear_get_flux(wC, w, x, ixI^L, ixO^L, idim, f)
240 integer,
intent(in) :: ixi^
l, ixo^
l, idim
241 double precision,
intent(in) :: wc(ixi^s, 1:nw)
242 double precision,
intent(in) :: w(ixi^s, 1:nw)
243 double precision,
intent(in) :: x(ixi^s, 1:^nd)
244 double precision,
intent(out) :: f(ixi^s, nwflux)
252 call mpistop(
'Undefined fluxtype: set nonlinear_flux_type to 1 or 2')
255 end subroutine nonlinear_get_flux
257 subroutine nonlinear_add_source_geom(qdt, dtfactor, ixI^L, ixO^L, wCT,wprim, w, x)
264 integer,
intent(in) :: ixi^
l, ixo^
l
265 double precision,
intent(in) :: qdt, dtfactor, x(ixi^s, 1:^nd)
266 double precision,
intent(inout) :: wct(ixi^s, 1:nw), wprim(ixi^s,1:nw),w(ixi^s, 1:nw)
268 end subroutine nonlinear_add_source_geom
270 subroutine nonlinear_add_source(qdt, dtfactor, ixI^L,ixO^L,wCT,wCTprim,w,x,qsourcesplit,active)
274 integer,
intent(in) :: ixi^
l, ixo^
l
275 double precision,
intent(in) :: qdt,dtfactor
276 double precision,
intent(in) :: wct(ixi^s, 1:nw),wctprim(ixi^s,1:nw), x(ixi^s, 1:
ndim)
277 double precision,
intent(inout) :: w(ixi^s, 1:nw)
278 logical,
intent(in) :: qsourcesplit
279 logical,
intent(inout) :: active
285 end subroutine nonlinear_add_source
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module with geometry-related routines (e.g., divergence, curl)
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, parameter unitpar
file handle for IO
integer, parameter ndim
Number of spatial dimensions for grid variables.
logical use_particles
Use particles module or not.
character(len=std_len), dimension(:), allocatable par_files
Which par files are used as input.
integer mype
The rank of the current MPI task.
integer ndir
Number of spatial dimensions (components) for vector variables.
double precision, dimension(:), allocatable, parameter d
logical slab
Cartesian geometry or not.
integer nwauxio
Number of auxiliary variables that are only included in output.
double precision, dimension(:,:), allocatable dx
spatial steps for all dimensions at all levels
integer nghostcells
Number of ghost cells surrounding a grid.
Module for including kdv source term in simulations adds over dimensions i.
subroutine kdv_add_source(qdt, ixil, ixol, wct, w, x, qsourcesplit, active)
w[iw]=w[iw]+qdt*S[wCT,qtC,x] where S is the source based on wCT within ixO
subroutine kdv_init()
Initialize the module.
subroutine kdv_get_dt(w, ixil, ixol, dtnew, dxd, x)
Module containing the physics routines for scalar nonlinear equation.
logical, public, protected nonlinear_particles
Whether particles module is added.
integer, public, protected nonlinear_flux_type
switch between burgers (i.e. rho**2) or nonconvex flux (i.e. rho**3)
logical, public, protected kdv_source_term
whether the KdV source term is added
integer, public, protected rho_
index of the single scalar unknown
subroutine, public nonlinear_phys_init()
subroutine, public nonlinear_get_v(w, x, ixil, ixol, idim, v)
Module containing all the particle routines.
subroutine particles_init()
Initialize particle data and parameters.
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_convert), pointer phys_to_primitive
procedure(sub_write_info), pointer phys_write_info
procedure(sub_get_flux), pointer phys_get_flux
procedure(sub_get_cbounds), pointer phys_get_cbounds
procedure(sub_get_dt), pointer phys_get_dt
procedure(sub_add_source_geom), pointer phys_add_source_geom
procedure(sub_check_params), pointer phys_check_params
integer, parameter flux_default
Indicates a normal flux.
integer, dimension(:, :), allocatable flux_type
Array per direction per variable, which can be used to specify that certain fluxes have to be treated...
procedure(sub_convert), pointer phys_to_conserved
character(len=name_len) physics_type
String describing the physics type of the simulation.
procedure(sub_add_source), pointer phys_add_source
procedure(sub_get_cmax), pointer phys_get_cmax
logical phys_energy
Solve energy equation or not.
integer nw
Total number of variables.
integer number_species
number of species: each species has different characterictic speeds and should be used accordingly in...
integer nwflux
Number of flux variables.