7 integer,
protected,
public ::
rho_ = 1
12 double precision,
protected,
public ::
rho_v(^nd) = 1.0d0
20 subroutine rho_params_read(files)
22 character(len=*),
intent(in) :: files(:)
28 open(
unitpar, file=trim(files(n)), status=
'old')
29 read(
unitpar, rho_list,
end=111)
33 end subroutine rho_params_read
38 integer,
intent(in) :: fh
39 integer,
parameter :: n_par = ^nd
40 double precision :: values(n_par)
41 character(len=name_len) :: names(n_par)
42 integer,
dimension(MPI_STATUS_SIZE) :: st
46 call mpi_file_write(fh, n_par, 1, mpi_integer, st, er)
49 write(names(idim),
'(a,i1)')
"v",idim
50 values(idim) =
rho_v(idim)
52 call mpi_file_write(fh, values, n_par, mpi_double_precision, st, er)
53 call mpi_file_write(fh, names, n_par * name_len, mpi_character, st, er)
68 allocate(start_indices(number_species),stop_indices(number_species))
77 stop_indices(1)=nwflux
87 call mpistop(
"phys_check error: flux_type has wrong shape")
109 integer,
intent(in) :: ixI^L, ixO^L
110 double precision,
intent(inout) :: w(ixI^S, nw)
111 double precision,
intent(in) :: x(ixI^S, 1:^ND)
118 integer,
intent(in) :: ixI^L, ixO^L
119 double precision,
intent(inout) :: w(ixI^S, nw)
120 double precision,
intent(in) :: x(ixI^S, 1:^ND)
125 subroutine rho_get_v(w, x, ixI^L, ixO^L, idim, v, centered)
128 logical,
intent(in) :: centered
129 integer,
intent(in) :: ixi^
l, ixo^
l, idim
130 double precision,
intent(in) :: w(ixi^s, nw), x(ixi^s, 1:^nd)
131 double precision,
intent(out) :: v(ixi^s)
133 double precision :: dtheta, dphi, halfdtheta, halfdphi, invdtheta, invdphi
135 double precision :: appcosphi(ixi^s), appsinphi(ixi^s), &
136 appcosthe(ixi^s), appsinthe(ixi^s)
142 call mpistop(
"advection in 1D cylindrical not available")
149 v(ixo^s) =
rho_v(1)*dcos(x(ixo^s,2))+
rho_v(2)*dsin(x(ixo^s,2))
151 v(ixo^s) =-
rho_v(1)*dsin(x(ixo^s,2))+
rho_v(2)*dcos(x(ixo^s,2))
155 dtheta=x(ixomin1,ixomin2+1,2)-x(ixomin1,ixomin2,2)
156 halfdtheta=0.5d0*dtheta
157 invdtheta=1.0d0/dtheta
160 v(ixo^s) =(
rho_v(1)*( dsin(x(ixo^s,2)+halfdtheta) &
161 -dsin(x(ixo^s,2)-halfdtheta)) &
162 +
rho_v(2)*(-dcos(x(ixo^s,2)+halfdtheta) &
163 +dcos(x(ixo^s,2)-halfdtheta)))*invdtheta
165 v(ixo^s) =-
rho_v(1)*dsin(x(ixo^s,2)+halfdtheta) &
166 +
rho_v(2)*dcos(x(ixo^s,2)+halfdtheta)
175 v(ixo^s) =
rho_v(1)*dcos(x(ixo^s,3))+
rho_v(2)*dsin(x(ixo^s,3))
179 v(ixo^s) =-
rho_v(1)*dsin(x(ixo^s,3))+
rho_v(2)*dcos(x(ixo^s,3))
183 dtheta=x(ixomin1,ixomin2,ixomin3+1,3)-x(ixomin1,ixomin2,ixomin3,3)
184 halfdtheta=0.5d0*dtheta
185 invdtheta=1.0d0/dtheta
188 v(ixo^s) =(
rho_v(1)*( dsin(x(ixo^s,3)+halfdtheta) &
189 -dsin(x(ixo^s,3)-halfdtheta)) &
190 +
rho_v(2)*(-dcos(x(ixo^s,3)+halfdtheta) &
191 +dcos(x(ixo^s,3)-halfdtheta)))*invdtheta
195 v(ixo^s) =-
rho_v(1)*dsin(x(ixo^s,3)+halfdtheta) &
196 +
rho_v(2)*dcos(x(ixo^s,3)+halfdtheta)
202 call mpistop(
"advection in 1D spherical not available")
205 call mpistop(
"advection in 2D spherical not available")
212 v(ixo^s) =
rho_v(1)*dsin(x(ixo^s,2))*dcos(x(ixo^s,3)) &
213 +
rho_v(2)*dsin(x(ixo^s,2))*dsin(x(ixo^s,3)) &
214 +
rho_v(3)*dcos(x(ixo^s,2))
216 v(ixo^s) =
rho_v(1)*dcos(x(ixo^s,2))*dcos(x(ixo^s,3)) &
217 +
rho_v(2)*dcos(x(ixo^s,2))*dsin(x(ixo^s,3)) &
218 -
rho_v(3)*dsin(x(ixo^s,2))
220 v(ixo^s) =-
rho_v(1)*dsin(x(ixo^s,3)) &
221 +
rho_v(2)*dcos(x(ixo^s,3))
225 dtheta=x(ixomin1,ixomin2+1,ixomin3,2)-x(ixomin1,ixomin2,ixomin3,2)
226 dphi=x(ixomin1,ixomin2,ixomin3+1,3)-x(ixomin1,ixomin2,ixomin3,3)
227 halfdtheta=0.5d0*dtheta
229 invdtheta=1.0d0/dtheta
233 appcosphi(ixo^s)=( dsin(x(ixo^s,3)+halfdphi) &
234 -dsin(x(ixo^s,3)-halfdphi))*invdphi
235 appsinphi(ixo^s)=(-dcos(x(ixo^s,3)+halfdphi) &
236 +dcos(x(ixo^s,3)-halfdphi))*invdphi
237 appcosthe(ixo^s)=(dsin(x(ixo^s,2)+halfdtheta)**2 &
238 -dsin(x(ixo^s,2)-halfdtheta)**2) &
239 /(4.0d0*dabs(dsin(x(ixo^s,2)))*dsin(halfdtheta))
241 (-dsin(x(ixo^s,2)+halfdtheta)*dcos(x(ixo^s,2)+halfdtheta) &
242 +dsin(x(ixo^s,2)-halfdtheta)*dcos(x(ixo^s,2)-halfdtheta) &
243 +dtheta)/(4.0d0*dabs(dsin(x(ixo^s,2)))*dsin(halfdtheta))
244 v(ixo^s) =
rho_v(1)*appsinthe(ixo^s)*appcosphi(ixo^s) &
245 +
rho_v(2)*appsinthe(ixo^s)*appsinphi(ixo^s) &
246 +
rho_v(3)*appcosthe(ixo^s)
248 appcosphi(ixo^s)=( dsin(x(ixo^s,3)+halfdphi) &
249 -dsin(x(ixo^s,3)-halfdphi))*invdphi
250 appsinphi(ixo^s)=(-dcos(x(ixo^s,3)+halfdphi) &
251 +dcos(x(ixo^s,3)-halfdphi))*invdphi
252 v(ixo^s) =
rho_v(1)*dcos(x(ixo^s,2)+halfdtheta)*appcosphi(ixo^s) &
253 +
rho_v(2)*dcos(x(ixo^s,2)+halfdtheta)*appsinphi(ixo^s) &
254 -
rho_v(3)*dsin(x(ixo^s,2)+halfdtheta)
256 v(ixo^s) =-
rho_v(1)*dsin(x(ixo^s,3)+halfdphi) &
257 +
rho_v(2)*dcos(x(ixo^s,3)+halfdphi)
262 v(ixo^s) =
rho_v(idim)
270 integer,
intent(in) :: ixI^L, ixO^L, idim
271 double precision,
intent(in) :: w(ixI^S,nw), x(ixI^S,1:ndim)
272 double precision,
intent(out) :: v(ixI^S)
274 v(ixo^s) =
rho_v(idim)
280 integer,
intent(in) :: ixI^L, ixO^L, idim
281 double precision,
intent(in) :: w(ixI^S, nw), x(ixI^S, 1:^ND)
282 double precision,
intent(inout) :: cmax(ixI^S)
284 call rho_get_v(w, x, ixi^l, ixo^l, idim, cmax, .true.)
286 cmax(ixo^s) = abs(cmax(ixo^s))
290 subroutine rho_get_cbounds(wLC, wRC, wLp, wRp, x, ixI^L, ixO^L, idim,Hspeed, cmax, cmin)
293 integer,
intent(in) :: ixI^L, ixO^L, idim
294 double precision,
intent(in) :: wLC(ixI^S, nw), wRC(ixI^S,nw)
295 double precision,
intent(in) :: wLp(ixI^S, nw), wRp(ixI^S,nw)
296 double precision,
intent(in) :: x(ixI^S, 1:^ND)
297 double precision,
intent(inout) :: cmax(ixI^S,1:number_species)
298 double precision,
intent(inout),
optional :: cmin(ixI^S,1:number_species)
299 double precision,
intent(in) :: Hspeed(ixI^S,1:number_species)
303 call rho_get_v(wlc, x, ixi^l, ixo^l, idim, cmax(ixi^s,1), .false.)
305 if (
present(cmin))
then
306 cmin(ixo^s,1) = min(cmax(ixo^s,1), zero)
307 cmax(ixo^s,1) = max(cmax(ixo^s,1), zero)
309 cmax(ixo^s,1) = maxval(abs(cmax(ixo^s,1)))
316 integer,
intent(in) :: ixI^L, ixO^L
317 double precision,
intent(in) :: dx^D, x(ixI^S, 1:^ND)
318 double precision,
intent(in) :: w(ixI^S, 1:nw)
319 double precision,
intent(inout) :: dtnew
327 integer,
intent(in) :: ixI^L, ixO^L, idim
328 double precision,
intent(in) :: wC(ixI^S, 1:nw)
329 double precision,
intent(in) :: w(ixI^S, 1:nw)
330 double precision,
intent(in) :: x(ixI^S, 1:^ND)
331 double precision,
intent(out) :: f(ixI^S, nwflux)
332 double precision :: v(ixI^S)
334 call rho_get_v(wc, x, ixi^l, ixo^l, idim, v, .false.)
336 f(ixo^s,
rho_) = w(ixo^s,
rho_) * v(ixo^s)
346 integer,
intent(in) :: ixI^L, ixO^L
347 double precision,
intent(in) :: qdt, dtfactor, x(ixI^S, 1:^ND)
348 double precision,
intent(inout) :: wCT(ixI^S, 1:nw),wprim(ixI^S,1:nw), w(ixI^S, 1:nw)
Module with geometry-related routines (e.g., divergence, curl)
integer, parameter spherical
integer, parameter cylindrical
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 ndir
Number of spatial dimensions (components) for vector variables.
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
logical phys_req_diagonal
Whether the physics routines require diagonal ghost cells, for example for computing a curl.
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
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_get_cmax), pointer phys_get_cmax
logical phys_energy
Solve energy equation or not.
Module containing the physics routines for scalar advection.
subroutine, public rho_get_v(w, x, ixIL, ixOL, idim, v, centered)
subroutine rho_to_conserved(ixIL, ixOL, w, x)
subroutine rho_add_source_geom(qdt, dtfactor, ixIL, ixOL, wCT, wprim, w, x)
subroutine rho_get_dt(w, ixIL, ixOL, dtnew, dxD, x)
subroutine rho_to_primitive(ixIL, ixOL, w, x)
double precision, dimension(^nd), public, protected rho_v
subroutine rho_get_v_idim(w, x, ixIL, ixOL, idim, v)
Calculate simple v component.
subroutine rho_write_info(fh)
Write this module's parameters to a snapsoht.
subroutine rho_get_flux(wC, w, x, ixIL, ixOL, idim, f)
subroutine, public rho_phys_init()
subroutine rho_get_cbounds(wLC, wRC, wLp, wRp, x, ixIL, ixOL, idim, Hspeed, cmax, cmin)
subroutine rho_get_cmax(w, x, ixIL, ixOL, idim, cmax)
logical, public, protected rho_particles
Whether particles module is added.
integer, public, protected rho_