19 double precision,
public ::
fld_mu = 0.6d0
39 integer,
allocatable,
public ::
i_opf(:)
41 double precision,
private,
protected :: fld_gamma
61 character(len=*),
intent(in) :: files(:)
70 open(
unitpar, file=trim(files(n)), status=
"old")
71 read(
unitpar, fld_list,
end=111)
90 double precision,
intent(in) :: he_abundance, r_gamma
91 double precision :: sigma_thomson
93 character(len=1) :: ind_1
94 character(len=1) :: ind_2
95 character(len=2) :: cmp_f
96 character(len=5) :: cmp_e
104 write(ind_1,
'(I1)') idir
113 mg%operator_type = mg_vhelmholtz
116 fld_mu = (1.+4*he_abundance)/(2.+3.*he_abundance)
123 sigma_thomson = 6.6524585
d-25
124 fld_kappa0 = sigma_thomson/const_mp * (1.+2.*he_abundance)/(1.+4.*he_abundance)
131 energy,qsourcesplit,active)
136 integer,
intent(in) :: ixi^
l, ixo^
l
137 double precision,
intent(in) :: qdt, x(ixi^s,1:
ndim)
138 double precision,
intent(in) :: wct(ixi^s,1:nw),wctprim(ixi^s,1:nw)
139 double precision,
intent(inout) :: w(ixi^s,1:nw)
140 logical,
intent(in) :: energy,qsourcesplit
141 logical,
intent(inout) :: active
142 integer :: idir, jdir
143 double precision :: radiation_forcect(ixo^s,1:
ndim)
144 double precision :: rad_fluxct(ixo^s,1:
ndim)
145 double precision :: grad_e(ixi^s)
146 double precision :: lambda(ixo^s),fld_r(ixo^s)
155 radiation_forcect(ixo^s,idir) = -lambda(ixo^s)*grad_e(ixo^s)
157 w(ixo^s,iw_mom(idir)) = w(ixo^s,iw_mom(idir)) &
158 + qdt*radiation_forcect(ixo^s,idir)
160 w(ixo^s,iw_e) = w(ixo^s,iw_e) &
161 + qdt*wctprim(ixo^s,iw_mom(idir))*radiation_forcect(ixo^s,idir)
171 integer,
intent(in) :: ixi^
l, ixo^
l
172 double precision,
intent(in) ::
dx^
d, x(ixi^s,1:
ndim), w(ixi^s,1:nw)
173 double precision,
intent(inout) :: dtnew
174 double precision :: radiation_force(ixo^s,1:
ndim)
175 double precision :: dxinv(1:
ndim), max_grad
176 double precision :: lambda(ixo^s),fld_r(ixo^s),grad_e(ixi^s)
179 ^
d&dxinv(^
d)=one/
dx^
d;
183 radiation_force(ixo^s,idir) = -lambda(ixo^s)*grad_e(ixo^s)
184 max_grad = maxval(dabs(radiation_force(ixo^s,idir)))
185 max_grad = max(max_grad, epsilon(1.0d0))
186 dtnew = min(dtnew,
courantpar / dsqrt(max_grad * dxinv(idir)))
197 integer,
intent(in) :: ixi^
l, ixo^
l
198 double precision,
intent(in) :: w(ixi^s, 1:nw)
199 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
200 double precision,
intent(out) :: fld_kappa(ixo^s)
201 double precision :: temp(ixi^s)
202 double precision :: rho0,temp0,n
203 integer :: i,j,ix^
d, idir
211 {
do ix^
d=ixomin^
d,ixomax^
d\ }
219 call mpistop(
"special opacity not defined")
223 call mpistop(
"Doesn't know opacity law")
235 integer,
intent(in) :: ixi^
l,ixo^
l,nth
236 double precision,
intent(in) :: w(ixi^s,1:nw)
237 double precision,
intent(in) :: x(ixi^s,1:
ndim)
238 double precision,
intent(out) :: fld_r(ixo^s),fld_lambda(ixo^s)
239 integer :: idir, ix^
d
241 double precision :: kappa(ixo^s)
242 double precision :: normgrad2(ixo^s)
243 double precision :: grad_r_e(ixi^s)
244 double precision :: rad_e(ixi^s)
245 double precision :: tmp_l(ixi^s), filtered_l(ixi^s)
250 fld_lambda(ixo^s) = 1.d0/3.d0
256 normgrad2(ixo^s) = zero
257 rad_e(ixi^s) = w(ixi^s, iw_r_e)
259 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
260 normgrad2(ixo^s) = normgrad2(ixo^s)+grad_r_e(ixo^s)**2
264 if(maxval(normgrad2(ixo^s))==0.0d0)
call mpistop(
"choose other fluxlimiter, FreeStream has issues")
265 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
267 fld_lambda(ixo^s) = one/fld_r(ixo^s)
271 normgrad2(ixo^s) = zero
272 rad_e(ixi^s) = w(ixi^s, iw_r_e)
274 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
275 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_e(ixo^s)**2
278 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
281 fld_lambda(ixo^s) = (2.d0+fld_r(ixo^s))/(6.d0+3*fld_r(ixo^s)+fld_r(ixo^s)**2.d0)
285 normgrad2(ixo^s) = zero
286 rad_e(ixi^s) = w(ixi^s, iw_r_e)
288 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
289 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_e(ixo^s)**2
292 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
295 {
do ix^
d = ixomin^
d,ixomax^
d\ }
296 if(fld_r(ix^
d) .lt. 3.d0/2.d0)
then
297 fld_lambda(ix^
d) = 2.d0/(3.d0+dsqrt(9.d0+12.d0*fld_r(ix^
d)**2.d0))
299 fld_lambda(ix^
d) = 1.d0/(1.d0+fld_r(ix^
d)+dsqrt(1.d0+2.d0*fld_r(ix^
d)))
304 call mpistop(
"special fluxlimiter not defined")
308 call mpistop(
'Fluxlimiter unknown')
318 integer,
intent(in) :: ixi^
l, ixo^
l, nth
319 double precision,
intent(in) :: w(ixi^s, 1:nw)
320 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
321 double precision,
intent(out) :: rad_flux(ixo^s, 1:
ndim)
322 double precision :: cc
323 double precision :: grad_r_e(ixi^s)
324 double precision :: rad_e(ixi^s)
325 double precision :: kappa(ixo^s), lambda(ixo^s), fld_r(ixo^s)
326 integer :: ix^
d, idir
329 rad_e(ixi^s) = w(ixi^s, iw_r_e)
335 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
336 rad_flux(ixo^s, idir) = -cc*lambda(ixo^s)/(kappa(ixo^s)*w(ixo^s,iw_rho))*grad_r_e(ixo^s)
344 integer,
intent(in) :: ixI^L, ixO^L, nth
345 double precision,
intent(in) :: w(ixI^S, 1:nw)
346 double precision,
intent(in) :: x(ixI^S, 1:ndim)
347 double precision,
intent(out) :: eddington_tensor(ixI^S,1:ndim,1:ndim)
348 double precision :: tnsr2(ixO^S,1:ndim,1:ndim)
349 double precision :: normgrad2(ixO^S), f(ixO^S)
350 double precision :: grad_r_e(ixI^S,1:ndim), rad_e(ixI^S)
351 double precision :: lambda(ixO^S), fld_R(ixO^S)
352 integer :: i,j, idir,jdir
356 normgrad2(ixo^s) = zero
357 rad_e(ixi^s) = w(ixi^s, iw_r_e)
359 call gradient(rad_e,ixi^l,ixo^l,idir,grad_r_e(ixi^s,idir),nth)
360 normgrad2(ixo^s)=normgrad2(ixo^s)+grad_r_e(ixo^s,idir)**2
365 f(ixo^s) = lambda(ixo^s)+lambda(ixo^s)**two*fld_r(ixo^s)**two
366 f(ixo^s) = half*(one-f(ixo^s))+half*(3.d0*f(ixo^s)-one)
368 eddington_tensor(ixo^s,1,1) = f(ixo^s)
372 eddington_tensor(ixo^s,idir,idir) = half*(one-f(ixo^s))
376 if(idir .ne. jdir) eddington_tensor(ixo^s,idir,jdir) = zero
377 tnsr2(ixo^s,idir,jdir) = half*(3.d0*f(ixo^s)-one) &
378 * grad_r_e(ixo^s,idir)*grad_r_e(ixo^s,jdir)/max(normgrad2(ixo^s),smalldouble)
383 where(normgrad2(ixo^s) .gt. smalldouble)
384 eddington_tensor(ixo^s,idir,jdir) = eddington_tensor(ixo^s,idir,jdir)+tnsr2(ixo^s,idir,jdir)
396 integer,
intent(in) :: ixi^
l, ixo^
l, nth
397 double precision,
intent(in) :: w(ixi^s, 1:nw)
398 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
399 double precision,
intent(out):: rad_pressure(ixo^s,1:
ndim,1:
ndim)
401 double precision :: eddington_tensor(ixi^s,1:
ndim,1:
ndim)
406 rad_pressure(ixo^s,i,j) = eddington_tensor(ixo^s,i,j)*w(ixo^s,iw_r_e)
413 type(state),
target :: psa(max_blocks)
414 type(state),
target :: psb(max_blocks)
415 double precision,
intent(in) :: qdt
416 double precision,
intent(in) :: qtC
417 double precision,
intent(in) :: dtfactor
418 integer :: ixO^L,iigrid,igrid
422 ixo^l=ixg^
ll^lsubnghostcells;
424 do iigrid=1,igridstail; igrid=igrids(iigrid);
436 integer,
intent(in) :: ixI^L,ixO^L
437 double precision,
intent(in) :: x(ixI^S,1:ndim)
438 double precision,
intent(in) :: dtfactor, qdt
439 double precision,
intent(inout) :: w(ixI^S,1:nw)
441 double precision :: wprim(ixI^S,1:nw)
442 double precision,
dimension(ixO^S) :: a1,a2,a3,c0,c1,kappa
443 double precision,
dimension(ixI^S) :: e_gas,E_rad,vel,grad_v,nabla_vP
444 double precision,
dimension(ixI^S,1:ndim,1:ndim) :: div_v,edd
445 double precision :: sigma_b,cc
446 integer :: i,j,idir,jdir,ix^D
453 vel(ixi^s) = w(ixi^s,iw_mom(jdir))/w(ixi^s,iw_rho)
454 call gradient(vel,ixi^l,ixo^l,idir,grad_v)
455 div_v(ixo^s,idir,jdir) = grad_v(ixo^s)
462 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1)
466 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
467 + div_v(ixo^s,1,2)*edd(ixo^s,1,2) &
468 + div_v(ixo^s,2,1)*edd(ixo^s,2,1) &
469 + div_v(ixo^s,2,2)*edd(ixo^s,2,2)
472 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
473 + div_v(ixo^s,1,2)*edd(ixo^s,1,2) &
474 + div_v(ixo^s,1,3)*edd(ixo^s,1,3) &
475 + div_v(ixo^s,2,1)*edd(ixo^s,2,1) &
476 + div_v(ixo^s,2,2)*edd(ixo^s,2,2) &
477 + div_v(ixo^s,2,3)*edd(ixo^s,2,3) &
478 + div_v(ixo^s,3,1)*edd(ixo^s,3,1) &
479 + div_v(ixo^s,3,2)*edd(ixo^s,3,2) &
480 + div_v(ixo^s,3,3)*edd(ixo^s,3,3)
486 e_gas(ixo^s) = w(ixo^s,iw_e)-half*sum(w(ixo^s,iw_mom(:))**2,dim=ndim+1)/w(ixo^s,iw_rho)
487 if(
allocated(iw_mag))
then
488 e_gas(ixo^s) = e_gas(ixo^s)-half*sum(w(ixo^s,iw_mag(:))**2,dim=ndim+1)
490 {
do ix^d = ixomin^d,ixomax^d\ }
493 e_rad(ixo^s) = w(ixo^s,iw_r_e)
500 a1(ixo^s) = 4.d0*kappa(ixo^s)*sigma_b*(fld_gamma-one)**4/w(ixo^s,iw_rho)**3*dtfactor*qdt
501 a2(ixo^s) = cc*kappa(ixo^s)*w(ixo^s,iw_rho)*dtfactor*qdt
502 a3(ixo^s) = nabla_vp(ixo^s)*dtfactor*qdt
503 c0(ixo^s) = ((one+a2(ixo^s)+a3(ixo^s))*e_gas(ixo^s)+a2(ixo^s)*e_rad(ixo^s))/a1(ixo^s)/(one+a3(ixo^s))
504 c1(ixo^s) = (one+a2(ixo^s)+a3(ixo^s))/a1(ixo^s)/(one+a3(ixo^s))
507 {
do ix^d = ixomin^d,ixomax^d\}
512 call newton_method(e_gas(ix^d),e_rad(ix^d),c0(ix^d),c1(ix^d))
514 call halley_method(e_gas(ix^d),e_rad(ix^d),c0(ix^d),c1(ix^d))
516 call mpistop(
'root-method not known')
519 e_rad(ixo^s) = (a1(ixo^s)*e_gas(ixo^s)**4.d0+e_rad(ixo^s))/(one+a2(ixo^s)+a3(ixo^s))
521 w(ixo^s,iw_e) = e_gas(ixo^s)
524 w(ixo^s,iw_e) = w(ixo^s,iw_e)+half*sum(w(ixo^s,iw_mom(:))**2,dim=ndim+1)/w(ixo^s,iw_rho)
525 if(
allocated(iw_mag))
then
526 w(ixo^s,iw_e) = w(ixo^s,iw_e)+half*sum(w(ixo^s,iw_mag(:))**2,dim=ndim+1)
529 w(ixo^s,iw_r_e) = e_rad(ixo^s)
538 type(state),
target :: psa(max_blocks)
539 type(state),
target :: psb(max_blocks)
540 double precision,
intent(in) :: qdt
541 double precision,
intent(in) :: qtC
542 double precision,
intent(in) :: dtfactor
544 double precision :: res, max_residual, lambda
545 integer,
parameter :: max_its = 100
546 integer :: iw_to,iw_from
547 integer :: iigrid, igrid, id
548 integer :: nc, lvl, i
550 double precision :: fac, facD
559 print *,
'skipping implicit solve: dt too small!'
565 mg%operator_type = mg_vhelmholtz
566 mg%smoother_type = mg_smoother_gs
567 call mg_set_methods(
mg)
568 if(.not.
mg%is_allocated)
call mpistop(
"multigrid tree not allocated yet")
569 lambda = 1.d0/(dtfactor *
dt_diff)
570 call vhelmholtz_set_lambda(lambda)
578 call mg_restrict(
mg, mg_iveps)
579 call mg_fill_ghost_cells(
mg, mg_iveps)
581 call mg_fas_fmg(
mg, .true., max_res=res)
583 if(res < max_residual)
exit
584 call mg_fas_vcycle(
mg, max_res=res)
586 if(res .le. 0.d0)
then
588 if (
mg%my_rank == 0) &
589 write(*,*)
it,
' residual zero ', res
592 if(
mg%my_rank == 0)
then
594 error stop
"Diffusion residual to zero"
620 type(state),
target :: psa(max_blocks)
621 double precision,
intent(in) :: qtC
622 integer :: iigrid, igrid, level
628 do iigrid=1,igridstail; igrid=igrids(iigrid);
634 call getbc(qtc,0.d0,psa,1,nwflux+nwaux)
640 integer,
intent(in) :: ixI^L, ixO^L
641 double precision,
intent(inout) :: w(ixI^S, 1:nw)
642 double precision :: gradE(ixO^S),divF(ixO^S)
643 double precision :: divF_h(ixO^S),divF_j(ixO^S)
644 double precision :: diff_term(ixO^S)
645 integer :: idir, jxO^L, hxO^L
649 hxo^l=ixo^l-
kr(idir,^
d);
650 jxo^l=ixo^l+
kr(idir,^
d);
653 divf(ixo^s) = divf(ixo^s) + 2.d0*(divf_h(ixo^s) + divf_j(ixo^s))/
dxlevel(idir)**2
655 w(ixo^s,iw_r_e) = divf(ixo^s)
663 integer,
intent(in) :: ixi^
l, ixo^
l
664 logical,
intent(in) :: primitives_filled
665 double precision,
intent(inout) :: w(ixi^s,1:nw)
666 double precision,
intent(in) :: wct(ixi^s,1:nw)
667 double precision,
intent(in) :: wctprim(ixi^s,1:nw)
668 double precision,
intent(in) :: x(ixi^s,1:
ndim)
669 integer :: idir,i,j,ix^
d
670 double precision :: cc
671 double precision :: kappa(ixo^s),lambda(ixo^s),fld_r(ixo^s)
672 double precision :: max_d(ixi^s),grad_r_e(ixi^s),rad_e(ixi^s)
675 if(primitives_filled)
then
681 w(ixo^s,
i_diff_mg) = cc*lambda(ixo^s)/(kappa(ixo^s)*wct(ixo^s,iw_rho))
689 w(ixo^s,
i_diff_mg) = cc*lambda(ixo^s)/(kappa(ixo^s)*wct(ixo^s,iw_rho))
698 type(state),
target :: psa(max_blocks)
699 integer :: iigrid, igrid, level
704 do iigrid=1,igridstail; igrid=igrids(iigrid);
714 double precision,
intent(in) :: c0, c1
715 double precision,
intent(in) :: E_rad
716 double precision,
intent(inout) :: e_gas
717 double precision :: bisect_a, bisect_b, bisect_c
718 integer :: n, max_its
723 bisect_b = min(abs(c0/c1),abs(c0)**(1.d0/4.d0))+smalldouble
724 do while(abs(bisect_b-bisect_a) .ge.
fld_bisect_tol*min(e_gas,e_rad))
725 bisect_c = (bisect_a + bisect_b)/two
727 if(n .gt. max_its)
then
729 call mpistop(
'No convergece in bisection scheme')
752 call mpistop(
"Problem with fld bisection method")
760 print*,
"IGNORING GAS-RAD ENERGY EXCHANGE ", c0, c1
770 2435 e_gas = (bisect_a + bisect_b)/two
776 double precision,
intent(in) :: c0, c1
777 double precision,
intent(in) :: E_rad
778 double precision,
intent(inout) :: e_gas
779 double precision :: xval, yval, der, deltax
795 print*,
'skip to bisection algorithm'
806 double precision,
intent(in) :: c0, c1
807 double precision,
intent(in) :: E_rad
808 double precision,
intent(inout) :: e_gas
809 double precision :: xval, yval, der, dder, deltax
823 deltax = -two*yval*der/(two*der**2 - yval*dder)
837 double precision,
intent(in) :: e_gas
838 double precision,
intent(in) :: c0, c1
839 double precision :: val
841 val = e_gas**4.d0 + c1*e_gas - c0
847 double precision,
intent(in) :: e_gas
848 double precision,
intent(in) :: c0, c1
849 double precision :: der
851 der = 4.d0*e_gas**3.d0 + c1
857 double precision,
intent(in) :: e_gas
858 double precision,
intent(in) :: c0, c1
859 double precision :: dder
861 dder = 4.d0*3.d0*e_gas**2.d0
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for physical and numeric constants.
Nicolas Moens with updates by RK (16/03/2026) Module for including flux limited diffusion (FLD)-appro...
subroutine put_diffterm_onegrid(ixil, ixol, w)
inplace update of psa==>F_im(psa)
subroutine, public fld_get_opacity(w, x, ixil, ixol, fld_kappa)
Sets the opacity in the w-array by calling mod_opal_opacity.
double precision, public fld_mu
mean particle mass
double precision, public fld_bisect_tol
Tolerance for bisection method for Energy sourceterms This is a percentage of the minimum of gas- and...
subroutine energy_interaction(w, x, ixil, ixol, dtfactor, qdt)
Energy interaction and photon tiring.
double precision, public fld_diff_tol
Tolerance for adi method for radiative Energy diffusion.
subroutine fld_params_read(files)
public methods these are called in mod_hd_phys or mod_mhd_phys
logical diffcrash_resume
Resume run when multigrid returns error.
subroutine update_diffcoeff(psa)
integer, dimension(:), allocatable, public i_opf
Index for Flux weighted opacities.
character(len=8) fld_opacity_law
switches for opacity
double precision function ddpolynomial_bisection(e_gas, c0, c1)
Evaluate second derivative of polynomial at argument e_gas.
subroutine evaluate_e_rad_mg(qtc, psa)
inplace update of psa==>F_im(psa)
subroutine, public fld_get_radpress(w, x, ixil, ixol, rad_pressure, nth)
Calculate Radiation Pressure Returns Radiation Pressure as tensor NOTE: w is primitive on entry.
character(len=16) fld_fluxlimiter
flux limiter choice
subroutine bisection_method(e_gas, e_rad, c0, c1)
Find the root of the 4th degree polynomial using the bisection method.
character(len=50) fld_opal_table
subroutine, public fld_get_diffcoef_central(w, wct, wctprim, x, ixil, ixol, primitives_filled)
Calculates cell-centered diffusion coefficient to be used in multigrid.
double precision, public fld_kappa0
Opacity per unit of unit_density.
subroutine, public fld_get_fluxlimiter(w, x, ixil, ixol, fld_lambda, fld_r, nth)
Calculate fld flux limiter This subroutine calculates flux limiter lambda using the prescription stor...
logical lineforce_opacities
Use or dont use lineforce opacities.
double precision function polynomial_bisection(e_gas, c0, c1)
Evaluate polynomial at argument e_gas.
subroutine, public add_fld_rad_force(qdt, ixil, ixol, wct, wctprim, w, x, energy, qsourcesplit, active)
w[iw]=w[iw]+qdt*S[wCT,qtC,x] where S is the source based on wCT within ixO This subroutine handles th...
subroutine, public fld_init(he_abundance, r_gamma)
Initialising FLD-module: Read opacities Initialise Multigrid adimensionalise kappa Add extra variable...
logical fld_eint_split
source split for energy interact and radforce:
subroutine halley_method(e_gas, e_rad, c0, c1)
Find the root of the 4th degree polynomial using the Halley method.
character(len=8) fld_interaction_method
Which method to find the root for the energy interaction polynomial.
subroutine newton_method(e_gas, e_rad, c0, c1)
Find the root of the 4th degree polynomial using the Newton-Ralphson method.
logical fld_radforce_split
subroutine, public fld_get_radflux(w, x, ixil, ixol, rad_flux, nth)
Calculate Radiation Flux stores radiation flux in w-array.
double precision function dpolynomial_bisection(e_gas, c0, c1)
Evaluate first derivative of polynomial at argument e_gas.
subroutine diffuse_e_rad_mg(dtfactor, qdt, qtc, psa, psb)
Calling all subroutines to perform the multigrid method Communicates rad_e and diff_coeff to multigri...
subroutine, public fld_radforce_get_dt(w, ixil, ixol, dtnew, dxd, x)
get dt limit for radiation force: NOTE: only uniform cartesian here!
integer i_diff_mg
diffusion coefficient for multigrid method
subroutine fld_get_eddington(w, x, ixil, ixol, eddington_tensor, nth)
Calculate Eddington-tensor.
double precision dt_diff
running timestep for diffusion solver, initialised as zero
subroutine fld_implicit_update(dtfactor, qdt, qtc, psa, psb)
Module with basic grid data structures.
Module with geometry-related routines (e.g., divergence, curl)
subroutine gradient(q, ixil, ixol, idir, gradq, nth_in)
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 small_pressure
double precision unit_density
Physical scaling factor for density.
double precision unit_opacity
Physical scaling factor for Opacity.
integer, parameter unitpar
file handle for IO
double precision global_time
The global simulation time.
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer it
Number of time steps taken.
double precision unit_pressure
Physical scaling factor for pressure.
integer, parameter ndim
Number of spatial dimensions for grid variables.
character(len=std_len), dimension(:), allocatable par_files
Which par files are used as input.
integer mype
The rank of the current MPI task.
double precision, dimension(:), allocatable, parameter d
double precision courantpar
The Courant (CFL) number used for the simulation.
integer ixm
the mesh range of a physical block without ghost cells
double precision unit_velocity
Physical scaling factor for velocity.
logical time_advance
do time evolving
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
double precision unit_temperature
Physical scaling factor for temperature.
double precision, dimension(:,:), allocatable dx
spatial steps for all dimensions at all levels
integer nghostcells
Number of ghost cells surrounding a grid.
double precision, dimension(^nd) dxlevel
store unstretched cell size of current level
logical use_multigrid
Use multigrid (only available in 2D and 3D)
double precision dtmin
Stop the simulation when the time step becomes smaller than this value.
Module to couple the octree-mg library to AMRVAC. This file uses the VACPP preprocessor,...
type(mg_t) mg
Data structure containing the multigrid tree.
subroutine mg_copy_to_tree(iw_from, iw_to, restrict, restrict_gc, factor, state_from)
Copy a variable to the multigrid tree, including a layer of ghost cells.
subroutine mg_copy_from_tree_gc(iw_from, iw_to, state_to)
Copy from multigrid tree with one layer of ghost cells. Corner ghost cells are not used/set.
This module reads in Rosseland-mean opacities from OPAL tables. Table opacity values are given in bas...
subroutine, public init_opal_table(tabledir, set_custom_tabledir)
This subroutine is called when the FLD radiation module is initialised. The OPAL tables for different...
subroutine, public set_opal_opacity(rho, temp, kappa)
This subroutine calculates the opacity for a given temperature-density structure. Opacities are read ...
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_get_tgas), pointer phys_get_tgas
procedure(sub_evaluate_implicit), pointer phys_evaluate_implicit
procedure(sub_implicit_update), pointer phys_implicit_update
Module with all the methods that users can customize in AMRVAC.
procedure(special_opacity), pointer usr_special_opacity
procedure(special_diffcoef), pointer usr_special_diffcoef
procedure(special_fluxlimiter), pointer usr_special_fluxlimiter
procedure(special_opacity_qdot), pointer usr_special_opacity_qdot
integer function var_set_extravar(name_cons, name_prim, ix)
Set extra variable in w, which is not advected and has no boundary conditions. This has to be done af...
The data structure that contains information about a tree node/grid block.