12 character(len=*),
intent(in) :: files(:)
18 open(
unitpar, file=trim(files(n)), status=
"old")
19 read(
unitpar, grav_list,
end=111)
33 write(*,*)
"mod_usr.t: please define usr_gravity before (m)hd activate"
34 write(*,*)
"like the phys_gravity in mod_usr_methods.t"
35 call mpistop(
"usr_gravity not defined or pointed")
44 energy,rhov,qsourcesplit,active)
48 integer,
intent(in) :: ixI^L, ixO^L
49 double precision,
intent(in) :: qdt, x(ixI^S,1:ndim)
50 double precision,
intent(in) :: wCT(ixI^S,1:nw),wCTprim(ixI^S,1:nw)
51 double precision,
intent(inout) :: w(ixI^S,1:nw)
52 logical,
intent(in) :: energy,rhov,qsourcesplit
53 logical,
intent(inout) :: active
56 double precision :: gravity_field(ixI^S,ndim)
64 w(ixo^s,iw_mom(idim)) = w(ixo^s,iw_mom(idim)) &
65 + qdt * gravity_field(ixo^s,idim) * wct(ixo^s,iw_rho)
68 w(ixo^s,iw_e)=w(ixo^s,iw_e) &
69 +qdt*gravity_field(ixo^s,idim)*wctprim(ixo^s,iw_mom(idim))*wctprim(ixo^s,iw_rho)
71 w(ixo^s,iw_e)=w(ixo^s,iw_e) &
72 + qdt * gravity_field(ixo^s,idim) * wct(ixo^s,iw_mom(idim))
84 integer,
intent(in) :: ixI^L, ixO^L
85 double precision,
intent(in) :: dx^D, x(ixI^S,1:ndim), w(ixI^S,1:nw)
86 double precision,
intent(inout) :: dtnew
88 double precision :: dxinv(1:ndim), max_grav
91 double precision :: gravity_field(ixI^S,ndim)
93 ^d&dxinv(^d)=one/dx^d;
98 max_grav = maxval(abs(gravity_field(ixo^s,idim)))
99 max_grav = max(max_grav, epsilon(1.0d0))
100 dtnew = min(dtnew, 1.0d0 / sqrt(max_grav * dxinv(idim)))
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, parameter unitpar
file handle for IO
logical any_source_split
if any normal source term is added in split fasion
character(len=std_len), dimension(:), allocatable par_files
Which par files are used as input.
Module for including gravity in (magneto)hydrodynamics simulations.
logical grav_split
source split or not
subroutine gravity_get_dt(w, ixIL, ixOL, dtnew, dxD, x)
subroutine gravity_add_source(qdt, ixIL, ixOL, wCT, wCTprim, w, x, energy, rhov, qsourcesplit, active)
w[iw]=w[iw]+qdt*S[wCT,qtC,x] where S is the source based on wCT within ixO
subroutine grav_params_read(files)
Read this module's parameters from a file.
subroutine gravity_init()
Initialize the module.
Module with all the methods that users can customize in AMRVAC.
procedure(phys_gravity), pointer usr_gravity