20 double precision,
public ::
fld_mu = 0.6d0
63 integer,
allocatable,
public ::
i_opf(:)
66 double precision,
private,
protected :: fld_gamma
92 character(len=*),
intent(in) :: files(:)
101 do n = 1,
size(files)
102 open(
unitpar, file=trim(files(n)), status=
"old")
103 read(
unitpar, fld_list,
end=111)
116 subroutine fld_init(He_abundance, rhd_radiation_diffusion, rhd_gamma)
123 double precision,
intent(in) :: he_abundance, rhd_gamma
124 logical,
intent(in) :: rhd_radiation_diffusion
125 double precision :: sigma_thomson
128 character(len=1) :: ind_1
129 character(len=1) :: ind_2
130 character(len=2) :: cmp_f
131 character(len=5) :: cmp_e
140 write(ind_1,
'(I1)') idir
146 if (rhd_radiation_diffusion)
then
155 mg%operator_type = mg_vhelmholtz
163 fld_mu = (1.+4*he_abundance)/(2.+3.*he_abundance)
166 fld_gamma = rhd_gamma
171 sigma_thomson = 6.6524585
d-25
172 fld_kappa0 = sigma_thomson/const_mp * (1.+2.*he_abundance)/(1.+4.*he_abundance)
179 energy,qsourcesplit,active)
185 integer,
intent(in) :: ixi^
l, ixo^
l
186 double precision,
intent(in) :: qdt, x(ixi^s,1:
ndim)
187 double precision,
intent(in) :: wct(ixi^s,1:nw)
188 double precision,
intent(inout) :: w(ixi^s,1:nw)
189 logical,
intent(in) :: energy,qsourcesplit
190 logical,
intent(inout) :: active
192 double precision :: radiation_forcect(ixo^s,1:
ndim)
193 double precision :: kappact(ixo^s)
194 double precision :: rad_fluxct(ixo^s,1:
ndim)
196 double precision :: div_v(ixi^s,1:
ndim,1:
ndim)
197 double precision :: edd(ixo^s,1:
ndim,1:
ndim)
198 double precision :: nabla_vp(ixo^s)
199 double precision :: vel(ixi^s), grad_v(ixi^s), grad0_v(ixo^s)
200 double precision :: grad_e(ixo^s)
202 integer :: idir, jdir
204 double precision :: fld_r(ixo^s), lambda(ixo^s)
222 w(ixo^s,iw_mom(idir)) = w(ixo^s,iw_mom(idir)) &
223 + qdt * wct(ixo^s,iw_rho)*radiation_forcect(ixo^s,idir)
229 w(ixo^s,iw_e) = w(ixo^s,iw_e) &
230 + qdt * wct(ixo^s,iw_mom(idir))*radiation_forcect(ixo^s,idir)
241 vel(ixi^s) = wct(ixi^s,iw_mom(jdir))/wct(ixi^s,iw_rho)
244 div_v(ixo^s,idir,jdir) = grad_v(ixo^s)
256 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
261 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
262 + div_v(ixo^s,1,2)*edd(ixo^s,1,2) &
263 + div_v(ixo^s,2,1)*edd(ixo^s,2,1) &
264 + div_v(ixo^s,2,2)*edd(ixo^s,2,2)
268 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
269 + div_v(ixo^s,1,2)*edd(ixo^s,1,2) &
270 + div_v(ixo^s,1,3)*edd(ixo^s,1,3) &
271 + div_v(ixo^s,2,1)*edd(ixo^s,2,1) &
272 + div_v(ixo^s,2,2)*edd(ixo^s,2,2) &
273 + div_v(ixo^s,2,3)*edd(ixo^s,2,3) &
274 + div_v(ixo^s,3,1)*edd(ixo^s,3,1) &
275 + div_v(ixo^s,3,2)*edd(ixo^s,3,2) &
276 + div_v(ixo^s,3,3)*edd(ixo^s,3,3)
279 w(ixo^s,iw_r_e) = w(ixo^s,iw_r_e) &
280 - qdt * nabla_vp(ixo^s)*wct(ixo^s,iw_r_e)
291 integer,
intent(in) :: ixi^
l, ixo^
l
292 double precision,
intent(in) ::
dx^
d, x(ixi^s,1:
ndim), w(ixi^s,1:nw)
293 double precision,
intent(inout) :: dtnew
295 double precision :: radiation_force(ixo^s,1:
ndim)
296 double precision :: rad_flux(ixo^s,1:
ndim)
297 double precision :: kappa(ixo^s)
298 double precision :: dxinv(1:
ndim), max_grad
301 ^
d&dxinv(^
d)=one/
dx^
d;
307 radiation_force(ixo^s,idim) = w(ixo^s,iw_rho)*kappa(ixo^s)*rad_flux(ixo^s,idim)/(const_c/
unit_velocity)
308 max_grad = maxval(abs(radiation_force(ixo^s,idim)))
309 max_grad = max(max_grad, epsilon(1.0d0))
310 dtnew = min(dtnew,
courantpar / sqrt(max_grad * dxinv(idim)))
318 energy,qsourcesplit,active)
325 integer,
intent(in) :: ixi^
l, ixo^
l
326 double precision,
intent(in) :: qdt, x(ixi^s,1:
ndim)
327 double precision,
intent(in) :: wct(ixi^s,1:nw)
328 double precision,
intent(inout) :: w(ixi^s,1:nw)
329 logical,
intent(in) :: energy,qsourcesplit
330 logical,
intent(inout) :: active
349 integer,
intent(in) :: ixi^
l, ixo^
l
350 double precision,
intent(in) :: w(ixi^s, 1:nw)
351 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
352 double precision,
intent(out) :: fld_kappa(ixo^s)
353 double precision :: temp(ixi^s), pth(ixi^s), a2(ixo^s)
354 double precision :: rho0,temp0,n,sigma_b
355 double precision :: akram, bkram
356 double precision :: vth(ixo^s), gradv(ixi^s), eta(ixo^s), t(ixo^s)
358 integer :: i,j,ix^
d, idir
376 call phys_get_pthermal(w,x,ixi^
l,ixo^
l,temp)
377 temp(ixo^s)=temp(ixo^s)/w(ixo^s,iw_rho)
384 call phys_get_pthermal(w,x,ixi^
l,ixo^
l,pth)
387 akram = 13.1351597305
388 bkram = -4.5182188206
391 * (1.d0+10.d0**akram*w(ixo^s,iw_rho)*
unit_density*(a2(ixo^s)/1.d12)**bkram)
393 {
do ix^
d=ixomin^
d,ixomax^
d\ }
405 {
do ix^
d=ixomin^
d,ixomax^
d\ }
414 call mpistop(
"special opacity not defined")
419 call mpistop(
"Doesn't know opacity law")
432 integer,
intent(in) :: ixi^
l, ixo^
l
433 double precision,
intent(in) :: w(ixi^s, 1:nw)
434 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
435 double precision,
intent(out) :: fld_r(ixo^s), fld_lambda(ixo^s)
436 double precision :: kappa(ixo^s)
437 double precision :: normgrad2(ixo^s)
438 double precision :: grad_r_e(ixi^s), grad_r_eo(ixo^s)
439 double precision :: rad_e(ixi^s)
440 integer :: idir, ix^
d
442 double precision :: tmp_l(ixi^s), filtered_l(ixi^s)
443 integer :: filter, idim
447 fld_lambda(ixo^s) = 1.d0/3.d0
453 normgrad2(ixo^s) = 0.d0
455 rad_e(ixi^s) = w(ixi^s, iw_r_e)
458 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_eo(ixo^s)**2
466 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
469 fld_lambda(ixo^s) = one/fld_r(ixo^s)
474 normgrad2(ixo^s) = 0.d0
476 rad_e(ixi^s) = w(ixi^s, iw_r_e)
479 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_eo(ixo^s)**2
487 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
491 fld_lambda(ixo^s) = (2.d0+fld_r(ixo^s))/(6.d0+3*fld_r(ixo^s)+fld_r(ixo^s)**2.d0)
494 call mpistop(
"Pomraning2 is not quite working, use Pomraning or Minerbo")
497 normgrad2(ixo^s) = 0.d0
499 rad_e(ixi^s) = w(ixi^s, iw_r_e)
502 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_eo(ixo^s)**2
510 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
514 fld_lambda(ixo^s) = one/fld_r(ixo^s)*(one/dtanh(fld_r(ixo^s)) - one/fld_r(ixo^s))
518 where(dtanh(fld_r(ixo^s)) .ne. dtanh(fld_r(ixo^s)))
519 fld_lambda(ixo^s) = 1.d0/3.d0
525 normgrad2(ixo^s) = 0.d0
527 rad_e(ixi^s) = w(ixi^s, iw_r_e)
530 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_eo(ixo^s)**2
538 fld_r(ixo^s) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
542 {
do ix^
d=ixomin^
d,ixomax^
d\ }
543 if (fld_r(ix^
d) .lt. 3.d0/2.d0)
then
544 fld_lambda(ix^
d) = 2.d0/(3.d0 + dsqrt(9.d0 + 12.d0*fld_r(ix^
d)**2.d0))
546 fld_lambda(ix^
d) = 1.d0/(1.d0 + fld_r(ix^
d) + dsqrt(1.d0 + 2.d0*fld_r(ix^
d)))
552 call mpistop(
"special fluxlimiter not defined")
556 call mpistop(
'Fluxlimiter unknown')
564 tmp_l(ixo^s) = fld_lambda(ixo^s)
565 filtered_l(ixo^s) = zero
570 filtered_l(ix^
d) = filtered_l(ix^
d) &
571 + tmp_l(ix^
d+filter*
kr(idim,^
d)) &
572 + tmp_l(ix^
d-filter*
kr(idim,^
d))
581 fld_lambda(ixo^s) = tmp_l(ixo^s)
592 integer,
intent(in) :: ixi^
l, ixo^
l
593 double precision,
intent(in) :: w(ixi^s, 1:nw)
594 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
595 double precision,
intent(out) :: rad_flux(ixo^s, 1:
ndim)
597 double precision :: grad_r_e(ixi^s), grad_r_eo(ixo^s)
598 double precision :: rad_e(ixi^s)
599 double precision :: kappa(ixo^s), lambda(ixo^s), fld_r(ixo^s)
600 integer :: ix^
d, idir
602 rad_e(ixi^s) = w(ixi^s, iw_r_e)
611 rad_flux(ixo^s, idir) = -(const_c/
unit_velocity)*lambda(ixo^s)/(kappa(ixo^s)*w(ixo^s,iw_rho))*grad_r_eo(ixo^s)
625 integer,
intent(in) :: ixI^L, ixO^L
626 double precision,
intent(in) :: w(ixI^S, 1:nw)
627 double precision,
intent(in) :: x(ixI^S, 1:ndim)
628 double precision,
intent(out) :: eddington_tensor(ixO^S,1:ndim,1:ndim)
629 double precision :: tnsr2(ixO^S,1:ndim,1:ndim)
630 double precision :: normgrad2(ixO^S), f(ixO^S)
631 double precision :: grad_r_e(ixI^S, 1:ndim), rad_e(ixI^S)
632 double precision :: grad_r_eO(ixO^S, 1:ndim)
633 double precision :: lambda(ixO^S), fld_R(ixO^S)
634 integer :: i,j, idir,jdir
638 normgrad2(ixo^s) = zero
640 rad_e(ixi^s) = w(ixi^s, iw_r_e)
643 normgrad2(ixo^s) = normgrad2(ixo^s) + grad_r_eo(ixo^s,idir)**2
653 f(ixo^s) = lambda(ixo^s) + lambda(ixo^s)**two * fld_r(ixo^s)**two
654 f(ixo^s) = one/two*(one-f(ixo^s)) + one/two*(3.d0*f(ixo^s) - one)
657 eddington_tensor(ixo^s,1,1) = f(ixo^s)
662 eddington_tensor(ixo^s,idir,idir) = half*(one-f(ixo^s))
667 if (idir .ne. jdir) eddington_tensor(ixo^s,idir,jdir) = zero
668 tnsr2(ixo^s,idir,jdir) = half*(3.d0*f(ixo^s) - 1)&
669 *grad_r_eo(ixo^s,idir)*grad_r_eo(ixo^s,jdir)/normgrad2(ixo^s)
683 where ((tnsr2(ixo^s,idir,jdir) .eq. tnsr2(ixo^s,idir,jdir)) &
684 .and. (normgrad2(ixo^s) .gt. smalldouble))
685 eddington_tensor(ixo^s,idir,jdir) = eddington_tensor(ixo^s,idir,jdir) + tnsr2(ixo^s,idir,jdir)
698 integer,
intent(in) :: ixi^
l, ixo^
l
699 double precision,
intent(in) :: w(ixi^s, 1:nw)
700 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
701 double precision :: eddington_tensor(ixo^s,1:
ndim,1:
ndim)
702 double precision,
intent(out):: rad_pressure(ixo^s,1:
ndim,1:
ndim)
710 rad_pressure(ixo^s,i,j) = eddington_tensor(ixo^s,i,j)* w(ixo^s,iw_r_e)
728 type(state),
target :: psa(max_blocks)
729 type(state),
target :: psb(max_blocks)
730 double precision,
intent(in) :: qdt
731 double precision,
intent(in) :: qtC
732 double precision,
intent(in) :: dtfactor
735 double precision :: res, max_residual, lambda
736 integer,
parameter :: max_its = 100
738 integer :: iw_to,iw_from
739 integer :: iigrid, igrid, id
740 integer :: nc, lvl, i
742 real(dp) :: fac, facD
752 if (qdt <
dtmin)
then
754 print *,
'skipping implicit solve: dt too small!'
762 mg%operator_type = mg_vhelmholtz
763 mg%smoother_type = mg_smoother_gs
764 call mg_set_methods(
mg)
766 if (.not.
mg%is_allocated)
call mpistop(
"multigrid tree not allocated yet")
769 lambda = 1.d0/(dtfactor *
dt_diff)
770 call vhelmholtz_set_lambda(lambda)
874 call mg_restrict(
mg, mg_iveps)
875 call mg_fill_ghost_cells(
mg, mg_iveps)
881 call mg_fas_fmg(
mg, .true., max_res=res)
884 if (res < max_residual)
exit
885 call mg_fas_vcycle(
mg, max_res=res)
891 if (res .le. 0.d0)
then
893 if (
mg%my_rank == 0) &
894 write(*,*)
it,
' resiudal zero ', res
897 if (
mg%my_rank == 0)
then
899 error stop
"Diffusion residual to zero"
906 if (n == max_its + 1)
then
908 if (
mg%my_rank == 0) &
909 write(*,*)
it,
' resiudal high ', res
912 if (
mg%my_rank == 0)
then
913 print *,
"Did you specify boundary conditions correctly?"
914 print *,
"Or is the variation in diffusion too large?"
916 print *,
mg%bc(1, mg_iphi)%bc_value,
mg%bc(2, mg_iphi)%bc_value
918 error stop
"diffusion_solve: no convergence"
967 type(state),
target :: psa(max_blocks)
968 double precision,
intent(in) :: qtC
970 integer :: iigrid, igrid, level
977 do iigrid=1,igridstail; igrid=igrids(iigrid);
992 integer,
intent(in) :: ixI^L, ixO^L
993 double precision,
intent(inout) :: w(ixI^S, 1:nw)
995 double precision :: gradE(ixO^S),divF(ixO^S)
996 double precision :: divF_h(ixO^S),divF_j(ixO^S)
997 double precision :: diff_term(ixO^S)
999 integer :: idir, jxO^L, hxO^L
1005 hxo^l=ixo^l-
kr(idir,^
d);
1006 jxo^l=ixo^l+
kr(idir,^
d);
1010 divf(ixo^s) = divf(ixo^s) + 2.d0*(divf_h(ixo^s) + divf_j(ixo^s))/
dxlevel(idir)**2
1013 w(ixo^s,iw_r_e) = divf(ixo^s)
1024 integer,
intent(in) :: ixI^L, ixO^L
1025 double precision,
intent(inout) :: w(ixI^S, 1:nw)
1026 double precision,
intent(in) :: wCT(ixI^S, 1:nw)
1027 double precision,
intent(in) :: x(ixI^S, 1:ndim)
1029 double precision :: kappa(ixO^S), lambda(ixO^S), fld_R(ixO^S)
1031 double precision :: max_D(ixI^S), grad_r_e(ixI^S), rad_e(ixI^S)
1032 integer :: idir,i,j, ix^D
1057 type(state),
target :: psa(max_blocks)
1060 integer :: iigrid, igrid, level
1065 do iigrid=1,igridstail; igrid=igrids(iigrid);
1079 integer,
intent(in) :: ixI^L, ixO^L
1080 double precision,
intent(inout) :: w(ixI^S, 1:nw)
1082 double precision :: tmp_D(ixI^S), filtered_D(ixI^S)
1083 integer :: ix^D, filter, idim
1089 filtered_d(ixo^s) = zero
1094 filtered_d(ix^d) = filtered_d(ix^d) &
1095 + tmp_d(ix^d+filter*
kr(idim,^d)) &
1096 + tmp_d(ix^d-filter*
kr(idim,^d))
1124 integer,
intent(in) :: ixI^L, ixO^L
1125 double precision,
intent(in) :: x(ixI^S,1:ndim)
1126 double precision,
intent(in) :: wCT(ixI^S,1:nw)
1127 double precision,
intent(inout) :: w(ixI^S,1:nw)
1129 double precision :: a1(ixO^S), a2(ixO^S)
1130 double precision :: c0(ixO^S), c1(ixO^S)
1131 double precision :: e_gas(ixO^S), E_rad(ixO^S)
1132 double precision :: kappa(ixO^S)
1133 double precision :: sigma_b
1135 integer :: i,j,idir,ix^D
1139 e_gas(ixo^s) = wct(ixo^s,iw_e) - half*sum(wct(ixo^s, iw_mom(:))**2, dim=ndim+1)/wct(ixo^s, iw_rho)
1144 {
do ix^d=ixomin^d,ixomax^d\ }
1148 e_rad(ixo^s) = wct(ixo^s,iw_r_e)
1159 a1(ixo^s) = const_rad_a*(
fld_mu*const_mp/const_kb*(fld_gamma-1))**4/(wct(ixo^s,iw_rho)*
unit_density)**4 &
1161 a2(ixo^s) = e_gas(ixo^s) + e_rad(ixo^s)
1163 c0(ixo^s) = a2(ixo^s)/a1(ixo^s)
1164 c1(ixo^s) = 1.d0/a1(ixo^s)
1167 a1(ixo^s) = 4*kappa(ixo^s)*sigma_b*(fld_gamma-one)**4/wct(ixo^s,iw_rho)**3*
dt
1170 c0(ixo^s) = ((one + a2(ixo^s))*e_gas(ixo^s) + a2(ixo^s)*e_rad(ixo^s))/a1(ixo^s)
1171 c1(ixo^s) = (one + a2(ixo^s))/a1(ixo^s)
1175 {
do ix^d=ixomin^d,ixomax^d\ }
1180 call newton_method(e_gas(ix^d), e_rad(ix^d), c0(ix^d), c1(ix^d))
1182 call halley_method(e_gas(ix^d), e_rad(ix^d), c0(ix^d), c1(ix^d))
1184 call halley_method(e_gas(ix^d), e_rad(ix^d), c0(ix^d), c1(ix^d))
1186 call mpistop(
'root-method not known')
1191 e_rad(ixo^s) = a2(ixo^s) - e_gas(ixo^s)
1194 e_rad(ixo^s) = (a1(ixo^s)*e_gas(ixo^s)**4.d0 + e_rad(ixo^s))/(one + a2(ixo^s))
1218 w(ixo^s,iw_e) = e_gas(ixo^s)
1223 w(ixo^s,iw_e) = w(ixo^s,iw_e) + half*sum(wct(ixo^s, iw_mom(:))**2, dim=ndim+1)/wct(ixo^s, iw_rho)
1230 w(ixo^s,iw_r_e) = e_rad(ixo^s)
1239 double precision,
intent(in) :: c0, c1
1240 double precision,
intent(in) :: E_rad
1241 double precision,
intent(inout) :: e_gas
1243 double precision :: bisect_a, bisect_b, bisect_c
1244 integer :: n, max_its
1250 bisect_b = min(abs(c0/c1),abs(c0)**(1.d0/4.d0))+smalldouble
1254 do while (abs(bisect_b-bisect_a) .ge.
fld_bisect_tol*min(e_gas,e_rad))
1255 bisect_c = (bisect_a + bisect_b)/two
1258 if (n .gt. max_its)
then
1260 call mpistop(
'No convergece in bisection scheme')
1285 call mpistop(
"Problem with fld bisection method")
1293 print*,
"IGNORING GAS-RAD ENERGY EXCHANGE ", c0, c1
1308 2435 e_gas = (bisect_a + bisect_b)/two
1315 double precision,
intent(in) :: c0, c1
1316 double precision,
intent(in) :: E_rad
1317 double precision,
intent(inout) :: e_gas
1319 double precision :: xval, yval, der, deltax
1334 xval = xval + deltax
1336 if (ii .gt. 1d3)
then
1337 print*,
'skip to bisection algorithm'
1350 double precision,
intent(in) :: c0, c1
1351 double precision,
intent(in) :: E_rad
1352 double precision,
intent(inout) :: e_gas
1354 double precision :: xval, yval, der, dder, deltax
1370 deltax = -two*yval*der/(two*der**2 - yval*dder)
1371 xval = xval + deltax
1373 if (ii .gt. 1d3)
then
1387 double precision,
intent(in) :: e_gas
1388 double precision,
intent(in) :: c0, c1
1389 double precision :: val
1391 val = e_gas**4.d0 + c1*e_gas - c0
1398 double precision,
intent(in) :: e_gas
1399 double precision,
intent(in) :: c0, c1
1400 double precision :: der
1402 der = 4.d0*e_gas**3.d0 + c1
1409 double precision,
intent(in) :: e_gas
1410 double precision,
intent(in) :: c0, c1
1411 double precision :: dder
1413 dder = 4.d0*3.d0*e_gas**2.d0
1421 integer,
intent(in) :: ixI^L, ixO^L, idir
1422 integer,
intent(in) :: n
1424 double precision,
intent(in) :: q(ixI^S), x(ixI^S,1:ndim)
1425 double precision,
intent(out) :: gradq(ixO^S)
1426 integer :: jxO^L, hxO^L
1440 call mpistop(
"gradientO stencil too wide")
1441 elseif (n .eq. 1)
then
1442 hxo^l=ixo^l-
kr(idir,^
d);
1443 jxo^l=ixo^l+
kr(idir,^
d);
1444 gradq(ixo^s)=(q(jxo^s)-q(hxo^s))/(x(jxo^s,idir)-x(hxo^s,idir))
1445 elseif (n .eq. 2)
then
1448 hxo^l=ixo^l-
kr(idir,^
d);
1449 jxo^l=ixo^l+
kr(idir,^
d);
1450 gradq(ixo^s) = gradq(ixo^s) + 2.d0/3.d0*(q(jxo^s)-q(hxo^s))
1452 hxo^l=ixo^l-2*
kr(idir,^
d);
1453 jxo^l=ixo^l+2*
kr(idir,^
d);
1454 gradq(ixo^s) = gradq(ixo^s) - 1.d0/12.d0*(q(jxo^s)-q(hxo^s))
1456 gradq(ixo^s) = gradq(ixo^s)/
dxlevel(idir)
1457 elseif (n .eq. 3)
then
1460 hxo^l=ixo^l-
kr(idir,^
d);
1461 jxo^l=ixo^l+
kr(idir,^
d);
1462 gradq(ixo^s) = gradq(ixo^s) + 3.d0/4.d0*(q(jxo^s)-q(hxo^s))
1464 hxo^l=ixo^l-2*
kr(idir,^
d);
1465 jxo^l=ixo^l+2*
kr(idir,^
d);
1466 gradq(ixo^s) = gradq(ixo^s) - 3.d0/20.d0*(q(jxo^s)-q(hxo^s))
1468 hxo^l=ixo^l-3*
kr(idir,^
d);
1469 jxo^l=ixo^l+3*
kr(idir,^
d);
1470 gradq(ixo^s) = gradq(ixo^s) + 1.d0/60.d0*(q(jxo^s)-q(hxo^s))
1472 gradq(ixo^s) = gradq(ixo^s)/
dxlevel(idir)
1474 call mpistop(
"gradientO stencil unknown")
subroutine mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for physical and numeric constants.
double precision, parameter const_c
Nicolas Moens Module for including flux limited diffusion (FLD)-approximation in Radiation-hydrodynam...
subroutine energy_interaction(w, wCT, x, ixIL, ixOL)
This subroutine calculates the radiation heating, radiation cooling and photon tiring using an implic...
subroutine gradiento(q, x, ixIL, ixOL, idir, gradq, n)
Calculate gradient of a scalar q within ixL in direction idir difference with gradient is gradq(ixO^S...
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...
double precision, public fld_diff_tol
Tolerance for adi method for radiative Energy diffusion.
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 fld_smooth_diffcoef(w, ixIL, ixOL)
Use running average on Diffusion coefficient.
subroutine, public fld_radforce_get_dt(w, ixIL, ixOL, dtnew, dxD, x)
subroutine fld_params_read(files)
public methods these are called in mod_rhd_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
Use constant Opacity?
subroutine fld_get_eddington(w, x, ixIL, ixOL, eddington_tensor)
Calculate Eddington-tensor Stores Eddington-tensor in w-array.
double precision function ddpolynomial_bisection(e_gas, c0, c1)
Evaluate second derivative of polynomial at argument e_gas.
subroutine, public fld_get_radflux(w, x, ixIL, ixOL, rad_flux)
Calculate Radiation Flux stores radiation flux in w-array.
character(len=16) fld_fluxlimiter
Diffusion limit lambda = 0.33.
subroutine halley_method(e_gas, E_rad, c0, c1)
Find the root of the 4th degree polynomial using the Halley method.
subroutine put_diffterm_onegrid(ixIL, ixOL, w)
inplace update of psa==>F_im(psa)
double precision, public fld_kappa0
Opacity per unit of unit_density.
character(len=8) fld_diff_scheme
Which method to solve diffusion part.
logical lineforce_opacities
Use or dont use lineforce opacities.
subroutine, public get_fld_rad_force(qdt, ixIL, ixOL, wCT, 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...
double precision function polynomial_bisection(e_gas, c0, c1)
Evaluate polynomial at argument e_gas.
logical fld_eint_split
source split for energy interact and radforce:
character(len=8) fld_interaction_method
Which method to find the root for the energy interaction polynomial.
subroutine, public fld_get_radpress(w, x, ixIL, ixOL, rad_pressure)
Calculate Radiation Pressure Returns Radiation Pressure as tensor.
logical fld_radforce_split
subroutine, public fld_init(He_abundance, rhd_radiation_diffusion, rhd_gamma)
Initialising FLD-module: Read opacities Initialise Multigrid adimensionalise kappa Add extra variable...
double precision function dpolynomial_bisection(e_gas, c0, c1)
Evaluate first derivative of polynomial at argument e_gas.
subroutine, public fld_get_opacity(w, x, ixIL, ixOL, fld_kappa)
Sets the opacity in the w-array by calling mod_opal_opacity.
subroutine, public get_fld_energy_interact(qdt, ixIL, ixOL, wCT, 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...
integer i_diff_mg
diffusion coefficient for multigrid method
subroutine evaluate_e_rad_mg(qtC, psa)
inplace update of psa==>F_im(psa)
character(len=6) fld_opal_table
subroutine fld_get_diffcoef_central(w, wCT, x, ixIL, ixOL)
Calculates cell-centered diffusion coefficient to be used in multigrid.
subroutine bisection_method(e_gas, E_rad, c0, c1)
Find the root of the 4th degree polynomial using the bisection method.
logical flux_lim_filter
Take a running average over the fluxlimiter.
logical diff_coef_filter
Take running average for Diffusion coefficient.
subroutine, public fld_get_fluxlimiter(w, x, ixIL, ixOL, fld_lambda, fld_R)
Calculate fld flux limiter This subroutine calculates flux limiter lambda using the prescription stor...
double precision dt_diff
running timestep for diffusion solver, initialised as zero
double precision, public diff_crit
Number for splitting the diffusion module.
subroutine newton_method(e_gas, E_rad, c0, c1)
Find the root of the 4th degree polynomial using the Newton-Ralphson method.
Module with basic grid data structures.
Module with geometry-related routines (e.g., divergence, curl)
subroutine gradient(q, ixIL, ixOL, idir, gradq)
Calculate gradient of a scalar q within ixL in direction idir.
update ghost cells of all blocks including physical boundaries
subroutine getbc(time, qdt, psb, nwstart, nwbc, req_diag)
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.
integer, dimension(:), allocatable, parameter d
double precision courantpar
The Courant (CFL) number used for the simulation.
double precision unit_velocity
Physical scaling factor for velocity.
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
double precision unit_temperature
Physical scaling factor for temperature.
double precision, dimension(:,:), allocatable dx
integer nghostcells
Number of ghost cells surrounding a grid.
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.
double precision, dimension(ndim) dxlevel
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 opacities from opal tables.
subroutine, public set_opal_opacity(rho, temp, kappa)
This subroutine calculates the opacity for a given temperature-density structure. The opacities are r...
subroutine, public init_opal(He_abundance, tablename)
This routine is called when the fld radiation module is initialised. Here, the tables for different H...
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
logical phys_req_diagonal
Whether the physics routines require diagonal ghost cells, for example for computing a curl.
procedure(sub_get_pthermal), pointer phys_get_pthermal
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.