16 integer,
public,
protected ::
rho_
17 integer,
public,
protected ::
d_
20 integer,
allocatable,
public,
protected ::
mom(:)
23 integer,
allocatable,
public,
protected ::
tracer(:)
26 integer,
public,
protected ::
e_
28 integer,
public,
protected ::
p_
31 integer,
public,
protected ::
lfac_
34 integer,
public,
protected ::
xi_
52 double precision,
public ::
tolernr = 1.0d-9
53 double precision,
public ::
dmaxvel = 1.0d-7
72 subroutine srhd_read_params(files)
74 character(len=*),
intent(in) :: files(:)
82 open(
unitpar, file=trim(files(n)), status=
"old")
83 read(
unitpar, srhd_list,
end=111)
87 end subroutine srhd_read_params
90 subroutine srhd_write_info(fh)
92 integer,
intent(in) :: fh
93 integer,
parameter :: n_par = 1
94 double precision :: values(n_par)
95 character(len=name_len) :: names(n_par)
96 integer,
dimension(MPI_STATUS_SIZE) :: st
99 call mpi_file_write(fh, n_par, 1, mpi_integer, st, er)
103 call mpi_file_write(fh, values, n_par, mpi_double_precision, st, er)
104 call mpi_file_write(fh, names, n_par * name_len, mpi_character, st, er)
106 end subroutine srhd_write_info
115 physics_type =
"srhd"
117 phys_total_energy = .true.
121 phys_internal_e = .false.
127 allocate(start_indices(number_species),stop_indices(number_species))
136 mom(:) = var_set_momentum(
ndir)
139 e_ = var_set_energy()
143 call srhd_physical_units()
149 tracer(itr) = var_set_fluxvar(
"trc",
"trp", itr, need_bc=.false.)
154 xi_ = var_set_auxvar(
'xi',
'xi')
155 lfac_= var_set_auxvar(
'lfac',
'lfac')
161 stop_indices(1)=nwflux
164 if (.not.
allocated(flux_type))
then
165 allocate(flux_type(
ndir, nw))
166 flux_type = flux_default
167 else if (any(shape(flux_type) /= [
ndir, nw]))
then
168 call mpistop(
"phys_check error: flux_type has wrong shape")
172 allocate(iw_vector(nvector))
173 iw_vector(1) =
mom(1) - 1
176 phys_add_source => srhd_add_source
177 phys_get_dt => srhd_get_dt
182 phys_get_cmax => srhd_get_cmax
183 phys_get_cbounds => srhd_get_cbounds
184 phys_get_flux => srhd_get_flux
185 phys_add_source_geom => srhd_add_source_geom
192 phys_get_v => srhd_get_v
193 phys_write_info => srhd_write_info
194 phys_handle_small_values => srhd_handle_small_values
203 use mod_particles,
only: npayload,nusrpayload,ngridvars,num_particles,physics_type_particles
211 call mpistop (
"Error: srhd_gamma <= 0 or srhd_gamma == 1")
219 call srhd_get_smallvalues_eos
222 write(*,*)
'------------------------------------------------------------'
223 write(*,*)
'Using EOS set via srhd_eos=',
srhd_eos
224 write(*,*)
'Maximal lorentz factor (via dmaxvel) is=',
lfacmax
228 write(*,*)
'------------------------------------------------------------'
232 write(*,*)
'====SRHD run with settings===================='
233 write(*,*)
'Using mod_srhd_phys with settings:'
235 write(*,*)
'Dimensionality :',
ndim
236 write(*,*)
'vector components:',
ndir
238 write(*,*)
'number of variables nw=',nw
239 write(*,*)
' start index iwstart=',iwstart
240 write(*,*)
'number of vector variables=',nvector
241 write(*,*)
'number of stagger variables nws=',nws
242 write(*,*)
'number of variables with BCs=',nwgc
243 write(*,*)
'number of vars with fluxes=',nwflux
244 write(*,*)
'number of vars with flux + BC=',nwfluxbc
245 write(*,*)
'number of auxiliary variables=',nwaux
246 write(*,*)
'number of extra vars without flux=',nwextra
247 write(*,*)
'number of extra vars for wextra=',nw_extra
248 write(*,*)
'number of auxiliary I/O variables=',
nwauxio
252 write(*,*)
'*****Using particles: npayload,ngridvars :', npayload,ngridvars
253 write(*,*)
'*****Using particles: nusrpayload :', nusrpayload
254 write(*,*)
'*****Using particles: num_particles :', num_particles
255 write(*,*)
'*****Using particles: physics_type_particles=',physics_type_particles
258 write(*,*)
'number due to phys_wider_stencil=',phys_wider_stencil
259 write(*,*)
'==========================================='
265 subroutine srhd_physical_units
267 double precision :: mp,kb
280 call mpistop(
"Abort: must set positive values for unit length and numberdensity")
290 end subroutine srhd_physical_units
295 logical,
intent(in) :: primitive
296 integer,
intent(in) :: ixi^
l, ixo^
l
297 double precision,
intent(in) :: w(ixi^s, nw)
298 logical,
intent(inout) :: flag(ixi^s,1:nw)
308 where(w(ixo^s,
e_) <
small_e) flag(ixo^s,
e_) = .true.
314 subroutine srhd_check_w_aux(ixI^L, ixO^L, w, flag)
316 integer,
intent(in) :: ixi^
l, ixo^
l
317 double precision,
intent(in) :: w(ixi^s, nw)
318 logical,
intent(inout) :: flag(ixi^s,1:nw)
323 where(w(ixo^s,
lfac_) < one) flag(ixo^s,
lfac_) = .true.
325 if(any(flag(ixo^s,
xi_)))
then
326 write(*,*)
'auxiliary xi too low: abort'
327 call mpistop(
'auxiliary check failed')
329 if(any(flag(ixo^s,
lfac_)))
then
330 write(*,*)
'auxiliary lfac too low: abort'
331 call mpistop(
'auxiliary check failed')
334 end subroutine srhd_check_w_aux
340 integer,
intent(in) :: ixi^
l, ixo^
l
341 double precision,
intent(inout) :: w(ixi^s, nw)
342 double precision,
dimension(ixO^S) :: rho,rhoh,pth
345 rho(ixo^s) = sum(w(ixo^s,
mom(:))**2, dim=
ndim+1)
346 w(ixo^s,
lfac_) = dsqrt(1.0d0+rho(ixo^s))
348 rho(ixo^s)=w(ixo^s,
rho_)
349 pth(ixo^s)=w(ixo^s,
p_)
354 w(ixo^s,
xi_) = w(ixo^s,
lfac_)**2.0d0*rhoh(ixo^s)
364 integer,
intent(in) :: ixi^
l,ixo^
l
365 double precision,
intent(inout) :: w(ixi^s, nw)
366 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
368 integer :: ix^
d,ierror,idir
369 integer :: flag_error(ixo^s)
370 double precision :: ssqr
373 {
do ix^db=ixomin^db,ixomax^db\}
377 ssqr= ssqr+w(ix^
d,
mom(idir))**2
380 print *,
'entering con2prim with', w(ix^
d,
lfac_),w(ix^
d,
xi_), &
381 w(ix^
d,
d_),ssqr,w(ix^
d,
e_)
382 print *,
'in position',ix^
d,x(ix^
d,1:
ndim)
388 print *,
'entering con2prim with', w(ix^
d,
lfac_),w(ix^
d,
xi_), &
389 w(ix^
d,
d_),ssqr,w(ix^
d,
e_)
390 print *,
'in position',ix^
d,x(ix^
d,1:
ndim)
395 call con2prim_eos(w(ix^
d,
lfac_),w(ix^
d,
xi_), &
396 w(ix^
d,
d_),ssqr,w(ix^
d,
e_),ierror)
397 flag_error(ix^
d) = ierror
400 {
do ix^db=ixomin^db,ixomax^db\}
404 ssqr= ssqr+w(ix^
d,
mom(idir))**2
407 print *,
'entering con2prim with', w(ix^
d,
lfac_),w(ix^
d,
xi_), &
408 w(ix^
d,
d_),ssqr,w(ix^
d,
e_)
409 print *,
'in position',ix^
d,x(ix^
d,1:
ndim)
415 print *,
'entering con2prim with', w(ix^
d,
lfac_),w(ix^
d,
xi_), &
416 w(ix^
d,
d_),ssqr,w(ix^
d,
e_)
417 print *,
'in position',ix^
d,x(ix^
d,1:
ndim)
423 w(ix^
d,
d_),ssqr,w(ix^
d,
e_),ierror)
424 flag_error(ix^
d) = ierror
429 if(any(flag_error(ixo^s)/=0))
then
430 print *,flag_error(ixo^s)
431 call mpistop(
'Problem when getting auxiliaries')
441 integer,
intent(in) :: ixi^
l, ixo^
l
442 double precision,
intent(inout) :: w(ixi^s, nw)
443 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
445 double precision,
dimension(ixO^S) :: rhoh,rho,pth
449 rhoh(ixo^s) = sum(w(ixo^s,
mom(:))**2, dim=
ndim+1)
450 w(ixo^s,
lfac_) = dsqrt(1.0d0+rhoh(ixo^s))
452 rho(ixo^s)=w(ixo^s,
rho_)
453 pth(ixo^s)=w(ixo^s,
p_)
458 rhoh(ixo^s)= rhoh(ixo^s)*w(ixo^s,
lfac_)
460 w(ixo^s,
xi_) = w(ixo^s,
lfac_)*rhoh(ixo^s)
463 w(ixo^s,
d_)=w(ixo^s,
lfac_)*rho(ixo^s)
467 w(ixo^s,
mom(idir)) = rhoh(ixo^s)*w(ixo^s,
mom(idir))
471 w(ixo^s,
e_) = w(ixo^s,
xi_)-pth(ixo^s)-w(ixo^s,
d_)
482 integer,
intent(in) :: ixi^
l, ixo^
l
483 double precision,
intent(inout) :: w(ixi^s, nw)
484 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
486 double precision,
dimension(ixO^S) :: rho,rhoh,e
487 double precision,
dimension(ixI^S) :: pth
488 character(len=30) :: subname_loc
494 rho(ixo^s) = w(ixo^s,
d_)/w(ixo^s,
lfac_)
498 rhoh(ixo^s) = w(ixo^s,
xi_)/w(ixo^s,
lfac_)**2.0d0
499 call srhd_get_pressure_eos(ixi^
l,ixo^
l,rho,rhoh,pth,e)
501 w(ixo^s,
rho_)=rho(ixo^s)
504 w(ixo^s,
mom(idir)) = w(ixo^s,
lfac_)*w(ixo^s,
mom(idir))&
507 w(ixo^s,
p_)=pth(ixo^s)
511 /(rho(ixo^s)*w(ixo^s,
lfac_))
517 subroutine srhd_get_v(w,x,ixI^L,ixO^L,v)
519 integer,
intent(in) :: ixi^
l, ixo^
l
520 double precision,
intent(in) :: w(ixi^s, nw), x(ixi^s,1:
ndim)
521 double precision,
intent(out) :: v(ixi^s,1:
ndir)
526 v(ixo^s,idir) = w(ixo^s,
mom(idir))/w(ixo^s,
xi_)
529 end subroutine srhd_get_v
534 subroutine srhd_get_csound2_rhoh(w,x,ixI^L,ixO^L,rhoh,csound2)
536 integer,
intent(in) :: ixi^
l, ixo^
l
537 double precision,
intent(in) :: w(ixi^s,nw),rhoh(ixo^s)
538 double precision,
intent(in) :: x(ixi^s,1:
ndim)
539 double precision,
intent(out) :: csound2(ixo^s)
541 double precision :: rho(ixo^s)
544 call srhd_get_csound2_eos(ixi^
l,ixo^
l,rho,rhoh,csound2)
546 end subroutine srhd_get_csound2_rhoh
553 integer,
intent(in) :: ixi^
l, ixo^
l
554 double precision,
intent(inout) :: w(ixi^s,nw)
555 double precision,
intent(in) :: x(ixi^s,1:
ndim)
556 double precision,
intent(out) :: csound2(ixo^s)
558 double precision :: rho(ixo^s),rhoh(ixo^s)
563 rho = w(ixo^s,
d_)/w(ixo^s,
lfac_)
564 rhoh = w(ixo^s,
xi_)/w(ixo^s,
lfac_)**2.0d0
565 call srhd_get_csound2_eos(ixi^
l,ixo^
l,rho,rhoh,csound2)
575 integer,
intent(in) :: ixi^
l, ixo^
l
576 double precision,
intent(in) :: w(ixi^s, nw)
577 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
578 double precision,
intent(out) :: pth(ixi^s)
581 double precision :: rho(ixo^s),rhoh(ixo^s),e(ixo^s)
584 rho = w(ixo^s,
d_)/w(ixo^s,
lfac_)
585 rhoh = w(ixo^s,
xi_)/w(ixo^s,
lfac_)**2.0d0
586 call srhd_get_pressure_eos(ixi^
l,ixo^
l,rho,rhoh,pth,e)
592 subroutine srhd_add_source(qdt,dtfactor,ixI^L,ixO^L,wCT,wCTprim,w,x,qsourcesplit,active)
595 integer,
intent(in) :: ixi^
l, ixo^
l
596 double precision,
intent(in) :: qdt,dtfactor
597 double precision,
intent(in) :: wct(ixi^s, 1:nw),wctprim(ixi^s,1:nw), x(ixi^s, 1:
ndim)
598 double precision,
intent(inout) :: w(ixi^s, 1:nw)
599 logical,
intent(in) :: qsourcesplit
600 logical,
intent(inout) :: active
602 end subroutine srhd_add_source
605 subroutine srhd_get_dt(w, ixI^L, ixO^L, dtnew, dx^D, x)
608 integer,
intent(in) :: ixi^
l, ixo^
l
609 double precision,
intent(in) ::
dx^
d, x(ixi^s, 1:^nd)
610 double precision,
intent(in) :: w(ixi^s, 1:nw)
611 double precision,
intent(inout) :: dtnew
615 end subroutine srhd_get_dt
619 subroutine srhd_get_cmax(w, x, ixI^L, ixO^L, idim, cmax)
622 integer,
intent(in) :: ixi^
l, ixo^
l, idim
623 double precision,
intent(in) :: w(ixi^s, nw), x(ixi^s, 1:
ndim)
624 double precision,
intent(inout) :: cmax(ixi^s)
626 double precision,
dimension(ixO^S) :: csound2,tmp1,tmp2,v2
627 double precision,
dimension(ixI^S) :: vidim, cmin
629 logical :: flag(ixi^s,1:nw)
634 tmp2=w(ixo^s,
xi_)/w(ixo^s,
lfac_)**2.0d0
636 call srhd_get_csound2_prim_eos(ixo^
l,tmp1,tmp2,v2,csound2)
637 v2(ixo^s)=1.0d0-1.0d0/w(ixo^s,
lfac_)**2
638 vidim(ixo^s) = w(ixo^s,
mom(idim))/w(ixo^s,
lfac_)
639 tmp2(ixo^s)=vidim(ixo^s)**2.0d0
640 tmp1(ixo^s)=1.0d0-v2(ixo^s)*csound2(ixo^s) &
641 -tmp2(ixo^s)*(1.0d0-csound2(ixo^s))
642 tmp2(ixo^s)=dsqrt(csound2(ixo^s)*(one-v2(ixo^s))*tmp1(ixo^s))
643 tmp1(ixo^s)=vidim(ixo^s)*(one-csound2(ixo^s))
644 cmax(ixo^s)=(tmp1(ixo^s)+tmp2(ixo^s))/(one-v2(ixo^s)*csound2(ixo^s))
645 cmin(ixo^s)=(tmp1(ixo^s)-tmp2(ixo^s))/(one-v2(ixo^s)*csound2(ixo^s))
647 cmin(ixo^s) = max(cmin(ixo^s), - 1.0d0)
648 cmin(ixo^s) = min(cmin(ixo^s), 1.0d0)
649 cmax(ixo^s) = max(cmax(ixo^s), - 1.0d0)
650 cmax(ixo^s) = min(cmax(ixo^s), 1.0d0)
652 cmax(ixo^s) = max(dabs(cmax(ixo^s)),dabs(cmin(ixo^s)))
654 end subroutine srhd_get_cmax
657 subroutine srhd_get_cmax_loc(ixI^L,ixO^L,vidim,csound2,v2,cmax,cmin)
659 integer,
intent(in) :: ixi^
l, ixo^
l
660 double precision,
intent(in) :: vidim(ixi^s)
661 double precision,
intent(in),
dimension(ixO^S) :: csound2
662 double precision,
intent(in) :: v2(ixi^s)
663 double precision,
intent(out) :: cmax(ixi^s)
664 double precision,
intent(out) :: cmin(ixi^s)
666 double precision,
dimension(ixI^S):: tmp1,tmp2
668 tmp2(ixo^s)=vidim(ixo^s)**2.0d0
669 tmp1(ixo^s)=1.0d0-v2(ixo^s)*csound2(ixo^s) &
670 -tmp2(ixo^s)*(1.0d0-csound2(ixo^s))
671 tmp2(ixo^s)=dsqrt(csound2(ixo^s)*(one-v2(ixo^s))*tmp1(ixo^s))
672 tmp1(ixo^s)=vidim(ixo^s)*(one-csound2(ixo^s))
673 cmax(ixo^s)=(tmp1(ixo^s)+tmp2(ixo^s))/(one-v2(ixo^s)*csound2(ixo^s))
675 cmax(ixo^s) = max(cmax(ixo^s), - 1.0d0)
676 cmax(ixo^s) = min(cmax(ixo^s), 1.0d0)
677 cmin(ixo^s)=(tmp1(ixo^s)-tmp2(ixo^s))/(one-v2(ixo^s)*csound2(ixo^s))
679 cmin(ixo^s) = max(cmin(ixo^s), - 1.0d0)
680 cmin(ixo^s) = min(cmin(ixo^s), 1.0d0)
682 end subroutine srhd_get_cmax_loc
686 subroutine srhd_get_cbounds(wLC,wRC,wLp,wRp,x,ixI^L,ixO^L,idim,Hspeed,cmax,cmin)
690 integer,
intent(in) :: ixi^
l, ixo^
l, idim
692 double precision,
intent(in) :: wlc(ixi^s,
nw), wrc(ixi^s,
nw)
694 double precision,
intent(in) :: wlp(ixi^s,
nw), wrp(ixi^s,
nw)
695 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
697 double precision,
intent(inout),
optional :: cmin(ixi^s,1:
number_species)
700 double precision :: wmean(ixi^s,
nw)
701 double precision,
dimension(ixO^S) :: csound2,tmp1,tmp2,tmp3
702 double precision,
dimension(ixI^S) :: vidim,cmaxl,cmaxr,cminl,cminr,v2
704 logical :: flag(ixi^s,1:
nw)
711 tmp2=wlp(ixo^s,
xi_)/wlp(ixo^s,
lfac_)**2.0d0
713 call srhd_get_csound2_prim_eos(ixo^
l,tmp1,tmp2,tmp3,csound2)
714 vidim(ixo^s) = wlp(ixo^s,
mom(idim))/wlp(ixo^s,
lfac_)
715 v2(ixo^s) = 1.0d0-1.0d0/wlp(ixo^s,
lfac_)**2
716 call srhd_get_cmax_loc(ixi^
l,ixo^
l,vidim,csound2,v2,cmaxl,cminl)
721 tmp2=wrp(ixo^s,
xi_)/wrp(ixo^s,
lfac_)**2.0d0
723 call srhd_get_csound2_prim_eos(ixo^
l,tmp1,tmp2,tmp3,csound2)
724 vidim(ixo^s) = wrp(ixo^s,
mom(idim))/wrp(ixo^s,
lfac_)
725 v2(ixo^s) = 1.0d0-1.0d0/wrp(ixo^s,
lfac_)**2
726 call srhd_get_cmax_loc(ixi^
l,ixo^
l,vidim,csound2,v2,cmaxr,cminr)
728 if(
present(cmin))
then
730 cmax(ixo^s,1)=max(cmaxl(ixo^s),cmaxr(ixo^s))
731 cmin(ixo^s,1)=min(cminl(ixo^s),cminr(ixo^s))
734 cmaxl(ixo^s)=max(cmaxl(ixo^s),dabs(cminl(ixo^s)))
735 cmaxr(ixo^s)=max(cmaxr(ixo^s),dabs(cminr(ixo^s)))
736 cmax(ixo^s,1)=max(cmaxl(ixo^s),cmaxr(ixo^s))
744 tmp1=wmean(ixo^s,
xi_)/wmean(ixo^s,
lfac_)**2.0d0
745 call srhd_get_csound2_rhoh(wmean,x,ixi^
l,ixo^
l,tmp1,csound2)
746 vidim(ixo^s) = wmean(ixo^s,
mom(idim))/wmean(ixo^s,
xi_)
747 v2(ixo^s)=1.0d0-1.0d0/wmean(ixo^s,
lfac_)**2
748 call srhd_get_cmax_loc(ixi^
l,ixo^
l,vidim,csound2,v2,cmaxl,cminl)
749 if(
present(cmin))
then
750 cmax(ixo^s,1)=cmaxl(ixo^s)
751 cmin(ixo^s,1)=cminl(ixo^s)
753 cmax(ixo^s,1)=max(cmaxl(ixo^s),dabs(cminl(ixo^s)))
761 tmp1=wmean(ixo^s,
rho_)
762 tmp2=wmean(ixo^s,
xi_)/wmean(ixo^s,
lfac_)**2.0d0
764 call srhd_get_csound2_prim_eos(ixo^
l,tmp1,tmp2,tmp3,csound2)
765 vidim(ixo^s) = wmean(ixo^s,
mom(idim))/wmean(ixo^s,
lfac_)
766 v2(ixo^s) = 1.0d0-1.0d0/wmean(ixo^s,
lfac_)**2
767 call srhd_get_cmax_loc(ixi^
l,ixo^
l,vidim,csound2,v2,cmaxl,cminl)
768 if(
present(cmin))
then
769 cmax(ixo^s,1)=cmaxl(ixo^s)
770 cmin(ixo^s,1)=cminl(ixo^s)
772 cmax(ixo^s,1)=max(cmaxl(ixo^s),dabs(cminl(ixo^s)))
776 end subroutine srhd_get_cbounds
779 subroutine srhd_get_flux(wC,wP,x,ixI^L,ixO^L,idim,f)
781 integer,
intent(in) :: ixi^
l, ixo^
l, idim
783 double precision,
intent(in) :: wc(ixi^s,nw)
785 double precision,
intent(in) :: wp(ixi^s,nw)
786 double precision,
intent(in) :: x(ixi^s,1:
ndim)
787 double precision,
intent(out) :: f(ixi^s,nwflux)
789 double precision :: pth(ixi^s)
790 double precision :: v(ixi^s,1:
ndir)
793 pth(ixo^s)=wp(ixo^s,
p_)
795 v(ixo^s,idir) = wp(ixo^s,
mom(idir))/wp(ixo^s,
lfac_)
799 f(ixo^s,
d_)=v(ixo^s,idim)*wc(ixo^s,
rho_)
809 f(ixo^s,
mom(idir))= v(ixo^s,idim)*wc(ixo^s,
mom(idir))
811 f(ixo^s,
mom(idim))=pth(ixo^s)+f(ixo^s,
mom(idim))
815 f(ixo^s,
e_)=v(ixo^s,idim)*(wc(ixo^s,
e_) + pth(ixo^s))
817 end subroutine srhd_get_flux
820 subroutine srhd_add_source_geom(qdt, dtfactor, ixI^L, ixO^L, wCT, wprim, w, x)
824 integer,
intent(in) :: ixi^
l, ixo^
l
825 double precision,
intent(in) :: qdt, dtfactor, x(ixi^s, 1:
ndim)
826 double precision,
intent(inout) :: wct(ixi^s, 1:nw), wprim(ixi^s, 1:nw), w(ixi^s, 1:nw)
828 double precision :: pth(ixi^s),
source(ixi^s), v(ixi^s,1:
ndir)
829 integer :: idir, h1x^
l{^nooned, h2x^
l}
831 double precision :: exp_factor(ixi^s), del_exp_factor(ixi^s), exp_factor_primitive(ixi^s)
842 source(ixo^s) =
source(ixo^s)*del_exp_factor(ixo^s)/exp_factor(ixo^s)
853 w(ixo^s, mr_) = w(ixo^s, mr_) + qdt *
source(ixo^s) / x(ixo^s,
r_)
854 source(ixo^s) = -wct(ixo^s, mphi_) * wprim(ixo^s,
mom(
r_))
855 w(ixo^s, mphi_) = w(ixo^s, mphi_) + qdt *
source(ixo^s) / x(ixo^s,
r_)
857 w(ixo^s, mr_) = w(ixo^s, mr_) + qdt *
source(ixo^s) / x(ixo^s,
r_)
862 h1x^
l=ixo^
l-
kr(1,^
d); {^nooned h2x^
l=ixo^
l-
kr(2,^
d);}
867 source(ixo^s) = pth(ixo^s) * x(ixo^s, 1) &
868 *(
block%surfaceC(ixo^s, 1) -
block%surfaceC(h1x^s, 1)) &
869 /
block%dvolume(ixo^s)
875 w(ixo^s, mr_) = w(ixo^s, mr_) + qdt *
source(ixo^s) / x(ixo^s, 1)
879 source(ixo^s) = pth(ixo^s) * x(ixo^s, 1) &
880 * (
block%surfaceC(ixo^s, 2) -
block%surfaceC(h2x^s, 2)) &
881 /
block%dvolume(ixo^s)
886 w(ixo^s,
mom(2)) = w(ixo^s,
mom(2)) + qdt *
source(ixo^s) / x(ixo^s, 1)
890 source(ixo^s) = -(wct(ixo^s,
mom(3)) * wprim(ixo^s,
mom(1))) &
891 - (wct(ixo^s,
mom(3)) * wprim(ixo^s,
mom(2))) / dtan(x(ixo^s, 2))
892 w(ixo^s,
mom(3)) = w(ixo^s,
mom(3)) + qdt *
source(ixo^s) / x(ixo^s, 1)
897 end subroutine srhd_add_source_geom
900 subroutine srhd_handle_small_values(primitive, w, x, ixI^L, ixO^L, subname)
903 logical,
intent(in) :: primitive
904 integer,
intent(in) :: ixi^
l,ixo^
l
905 double precision,
intent(inout) :: w(ixi^s,1:nw)
906 double precision,
intent(in) :: x(ixi^s,1:
ndim)
907 character(len=*),
intent(in) :: subname
910 logical :: flag(ixi^s,1:nw),flagall(ixi^s)
918 flagall(ixo^s)=(flag(ixo^s,
rho_).or.flag(ixo^s,
e_))
920 where(flagall(ixo^s))
932 where(flagall(ixo^s)) w(ixo^s,
e_) =
small_e
952 if(.not.primitive)
then
954 write(*,*)
"handle_small_values default: note reporting conservatives!"
960 end subroutine srhd_handle_small_values
970 integer,
intent(in) :: ixi^
l,ixo^
l
971 double precision,
intent(in) :: w(ixi^s, 1:nw)
972 logical,
intent(in) :: varconserve
973 double precision,
intent(out) :: geff(ixi^s)
975 double precision,
dimension(ixO^S) :: pth,rho,e_th,e
978 if (varconserve)
then
979 pth(ixo^s)=w(ixo^s,
xi_)-w(ixo^s,
e_)-w(ixo^s,
d_)
980 rho(ixo^s)=w(ixo^s,
d_)/w(ixo^s,
lfac_)
982 e = e_th+dsqrt(e_th**2+rho**2)
984 (one-(rho(ixo^s)/e(ixo^s))**2)
988 e = e_th+dsqrt(e_th**2+w(ixo^s,
rho_)**2)
990 (one-(w(ixo^s,
rho_)/e(ixo^s))**2)
999 subroutine srhd_get_smallvalues_eos
1003 double precision :: lsmalle,lsmallp,lsmallrho
1010 call mpistop(
"must set finite values small-density/pressure for small value treatments")
1020 gamma_1*lsmallrho*(lsmallrho/lsmalle))
1029 end subroutine srhd_get_smallvalues_eos
1034 integer,
intent(in) :: ixo^
l
1035 double precision,
intent(in) :: rho(ixo^s),p(ixo^s)
1036 double precision,
intent(out) :: rhoh(ixo^s)
1038 double precision,
dimension(ixO^S) :: e_th,e
1043 e = e_th+dsqrt(e_th**2+rho**2)
1052 {
do ix^db= ixo^lim^db\}
1054 write(*,*)
"local pressure and density",p(ix^
d),rho(ix^
d)
1055 write(*,*)
"Error: small value of enthalpy rho*h=",rhoh(ix^
d),&
1056 " encountered when call srhd_get_enthalpy_eos"
1057 call mpistop(
'enthalpy below small_xi: stop (may need to turn on fixes)')
1063 {
do ix^db= ixo^lim^db\}
1074 subroutine srhd_get_pressure_eos(ixI^L,ixO^L,rho,rhoh,p,E)
1076 integer,
intent(in) :: ixi^
l, ixo^
l
1077 double precision,
intent(in) :: rho(ixo^s),rhoh(ixo^s)
1078 double precision,
intent(out) :: p(ixi^s)
1079 double precision,
intent(out) :: e(ixo^s)
1083 e = (rhoh+dsqrt(rhoh**2+(
srhd_gamma**2-one)*rho**2)) &
1085 p(ixo^s) = half*
gamma_1* (e-rho*(rho/e))
1091 {
do ix^db= ixo^lim^db\}
1093 write(*,*)
"local enthalpy rho*h and density rho",rhoh(ix^
d),rho(ix^
d)
1094 if(
srhd_eos)
write(*,*)
'E, rho^2/E, difference', &
1095 e(ix^
d),rho(ix^
d)**2/e(ix^
d),e(ix^
d)-rho(ix^
d)**2/e(ix^
d)
1096 write(*,*)
"Error: small value of gas pressure",p(ix^
d),&
1097 " encountered when call srhd_get_pressure_eos"
1098 call mpistop(
'pressure below small_pressure: stop (may need to turn on fixes)')
1104 {
do ix^db= ixo^lim^db\}
1112 end subroutine srhd_get_pressure_eos
1116 subroutine srhd_get_csound2_eos(ixI^L,ixO^L,rho,rhoh,csound2)
1118 integer,
intent(in) :: ixi^
l, ixo^
l
1119 double precision,
intent(in) :: rho(ixo^s),rhoh(ixo^s)
1120 double precision,
intent(out) :: csound2(ixo^s)
1122 double precision :: p(ixi^s)
1123 double precision :: e(ixo^s)
1126 call srhd_get_pressure_eos(ixi^
l,ixo^
l,rho,rhoh,p,e)
1129 +
gamma_1*(rho(ixo^s)/e(ixo^s))**2))&
1130 /(2.0d0*rhoh(ixo^s))
1132 csound2(ixo^s)=
srhd_gamma*p(ixo^s)/rhoh(ixo^s)
1136 {
do ix^db= ixo^lim^db\}
1137 if(csound2(ix^
d)>=1.0d0.or.csound2(ix^
d)<=0.0d0)
then
1138 write(*,*)
"sound speed error with p - rho - rhoh",p(ix^
d),rhoh(ix^
d),rho(ix^
d)
1139 if(
srhd_eos)
write(*,*)
'and E', e(ix^
d)
1140 write(*,*)
"Error: value of csound2",csound2(ix^
d),&
1141 " encountered when call srhd_get_csound2_eos"
1142 call mpistop(
'sound speed stop (may need to turn on fixes)')
1148 {
do ix^db= ixo^lim^db\}
1149 if(csound2(ix^
d)>=1.0d0)
then
1150 csound2(ix^
d)=1.0d0-1.0d0/
lfacmax**2
1152 if(csound2(ix^
d)<=0.0d0)
then
1158 end subroutine srhd_get_csound2_eos
1162 subroutine srhd_get_csound2_prim_eos(ixO^L,rho,rhoh,p,csound2)
1164 integer,
intent(in) :: ixo^
l
1165 double precision,
intent(in) :: rho(ixo^s),rhoh(ixo^s),p(ixo^s)
1166 double precision,
intent(out) :: csound2(ixo^s)
1168 double precision :: e(ixo^s)
1182 {
do ix^db= ixo^lim^db\}
1183 if(csound2(ix^
d)>=1.0d0.or.csound2(ix^
d)<=0.0d0)
then
1184 write(*,*)
"sound speed error with p - rho - rhoh",p(ix^
d),rhoh(ix^
d),rho(ix^
d)
1185 if(
srhd_eos)
write(*,*)
'and E', e(ix^
d)
1186 write(*,*)
"Error: value of csound2",csound2(ix^
d),&
1187 " encountered when call srhd_get_csound2_prim_eos"
1188 call mpistop(
'sound speed stop (may need to turn on fixes)')
1194 {
do ix^db= ixo^lim^db\}
1195 if(csound2(ix^
d)>=1.0d0)
then
1196 csound2(ix^
d)=1.0d0-1.0d0/
lfacmax**2
1198 if(csound2(ix^
d)<=0.0d0)
then
1204 end subroutine srhd_get_csound2_prim_eos
1207 subroutine con2prim_eos(lfac,xi,myd,myssqr,mytau,ierror)
1210 double precision,
intent(in) :: myd, myssqr, mytau
1211 double precision,
intent(inout) :: lfac, xi
1212 integer,
intent(inout) :: ierror
1215 double precision:: f,df,lfacl
1219 d = myd;
ssqr = myssqr;
tau = mytau;
1225 call funcd_eos(xi,f,df,lfacl,
d,
ssqr,
tau,ierror)
1226 if (ierror == 0 .and. dabs(f/df)<
absaccnr)
then
1234 write(*,*)
'entering con2prim_eos with xi=',xi
1243 call con2primhydro_eos(lfac,xi,
d,
ssqr,
tau,ierror)
1245 end subroutine con2prim_eos
1247 subroutine funcd_eos(xi,f,df,mylfac,d,ssqr,tau,ierror)
1248 double precision,
intent(in) :: xi,d,ssqr,tau
1249 double precision,
intent(out) :: f,df,mylfac
1250 integer,
intent(inout) :: ierror
1253 double precision :: dlfac
1254 double precision :: vsqr,p,dpdxi
1260 mylfac = one/dsqrt(one-vsqr)
1261 dlfac = -mylfac**3*ssqr/(xi**3)
1263 call funcpressure_eos(xi,mylfac,d,dlfac,p,dpdxi)
1274 end subroutine funcd_eos
1277 subroutine con2primhydro_eos(lfac,xi,d,sqrs,tau,ierror)
1278 double precision,
intent(out) :: xi,lfac
1279 double precision,
intent(in) :: d,sqrs,tau
1280 integer,
intent(inout) :: ierror
1283 integer :: ni,niiter,nit,n2it,ni3
1284 double precision :: pcurrent,pnew
1285 double precision :: er,er1,ff,df,dp,v2
1286 double precision :: pmin,lfac2inv,plabs,prabs,pprev
1287 double precision :: s2overcubeg2rh
1288 double precision :: xicurrent,h,dhdp
1289 double precision :: oldff1,oldff2,nff
1290 double precision :: pleft,pright
1305 pmin=dsqrt(sqrs)/(one-
dmaxvel)-tau-d
1306 plabs=max(
minp,pmin)
1325 pcurrent=half*(pcurrent+pprev)
1333 xicurrent=tau+d+pcurrent
1345 v2=sqrs/xicurrent**2
1347 if(lfac2inv>zero)
then
1348 lfac=one/dsqrt(lfac2inv)
1360 s2overcubeg2rh=sqrs/(xicurrent**3)
1362 call funcenthalpy_eos(pcurrent,lfac2inv,d,sqrs,xicurrent,&
1363 s2overcubeg2rh,h,dhdp)
1365 ff=-xicurrent*lfac2inv + h
1366 df=- two*sqrs/xicurrent**2 + dhdp - lfac2inv
1368 if (ff*df==zero)
then
1378 if (ff*df>zero)
then
1381 pnew=max(pnew,plabs)
1385 pnew=min(pnew,prabs)
1391 er=two*dabs(dp)/(pnew+pcurrent)
1397 if((dabs(oldff2-ff) < 1.0d-8 .or. niiter >=
maxitnr-
maxitnr/20).and.&
1398 ff * oldff1 < zero .and. dabs(ff)>
absaccnr)
then
1401 if(n2it<=3) pcurrent=half*(pnew+pcurrent)
1405 pcurrent=half*(pleft+pright)
1408 xicurrent=tau+d+pcurrent
1409 v2=sqrs/xicurrent**2
1412 if(lfac2inv>zero)
then
1413 lfac=one/dsqrt(lfac2inv)
1421 call bisection_enthalpy_eos(pnew,lfac2inv,d,xicurrent,h)
1422 nff=-xicurrent*lfac2inv + h
1425 if(ff * nff < zero)
then
1431 pcurrent=half*(pleft+pright)
1435 if(2.0d0*dabs(pleft-pright)/(pleft+pright)<
absaccnr &
1469 if(pcurrent<
minp)
then
1476 v2=sqrs/xicurrent**2
1478 if(lfac2inv>zero)
then
1479 lfac=one/dsqrt(lfac2inv)
1485 end subroutine con2primhydro_eos
1489 subroutine funcpressure_eos(xicurrent,lfac,d,dlfacdxi,p,dpdxi)
1491 double precision,
intent(in) :: xicurrent,lfac,d,dlfacdxi
1492 double precision,
intent(out) :: p,dpdxi
1494 double precision :: rho,h,e,dhdxi,rhotoe
1495 double precision :: dpdchi,dedxi
1498 h=xicurrent/(lfac**2)
1500 e = (h+dsqrt(h**2+(
srhd_gamma**2-one)*rho**2)) &
1504 p = half*
gamma_1*(e-rho*rhotoe)
1506 dhdxi = one/(lfac**2)-2.0d0*xicurrent/(lfac**2)*dlfacdxi/lfac
1508 dedxi=(dhdxi+(h*dhdxi-(
srhd_gamma**2-one)*rho**2*dlfacdxi/lfac)&
1513 dpdxi=half*
gamma_1*(2.0d0*rho*rhotoe*dlfacdxi/lfac+&
1514 (one+rhotoe**2)*dedxi)
1516 end subroutine funcpressure_eos
1520 subroutine funcenthalpy_eos(pcurrent,lfac2inv,d,sqrs,xicurrent,dv2d2p,h,dhdp)
1522 double precision,
intent(in) :: pcurrent,lfac2inv,d,sqrs,xicurrent,dv2d2p
1523 double precision,
intent(out):: h,dhdp
1526 double precision:: rho,e_th,e,de_thdp,dedp
1528 rho=d*dsqrt(lfac2inv)
1530 e = (e_th + dsqrt(e_th**2+rho**2))
1536 dedp = de_thdp * (one+e_th/dsqrt(e_th**2+rho**2))&
1537 + d**2*dv2d2p/dsqrt(e_th**2+rho**2)
1540 gamma_1*(rho*(rho/e))*(-2.0d0*dv2d2p/lfac2inv+dedp/e))
1541 end subroutine funcenthalpy_eos
1545 subroutine bisection_enthalpy_eos(pcurrent,lfac2inv,d,xicurrent,h)
1547 double precision,
intent(in) :: pcurrent,lfac2inv,d,xicurrent
1548 double precision,
intent(out):: h
1551 double precision:: rho,e_th,e
1553 rho=d*dsqrt(lfac2inv)
1555 e = (e_th + dsqrt(e_th**2+rho**2))
1560 end subroutine bisection_enthalpy_eos
1563 subroutine con2prim(lfac,xi,myd,myssqr,mytau,ierror)
1566 double precision,
intent(in) :: myd, myssqr, mytau
1567 double precision,
intent(inout) :: lfac, xi
1568 integer,
intent(inout) :: ierror
1571 double precision:: f,df,lfacl
1575 d = myd;
ssqr = myssqr;
tau = mytau;
1581 call funcd(xi,f,df,lfacl,
d,
ssqr,
tau,ierror)
1582 if (ierror == 0 .and. dabs(f/df)<
absaccnr)
then
1590 write(*,*)
'entering con2prim with xi=',xi
1599 call con2primhydro(lfac,xi,
d,
ssqr,
tau,ierror)
1601 end subroutine con2prim
1603 subroutine funcd(xi,f,df,mylfac,d,ssqr,tau,ierror)
1604 double precision,
intent(in) :: xi,d,ssqr,tau
1605 double precision,
intent(out) :: f,df,mylfac
1606 integer,
intent(inout) :: ierror
1609 double precision :: dlfac
1610 double precision :: vsqr,p,dpdxi
1616 mylfac = one/dsqrt(one-vsqr)
1617 dlfac = -mylfac**3*ssqr/(xi**3)
1619 call funcpressure(xi,mylfac,d,dlfac,p,dpdxi)
1630 end subroutine funcd
1633 subroutine con2primhydro(lfac,xi,d,sqrs,tau,ierror)
1634 double precision,
intent(out) :: xi,lfac
1635 double precision,
intent(in) :: d,sqrs,tau
1636 integer,
intent(inout) :: ierror
1639 integer :: ni,niiter,nit,n2it,ni3
1640 double precision :: pcurrent,pnew
1641 double precision :: er,er1,ff,df,dp,v2
1642 double precision :: pmin,lfac2inv,plabs,prabs,pprev
1643 double precision :: s2overcubeg2rh
1644 double precision :: xicurrent,h,dhdp
1645 double precision :: oldff1,oldff2,nff
1646 double precision :: pleft,pright
1661 pmin=dsqrt(sqrs)/(one-
dmaxvel)-tau-d
1662 plabs=max(
minp,pmin)
1681 pcurrent=half*(pcurrent+pprev)
1689 xicurrent=tau+d+pcurrent
1701 v2=sqrs/xicurrent**2
1703 if(lfac2inv>zero)
then
1704 lfac=one/dsqrt(lfac2inv)
1716 s2overcubeg2rh=sqrs/(xicurrent**3)
1718 call funcenthalpy(pcurrent,lfac2inv,d,sqrs,xicurrent,&
1719 s2overcubeg2rh,h,dhdp)
1721 ff=-xicurrent*lfac2inv + h
1722 df=- two*sqrs/xicurrent**2 + dhdp - lfac2inv
1724 if (ff*df==zero)
then
1734 if (ff*df>zero)
then
1737 pnew=max(pnew,plabs)
1741 pnew=min(pnew,prabs)
1747 er=two*dabs(dp)/(pnew+pcurrent)
1753 if((dabs(oldff2-ff) < 1.0d-8 .or. niiter >=
maxitnr-
maxitnr/20).and.&
1754 ff * oldff1 < zero .and. dabs(ff)>
absaccnr)
then
1757 if(n2it<=3) pcurrent=half*(pnew+pcurrent)
1761 pcurrent=half*(pleft+pright)
1764 xicurrent=tau+d+pcurrent
1765 v2=sqrs/xicurrent**2
1768 if(lfac2inv>zero)
then
1769 lfac=one/dsqrt(lfac2inv)
1777 call bisection_enthalpy(pnew,lfac2inv,d,xicurrent,h)
1778 nff=-xicurrent*lfac2inv + h
1781 if(ff * nff < zero)
then
1787 pcurrent=half*(pleft+pright)
1791 if(2.0d0*dabs(pleft-pright)/(pleft+pright)<
absaccnr &
1825 if(pcurrent<
minp)
then
1832 v2=sqrs/xicurrent**2
1834 if(lfac2inv>zero)
then
1835 lfac=one/dsqrt(lfac2inv)
1841 end subroutine con2primhydro
1845 subroutine funcpressure(xicurrent,lfac,d,dlfacdxi,p,dpdxi)
1847 double precision,
intent(in) :: xicurrent,lfac,d,dlfacdxi
1848 double precision,
intent(out) :: p,dpdxi
1850 double precision :: rho,h,e,dhdxi,rhotoe
1851 double precision :: dpdchi,dedxi
1854 h=xicurrent/(lfac**2)
1859 dpdxi = dpdchi * one/lfac**2
1861 if (dlfacdxi /= 0.0d0) &
1862 dpdxi = dpdxi + dpdchi * ((d*lfac-2.0d0*xicurrent)/lfac**3) * dlfacdxi
1864 end subroutine funcpressure
1868 subroutine funcenthalpy(pcurrent,lfac2inv,d,sqrs,xicurrent,dv2d2p,h,dhdp)
1870 double precision,
intent(in) :: pcurrent,lfac2inv,d,sqrs,xicurrent,dv2d2p
1871 double precision,
intent(out):: h,dhdp
1874 double precision:: rho,e_th,e,de_thdp,dedp
1876 rho=d*dsqrt(lfac2inv)
1879 end subroutine funcenthalpy
1883 subroutine bisection_enthalpy(pcurrent,lfac2inv,d,xicurrent,h)
1885 double precision,
intent(in) :: pcurrent,lfac2inv,d,xicurrent
1886 double precision,
intent(out):: h
1889 double precision:: rho,e_th,e
1891 rho=d*dsqrt(lfac2inv)
1895 end subroutine bisection_enthalpy
Calculate w(iw)=w(iw)+qdt*SOURCE[wCT,qtC,x] within ixO for all indices iw=iwmin......
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for physical and numeric constants.
Module with geometry-related routines (e.g., divergence, curl)
integer, parameter spherical
integer, parameter cylindrical
integer, parameter cartesian_expansion
This module contains definitions of global parameters and variables and some generic functions/subrou...
type(state), pointer block
Block pointer for using one block and its previous state.
double precision small_pressure
double precision unit_time
Physical scaling factor for time.
double precision unit_density
Physical scaling factor for density.
integer, parameter unitpar
file handle for IO
double precision unit_mass
Physical scaling factor for mass.
integer, dimension(3, 3) kr
Kronecker delta tensor.
double precision unit_numberdensity
Physical scaling factor for number density.
double precision unit_pressure
Physical scaling factor for pressure.
integer, parameter ndim
Number of spatial dimensions for grid variables.
double precision unit_length
Physical scaling factor for length.
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 unit_velocity
Physical scaling factor for velocity.
double precision unit_temperature
Physical scaling factor for temperature.
logical si_unit
Use SI units (.true.) or use cgs units (.false.)
double precision, dimension(:,:), allocatable dx
spatial steps for all dimensions at all levels
integer nghostcells
Number of ghost cells surrounding a grid.
logical phys_trac
Use TRAC for MHD or 1D HD.
logical fix_small_values
fix small values with average or replace methods
double precision small_density
integer r_
Indices for cylindrical coordinates FOR TESTS, negative value when not used:
integer boundspeed
bound (left/min and right.max) speed of Riemann fan
logical check_small_values
check and optionally fix unphysical small values (density, gas pressure)
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...
Module for handling problematic values in simulations, such as negative pressures.
subroutine, public small_values_average(ixil, ixol, w, x, w_flag, windex)
logical, public trace_small_values
trace small values in the source file using traceback flag of compiler
subroutine, public small_values_error(wprim, x, ixil, ixol, w_flag, subname)
character(len=20), public small_values_method
How to handle small values.
Special Relativistic Hydrodynamics (with EOS) physics module.
subroutine, public srhd_get_auxiliary(ixil, ixol, w, x)
Compute auxiliary variables lfac and xi from a conservative state using srhd_con2prim to calculate en...
double precision, public tolernr
integer, public, protected srhd_n_tracer
Number of tracer species.
double precision, public inv_gamma_1
subroutine, public srhd_get_geff_eos(w, ixil, ixol, varconserve, geff)
calculate effective gamma
integer, dimension(:), allocatable, public, protected tracer
Indices of the tracers.
double precision, public absaccnr
integer, public, protected lfac_
Index of the Lorentz factor.
subroutine, public srhd_get_enthalpy_eos(ixol, rho, p, rhoh)
Compute the enthalpy rho*h from rho and pressure p.
subroutine, public srhd_get_auxiliary_prim(ixil, ixol, w)
Set auxiliary variables lfac and xi from a primitive state only used when handle_small_values average...
double precision, public gamma_to_gamma_1
integer, public maxitnr
parameters for NR in con2prim
subroutine, public srhd_phys_init()
Initialize the module.
double precision, public gamma_1
double precision, public, protected he_abundance
Helium abundance over Hydrogen.
double precision, public small_xi
The smallest allowed inertia.
integer, dimension(:), allocatable, public, protected mom
Indices of the momentum density.
subroutine, public srhd_get_pthermal(w, x, ixil, ixol, pth)
Calculate thermal pressure p within ixO^L must follow after update conservative with auxiliaries.
double precision, public minp
logical, public srhd_eos
Whether synge eos is used.
double precision, public lfacmax
integer, public, protected d_
subroutine, public srhd_check_w(primitive, ixil, ixol, w, flag)
Returns logical argument flag T where values are not ok.
subroutine, public srhd_to_conserved(ixil, ixol, w, x)
Transform primitive variables into conservative ones.
subroutine, public srhd_check_params
integer, public, protected p_
Index of the gas pressure should equal e_.
subroutine, public srhd_to_primitive(ixil, ixol, w, x)
Transform conservative variables into primitive ones.
logical, public, protected srhd_particles
Whether particles module is added.
double precision, public smalltau
double precision, public dmaxvel
integer, public, protected e_
Index of the energy density.
double precision, public minrho
double precision, public smallxi
integer, public, protected xi_
Index of the inertia.
double precision, public srhd_gamma
The adiabatic index and derived values.
integer, public, protected rho_
Index of the density (in the w array)
subroutine, public srhd_get_csound2(w, x, ixil, ixol, csound2)
Calculate the square of the thermal sound speed csound2 within ixO^L. here computed from conservative...
Module with all the methods that users can customize in AMRVAC.
procedure(set_surface), pointer usr_set_surface
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.