18 double precision,
public ::
afld_mu = 0.6d0
48 double precision,
private,
protected :: afld_gamma
67 character(len=*),
intent(in) :: files(:)
77 open(
unitpar, file=trim(files(n)), status=
"old")
78 read(
unitpar, fld_list,
end=111)
96 double precision,
intent(in) :: he_abundance, afld_gamma
97 double precision :: sigma_thomson
99 character(len=1) :: ind_1
100 character(len=1) :: ind_2
101 character(len=2) :: cmp_f
102 character(len=5) :: cmp_e
115 mg%operator_type = mg_ahelmholtz
118 write(ind_1,
'(I1)') idir
123 afld_mu = (1.+4*he_abundance)/(2.+3.*he_abundance)
129 energy,qsourcesplit,active)
134 integer,
intent(in) :: ixi^
l, ixo^
l
135 double precision,
intent(in) :: qdt, x(ixi^s,1:
ndim)
136 double precision,
intent(in) :: wct(ixi^s,1:nw)
137 double precision,
intent(inout) :: w(ixi^s,1:nw)
138 logical,
intent(in) :: energy,qsourcesplit
139 logical,
intent(inout) :: active
140 double precision :: radiation_forcect(ixo^s,1:
ndim)
141 double precision :: kappact(ixo^s,1:
ndim)
142 double precision :: rad_fluxct(ixo^s,1:
ndim)
143 double precision :: div_v(ixi^s,1:
ndim,1:
ndim)
144 double precision :: edd(ixo^s,1:
ndim,1:
ndim)
145 double precision :: nabla_vp(ixo^s)
146 double precision :: vel(ixi^s), grad_v(ixi^s), grad0_v(ixo^s)
147 double precision :: grad_e(ixi^s)
148 integer :: idir, jdir
149 double precision :: afld_r(ixo^s,1:
ndim), lambda(ixo^s,1:
ndim)
158 radiation_forcect(ixo^s,idir) = -lambda(ixo^s,idir)*grad_e(ixo^s)
160 w(ixo^s,iw_mom(idir)) = w(ixo^s,iw_mom(idir)) &
161 + qdt*radiation_forcect(ixo^s,idir)
163 w(ixo^s,iw_e) = w(ixo^s,iw_e) &
164 + qdt*wct(ixo^s,iw_mom(idir))/wct(ixo^s,iw_rho)*radiation_forcect(ixo^s,idir)
171 vel(ixi^s) = wct(ixi^s,iw_mom(jdir))/wct(ixi^s,iw_rho)
173 div_v(ixo^s,idir,jdir) = grad_v(ixo^s)
180 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1)
184 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
185 + div_v(ixo^s,1,2)*edd(ixo^s,1,2) &
186 + div_v(ixo^s,2,1)*edd(ixo^s,2,1) &
187 + div_v(ixo^s,2,2)*edd(ixo^s,2,2)
190 nabla_vp(ixo^s) = div_v(ixo^s,1,1)*edd(ixo^s,1,1) &
191 + div_v(ixo^s,1,2)*edd(ixo^s,1,2) &
192 + div_v(ixo^s,1,3)*edd(ixo^s,1,3) &
193 + div_v(ixo^s,2,1)*edd(ixo^s,2,1) &
194 + div_v(ixo^s,2,2)*edd(ixo^s,2,2) &
195 + div_v(ixo^s,2,3)*edd(ixo^s,2,3) &
196 + div_v(ixo^s,3,1)*edd(ixo^s,3,1) &
197 + div_v(ixo^s,3,2)*edd(ixo^s,3,2) &
198 + div_v(ixo^s,3,3)*edd(ixo^s,3,3)
200 w(ixo^s,iw_r_e) = w(ixo^s,iw_r_e) &
201 - qdt * nabla_vp(ixo^s)*wct(ixo^s,iw_r_e)
209 integer,
intent(in) :: ixi^
l, ixo^
l
210 double precision,
intent(in) ::
dx^
d, x(ixi^s,1:
ndim), w(ixi^s,1:nw)
211 double precision,
intent(inout) :: dtnew
213 double precision :: radiation_force(ixo^s,1:
ndim)
214 double precision :: lambda(ixo^s,1:
ndim), grad_e(ixi^s)
215 double precision :: dxinv(1:
ndim), afld_r(ixo^s,1:
ndim)
216 double precision :: max_grad
218 ^
d&dxinv(^
d)=one/
dx^
d;
222 radiation_force(ixo^s,idir) = -lambda(ixo^s,idir)*grad_e(ixo^s)
223 max_grad = maxval(abs(radiation_force(ixo^s,idir)))
224 max_grad = max(max_grad, epsilon(1.0d0))
225 dtnew = min(dtnew,
courantpar/sqrt(max_grad*dxinv(idir)))
232 energy,qsourcesplit,active)
237 integer,
intent(in) :: ixi^
l, ixo^
l
238 double precision,
intent(in) :: qdt, x(ixi^s,1:
ndim)
239 double precision,
intent(in) :: wct(ixi^s,1:nw)
240 double precision,
intent(inout) :: w(ixi^s,1:nw)
241 logical,
intent(in) :: energy,qsourcesplit
242 logical,
intent(inout) :: active
260 integer,
intent(in) :: ixi^
l, ixo^
l
261 double precision,
intent(in) :: w(ixi^s, 1:nw)
262 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
263 double precision,
intent(out) :: fld_kappa(ixo^s,1:
ndim)
264 integer :: i,j,ix^
d, idir
265 double precision :: temp(ixi^s), pth(ixi^s), a2(ixo^s)
266 double precision :: rho0,temp0,n,sigma_b
267 double precision :: akram, bkram
268 double precision :: vth(ixo^s), gradv(ixi^s), eta(ixo^s), t(ixo^s)
284 fld_kappa(ixo^s,idir) =
fld_kappa0/
unit_opacity*(one + n*dexp(-one/sigma_b*(dlog(w(ixo^s,iw_rho)/rho0))**two))
287 temp(ixo^s) = temp(ixo^s)/w(ixo^s,iw_rho)
295 akram = 13.1351597305d0
296 bkram = -4.5182188206d0
298 * (1.d0+10.d0**akram*w(ixo^s,iw_rho)*
unit_density*(a2(ixo^s)/1.d12)**bkram)
299 {
do ix^
d=ixomin^
d,ixomax^
d\ }
305 {
do ix^
d=ixomin^
d,ixomax^
d\ }
313 call mpistop(
"special opacity not defined")
317 call mpistop(
"Doesn't know opacity law")
330 integer,
intent(in) :: ixi^
l, ixo^
l, nth
331 double precision,
intent(in) :: w(ixi^s, 1:nw)
332 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
333 double precision,
intent(out) :: fld_r(ixo^s,1:
ndim), fld_lambda(ixo^s,1:
ndim)
334 integer :: idir, ix^
d
335 integer :: filter, idim
336 double precision :: kappa(ixo^s,1:
ndim)
337 double precision :: normgrad2(ixo^s)
338 double precision :: grad_r_e(ixi^s)
339 double precision :: rad_e(ixi^s)
340 double precision :: tmp_l(ixi^s), filtered_l(ixi^s)
344 fld_lambda(ixo^s,1:
ndim) = 1.d0/3.d0
345 fld_r(ixo^s,1:
ndim) = zero
349 rad_e(ixi^s) = w(ixi^s, iw_r_e)
352 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
353 normgrad2(ixo^s) = grad_r_e(ixo^s)**2
354 fld_r(ixo^s,idir) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s,idir)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
356 if(maxval(normgrad2(ixo^s))==0.0d0)
call mpistop(
"choose other fluxlimiter, FreeStream has issues")
358 fld_lambda(ixo^s,idir) = one/fld_r(ixo^s,idir)
363 normgrad2(ixo^s) = zero
364 rad_e(ixi^s) = w(ixi^s,iw_r_e)
367 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
368 normgrad2(ixo^s) = grad_r_e(ixo^s)**2
369 fld_r(ixo^s,idir) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s,idir)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
372 fld_lambda(ixo^s,idir) = (2.d0+fld_r(ixo^s,idir))/(6.d0+3*fld_r(ixo^s,idir)+fld_r(ixo^s,idir)**2.d0)
377 normgrad2(ixo^s) = zero
378 rad_e(ixi^s) = w(ixi^s,iw_r_e)
381 call gradient(rad_e,ixi^
l,ixo^
l,idir,grad_r_e,nth)
382 normgrad2(ixo^s) = grad_r_e(ixo^s)**2
383 fld_r(ixo^s,idir) = dsqrt(normgrad2(ixo^s))/(kappa(ixo^s,idir)*w(ixo^s,iw_rho)*w(ixo^s,iw_r_e))
386 {
do ix^
d=ixomin^
d,ixomax^
d\ }
387 if(fld_r(ix^
d,idir) .lt. 3.d0/2.d0)
then
388 fld_lambda(ix^
d,idir) = 2.d0/(3.d0 + dsqrt(9.d0 + 12.d0*fld_r(ix^
d,idir)**2.d0))
390 fld_lambda(ix^
d,idir) = 1.d0/(1.d0 + fld_r(ix^
d,idir) + dsqrt(1.d0 + 2.d0*fld_r(ix^
d,idir)))
396 call mpistop(
"special fluxlimiter not defined")
400 call mpistop(
'Fluxlimiter unknown')
404 if(
size_l_filter .lt. 1)
call mpistop(
"D filter of size < 1 makes no sense")
407 tmp_l(ixo^s) = fld_lambda(ixo^s,idir)
408 filtered_l(ixo^s) = zero
412 filtered_l(ix^
d) = filtered_l(ix^
d) &
413 + tmp_l(ix^
d+filter*
kr(idim,^
d)) &
414 + tmp_l(ix^
d-filter*
kr(idim,^
d))
422 fld_lambda(ixo^s,idir) = tmp_l(ixo^s)
432 integer,
intent(in) :: ixi^
l, ixo^
l, nth
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) :: rad_flux(ixo^s, 1:
ndim)
436 integer :: ix^
d, idir
437 double precision :: cc
438 double precision :: grad_r_e(ixi^s)
439 double precision :: rad_e(ixi^s)
440 double precision :: kappa(ixo^s,1:
ndim), lambda(ixo^s,1:
ndim), fld_r(ixo^s,1:
ndim)
443 rad_e(ixi^s) = w(ixi^s, iw_r_e)
448 rad_flux(ixo^s, idir) = -cc*lambda(ixo^s,idir)/(kappa(ixo^s,idir)*w(ixo^s,iw_rho))*grad_r_e(ixo^s)
457 integer,
intent(in) :: ixI^L, ixO^L, nth
458 double precision,
intent(in) :: w(ixI^S, 1:nw)
459 double precision,
intent(in) :: x(ixI^S, 1:ndim)
460 double precision,
intent(out) :: eddington_tensor(ixO^S,1:ndim,1:ndim)
461 double precision :: tnsr2(ixO^S,1:ndim,1:ndim)
462 double precision :: normgrad2(ixO^S), f(ixO^S,1:ndim)
463 double precision :: grad_r_e(ixI^S,1:ndim), rad_e(ixI^S)
464 double precision :: lambda(ixO^S,1:ndim), fld_R(ixO^S,1:ndim)
465 integer :: i,j, idir,jdir
470 normgrad2(ixo^s) = zero
471 rad_e(ixi^s) = w(ixi^s, iw_r_e)
473 call gradient(rad_e,ixi^l,ixo^l,idir,grad_r_e(ixi^s,idir),nth)
474 normgrad2(ixo^s) = normgrad2(ixo^s)+grad_r_e(ixo^s,idir)**2
477 f(ixo^s,idir) = lambda(ixo^s,idir)+lambda(ixo^s,idir)**two*fld_r(ixo^s,idir)**two
478 f(ixo^s,idir) = half*(one-f(ixo^s,idir))+half*(3.d0*f(ixo^s,idir)-one)
482 eddington_tensor(ixo^s,1,1) = f(ixo^s,1)
486 eddington_tensor(ixo^s,idir,idir) = half*(one-f(ixo^s,idir))
490 if(idir .ne. jdir) eddington_tensor(ixo^s,idir,jdir) = zero
491 tnsr2(ixo^s,idir,jdir) = half*(3.d0*f(ixo^s,idir) - 1)&
492 * grad_r_e(ixo^s,idir)*grad_r_e(ixo^s,jdir)/max(normgrad2(ixo^s),smalldouble)
497 where(normgrad2(ixo^s) .gt. smalldouble)
498 eddington_tensor(ixo^s,idir,jdir) = eddington_tensor(ixo^s,idir,jdir)+tnsr2(ixo^s,idir,jdir)
509 integer,
intent(in) :: ixi^
l, ixo^
l, nth
510 double precision,
intent(in) :: w(ixi^s, 1:nw)
511 double precision,
intent(in) :: x(ixi^s, 1:
ndim)
512 double precision,
intent(out):: rad_pressure(ixo^s,1:
ndim,1:
ndim)
514 double precision :: eddington_tensor(ixo^s,1:
ndim,1:
ndim)
519 rad_pressure(ixo^s,i,j) = eddington_tensor(ixo^s,i,j)*w(ixo^s,iw_r_e)
532 type(state),
target :: psa(max_blocks)
533 type(state),
target :: psb(max_blocks)
534 double precision,
intent(in) :: qdt
535 double precision,
intent(in) :: qtC
536 double precision,
intent(in) :: dtfactor
537 integer,
parameter :: max_its = 50
539 integer :: iw_to,iw_from
540 integer :: iigrid, igrid, id
541 integer :: nc, lvl, i
543 double precision :: fac, facD
544 double precision :: res, max_residual, lambda
550 if (qdt <
dtmin)
then
552 print *,
'skipping implicit solve: dt too small!'
559 mg%operator_type = mg_ahelmholtz
560 mg%smoother_type = mg_smoother_gsrb
561 call mg_set_methods(
mg)
562 if (.not.
mg%is_allocated)
call mpistop(
"multigrid tree not allocated yet")
563 lambda = 1.d0/(dtfactor *
dt_diff)
564 call ahelmholtz_set_lambda(lambda)
572 call mg_restrict(
mg, mg_iveps)
573 call mg_fill_ghost_cells(
mg, mg_iveps)
580 call mg_restrict(
mg, mg_iveps1)
581 call mg_fill_ghost_cells(
mg, mg_iveps1)
583 call mg_restrict(
mg, mg_iveps2)
584 call mg_fill_ghost_cells(
mg, mg_iveps2)
592 call mg_fas_fmg(
mg, .true., max_res=res)
595 if (res < max_residual)
exit
596 call mg_fas_vcycle(
mg, max_res=res)
598 if (res .le. 0.d0)
then
600 if (
mg%my_rank == 0) &
601 write(*,*)
it,
' residual zero ', res
604 if (
mg%my_rank == 0)
then
606 error stop
"Diffusion residual to zero"
609 if(n == max_its + 1)
then
611 if(
mg%my_rank == 0) &
612 write(*,*)
it,
' residual high ', res
615 if(
mg%my_rank == 0)
then
616 print *,
"Did you specify boundary conditions correctly?"
617 print *,
"Or is the variation in diffusion too large?"
619 print *,
mg%bc(1, mg_iphi)%bc_value,
mg%bc(2, mg_iphi)%bc_value
621 error stop
"diffusion_solve: no convergence"
633 type(state),
target :: psa(max_blocks)
634 double precision,
intent(in) :: qtC
635 integer :: iigrid, igrid, level
641 do iigrid=1,igridstail; igrid=igrids(iigrid);
648 call getbc(qtc,0.d0,psa,1,nwflux+nwaux)
654 integer,
intent(in) :: ixI^L, ixO^L
655 double precision,
intent(inout) :: w(ixI^S, 1:nw)
656 double precision :: gradE(ixO^S),divF(ixO^S)
657 double precision :: divF_h(ixO^S),divF_j(ixO^S)
658 double precision :: diff_term(ixO^S)
659 integer :: idir, jxO^L, hxO^L
663 hxo^l=ixo^l-
kr(idir,^
d);
664 jxo^l=ixo^l+
kr(idir,^
d);
667 divf(ixo^s) = divf(ixo^s) + 2.d0*(divf_h(ixo^s) + divf_j(ixo^s))/
dxlevel(idir)**2
669 w(ixo^s,iw_r_e) = divf(ixo^s)
677 integer,
intent(in) :: ixI^L, ixO^L
678 double precision,
intent(inout) :: w(ixI^S, 1:nw)
679 double precision,
intent(in) :: wCT(ixI^S, 1:nw)
680 double precision,
intent(in) :: x(ixI^S, 1:ndim)
681 double precision :: kappa(ixO^S,1:ndim), lambda(ixO^S,1:ndim), fld_R(ixO^S,1:ndim)
682 double precision :: max_D(ixI^S), grad_r_e(ixI^S), rad_e(ixI^S)
683 double precision :: cc
684 integer :: idir,i,j,ix^D
694 w(ixo^s,
i_diff_mg(idir)) = cc*lambda(ixo^s,idir)/(kappa(ixo^s,idir)*wct(ixo^s,iw_rho))
695 where(w(ixo^s,
i_diff_mg(idir)) .lt. 0.d0)
709 type(state),
target :: psa(max_blocks)
710 integer :: iigrid, igrid, level
715 do iigrid=1,igridstail; igrid=igrids(iigrid);
725 integer,
intent(in) :: ixI^L, ixO^L, idir
726 double precision,
intent(inout) :: w(ixI^S, 1:nw)
727 double precision :: tmp_D(ixI^S), filtered_D(ixI^S)
728 integer :: ix^D, filter, idim
730 if(
size_d_filter .lt. 1)
call mpistop(
"D filter of size < 1 makes no sense")
733 filtered_d(ixo^s) = zero
737 filtered_d(ix^d) = filtered_d(ix^d) &
738 + tmp_d(ix^d+filter*
kr(idim,^d)) &
739 + tmp_d(ix^d-filter*
kr(idim,^d))
759 integer,
intent(in) :: ixI^L, ixO^L
760 double precision,
intent(in) :: x(ixI^S,1:ndim)
761 double precision,
intent(in) :: wCT(ixI^S,1:nw)
762 double precision,
intent(inout) :: w(ixI^S,1:nw)
763 double precision :: a1(ixO^S), a2(ixO^S)
764 double precision :: c0(ixO^S), c1(ixO^S)
765 double precision :: e_gas(ixO^S), E_rad(ixO^S)
766 double precision :: kappa(ixO^S)
767 double precision :: sigma_b,cc
773 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)
774 if(
allocated(iw_mag))
then
775 e_gas(ixo^s) = e_gas(ixo^s)-half*sum(wct(ixo^s,iw_mag(:))**2,dim=ndim+1)
777 {
do ix^d=ixomin^d,ixomax^d\ }
780 e_rad(ixo^s) = wct(ixo^s,iw_r_e)
787 a1(ixo^s) = 4.d0*sigma_b/cc*(afld_gamma-one)**4.d0/wct(ixo^s,iw_rho)**4.d0
788 a2(ixo^s) = e_gas(ixo^s) + e_rad(ixo^s)
789 c0(ixo^s) = a2(ixo^s)/a1(ixo^s)
790 c1(ixo^s) = 1.d0/a1(ixo^s)
793 a1(ixo^s) = 4.d0*kappa(ixo^s)*sigma_b*(afld_gamma-one)**4.d0/wct(ixo^s,iw_rho)**3.d0*
dt
795 c0(ixo^s) = ((one+a2(ixo^s))*e_gas(ixo^s)+a2(ixo^s)*e_rad(ixo^s))/a1(ixo^s)
796 c1(ixo^s) = (one+a2(ixo^s))/a1(ixo^s)
799 {
do ix^d=ixomin^d,ixomax^d\ }
804 call newton_method(e_gas(ix^d), e_rad(ix^d), c0(ix^d), c1(ix^d))
806 call halley_method(e_gas(ix^d), e_rad(ix^d), c0(ix^d), c1(ix^d))
808 call halley_method(e_gas(ix^d), e_rad(ix^d), c0(ix^d), c1(ix^d))
810 call mpistop(
'root-method not known')
815 e_rad(ixo^s) = a2(ixo^s)-e_gas(ixo^s)
818 e_rad(ixo^s) = (a1(ixo^s)*e_gas(ixo^s)**4.d0+e_rad(ixo^s))/(one + a2(ixo^s))
821 w(ixo^s,iw_e) = e_gas(ixo^s)
824 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)
825 if(
allocated(iw_mag))
then
826 w(ixo^s,iw_e) = w(ixo^s,iw_e)+half*sum(wct(ixo^s, iw_mag(:))**2,dim=ndim+1)
829 w(ixo^s,iw_r_e) = e_rad(ixo^s)
835 double precision,
intent(in) :: c0, c1
836 double precision,
intent(in) :: E_rad
837 double precision,
intent(inout) :: e_gas
838 double precision :: bisect_a, bisect_b, bisect_c
839 integer :: n, max_its
844 bisect_b = 1.2d0*max(abs(c0/c1),abs(c0)**(1.d0/4.d0))
845 do while(abs(bisect_b-bisect_a) .ge.
fld_bisect_tol*min(e_gas,e_rad))
846 bisect_c = (bisect_a + bisect_b)/two
848 if(n .gt. max_its)
then
850 call mpistop(
'No convergece in bisection scheme')
873 call mpistop(
"Problem with fld bisection method")
881 print*,
"IGNORING GAS-RAD ENERGY EXCHANGE ", c0, c1
891 2435 e_gas = (bisect_a + bisect_b)/two
897 double precision,
intent(in) :: c0, c1
898 double precision,
intent(in) :: E_rad
899 double precision,
intent(inout) :: e_gas
900 double precision :: xval, yval, der, deltax
915 if (ii .gt. 1d3)
then
926 double precision,
intent(in) :: c0, c1
927 double precision,
intent(in) :: E_rad
928 double precision,
intent(inout) :: e_gas
929 double precision :: xval, yval, der, dder, deltax
943 deltax = -two*yval*der/(two*der**2 - yval*dder)
946 if (ii .gt. 1d3)
then
957 double precision,
intent(in) :: e_gas
958 double precision,
intent(in) :: c0, c1
959 double precision :: val
961 val = e_gas**4.d0 + c1*e_gas - c0
967 double precision,
intent(in) :: e_gas
968 double precision,
intent(in) :: c0, c1
969 double precision :: der
971 der = 4.d0*e_gas**3.d0 + c1
977 double precision,
intent(in) :: e_gas
978 double precision,
intent(in) :: c0, c1
979 double precision :: dder
981 dder = 4.d0*3.d0*e_gas**2.d0
Module for including anisotropic flux limited diffusion (AFLD)-approximation in Radiation-hydrodynami...
logical lineforce_opacities
Use or dont use lineforce opacities.
subroutine afld_smooth_diffcoef(w, ixil, ixol, idir)
Use running average on Diffusion coefficient.
character(len=8) fld_interaction_method
Which method to find the root for the energy interaction polynomial.
logical fld_eint_split
source split for energy interact and radforce:
subroutine afld_get_diffcoef_central(w, wct, x, ixil, ixol)
Calculates cell-centered diffusion coefficient to be used in multigrid.
logical flux_lim_filter
Take a running average over the fluxlimiter.
subroutine, public afld_get_radflux(w, x, ixil, ixol, rad_flux, nth)
Calculate Radiation Flux Calculate the Flux using the fld closure relation F = -c*lambda/(kappa*rho) ...
double precision, public fld_bisect_tol
Tolerance for bisection method for Energy sourceterms This is a percentage of the minimum of gas- and...
subroutine, public get_afld_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, public fld_kappa0
Opacity per unit of unit_density.
subroutine, public afld_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...
double precision, public fld_diff_tol
Tolerance for adi method for radiative Energy diffusion.
character(len=16) fld_fluxlimiter
Diffusion limit lambda = 0.33.
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...
double precision function ddpolynomial_bisection(e_gas, c0, c1)
Evaluate second derivative of polynomial at argument e_gas.
subroutine bisection_method(e_gas, e_rad, c0, c1)
Find the root of the 4th degree polynomial using the bisection method.
logical fld_diff_testcase
Set Diffusion coefficient to unity.
logical diffcrash_resume
Resume run when multigrid returns error.
double precision function dpolynomial_bisection(e_gas, c0, c1)
Evaluate first derivative of polynomial at argument e_gas.
character(len=8), dimension(:), allocatable fld_opacity_law
Use constant Opacity?
subroutine, public afld_radforce_get_dt(w, ixil, ixol, dtnew, dxd, x)
subroutine evaluate_e_rad_mg(qtc, psa)
inplace update of psa==>F_im(psa)
subroutine energy_interaction(w, wct, x, ixil, ixol)
This subroutine calculates the radiation heating, radiation cooling and photon tiring using an implic...
subroutine, public afld_get_radpress(w, x, ixil, ixol, rad_pressure, nth)
Calculate Radiation Pressure Returns Radiation Pressure as tensor.
subroutine update_diffcoeff(psa)
subroutine halley_method(e_gas, e_rad, c0, c1)
Find the root of the 4th degree polynomial using the Halley method.
double precision function polynomial_bisection(e_gas, c0, c1)
Evaluate polynomial at argument e_gas.
subroutine, public afld_init(he_abundance, afld_gamma)
Initialising FLD-module: Read opacities Initialise Multigrid adimensionalise kappa Add extra variable...
subroutine newton_method(e_gas, e_rad, c0, c1)
Find the root of the 4th degree polynomial using the Newton-Ralphson method.
character(len=50) fld_opal_table
subroutine, public get_afld_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...
double precision, public diff_crit
Number for splitting the diffusion module.
logical fld_radforce_split
subroutine, public afld_get_opacity(w, x, ixil, ixol, fld_kappa)
Sets the opacity in the w-array by calling mod_opal_opacity.
logical diff_coef_filter
Take running average for Diffusion coefficient.
double precision, public afld_mu
mean particle mass
integer, dimension(:), allocatable i_diff_mg
subroutine put_diffterm_onegrid(ixil, ixol, w)
inplace update of psa==>F_im(psa)
subroutine afld_params_read(files)
public methods these are called in mod_rhd_phys
double precision dt_diff
running timestep for diffusion solver, initialised as zero
subroutine afld_get_eddington(w, x, ixil, ixol, eddington_tensor, nth)
Calculate Eddington-tensor Stores Eddington-tensor in w-array.
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for physical and numeric constants.
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 dt
global time step
double precision courantpar
The Courant (CFL) number used for the simulation.
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_get_pthermal), pointer phys_get_pthermal
procedure(sub_set_mg_bounds), pointer phys_set_mg_bounds
procedure(sub_implicit_update), pointer phys_implicit_update
Module with all the methods that users can customize in AMRVAC.
procedure(special_diffcoef), pointer usr_special_diffcoef
procedure(special_fluxlimiter), pointer usr_special_fluxlimiter
procedure(special_opacity_qdot), pointer usr_special_opacity_qdot
procedure(special_aniso_opacity), pointer usr_special_aniso_opacity
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.