41 real(8),
allocatable :: ay(:), wy(:), aphi(:), wphi(:)
47 real(8) :: lstar_cgs, lstar, rstar, kappae, clight
53 real(8),
parameter :: ratio_twind_teff = 0.8d0
56 integer :: method_cakforce, type_cak_1d
59 integer,
parameter :: radialforce=0
60 integer,
parameter :: vectorforce=1
63 integer,
parameter :: pointstar=0
64 integer,
parameter :: fdisc=1
65 integer,
parameter :: fdisc_cutoff=2
68 integer :: nthetaray, nphiray
75 logical :: cak_split=.false.
78 logical :: fix_vector_force_1d=.false.
81 logical :: use_cak_table=.false.
85 logical :: use_custom_cak_table=.false.
88 character(len=6) :: cak_force_method
92 character(len=256) :: cak_1d_type
95 character(len=256) :: name_cak_table=
''
108 subroutine cak_params_read(files)
112 character(len=*),
intent(in) :: files(:)
118 cak_force_method, cak_1d_type, cak_split, &
119 nphiray, nthetaray, fix_vector_force_1d, &
120 use_cak_table, name_cak_table, use_custom_cak_table
123 open(
unitpar, file=trim(files(n)), status=
"old")
124 read(
unitpar, cak_list,
end=111)
128 select case(trim(cak_force_method))
130 method_cakforce = radialforce
132 method_cakforce = vectorforce
134 write(unitterm,*)
'cak_force_method = ', trim(cak_force_method)
135 call mpistop(
'cak_params_read: unknown CAK force in cak_list')
139 select case(trim(cak_1d_type))
141 type_cak_1d = pointstar
144 case(
'finitedisc_cutoff')
145 type_cak_1d = fdisc_cutoff
147 write(unitterm,*)
'cak_1d_type = ', trim(cak_1d_type)
148 call mpistop(
'cak_params_read: unknown CAK wind method in cak_list')
151 end subroutine cak_params_read
158 real(8),
intent(in) :: phys_gamma
160 cak_gamma = phys_gamma
167 cak_force_method =
'radial'
168 cak_1d_type =
'finitedisc'
175 if (method_cakforce == radialforce)
then
176 gcak1_ = var_set_extravar(
"gcak1",
"gcak1")
177 fdf_ = var_set_extravar(
"fdfac",
"fdfac")
180 if (method_cakforce == vectorforce)
then
181 gcak1_ = var_set_extravar(
"gcak1",
"gcak1")
182 gcak2_ = var_set_extravar(
"gcak2",
"gcak2")
183 gcak3_ = var_set_extravar(
"gcak3",
"gcak3")
184 call rays_init(nthetaray,nphiray)
189 if (use_cak_table)
then
190 call init_cak_table(trim(name_cak_table), use_custom_cak_table)
192 select case(trim(name_cak_table))
201 alpha_ = var_set_extravar(
"alpha",
"alpha")
202 qbar_ = var_set_extravar(
"Qbar",
"Qbar")
203 q0_ = var_set_extravar(
"Q0",
"Q0")
204 kappae_ = var_set_extravar(
"kappae",
"kappae")
207 qbar_ = var_set_wextra()
208 q0_ = var_set_wextra()
213 if (
si_unit .and. use_cak_table)
then
214 call mpistop(
'cak_init: SI_unit=T but LTE tables assume cgs units')
218 call mpistop(
'cak_init: Cartesian geometry not supported')
222 call mpistop(
'cak_init: input alpha in [0,1[')
226 call mpistop(
'cak_init: input Qbar or Q0 is < 0')
229 if (method_cakforce == vectorforce .and.
ndir < 3)
then
230 call mpistop(
'cak_init: vector CAK force only for 2.5D and 3D')
234 call mpistop(
'cak_init: set input kappae to a reasonable constant')
244 real(8),
intent(in) :: rstar_cgs, twind_cgs
246 lstar_cgs = 4.0d0*
dpi * rstar_cgs**2.0d0 *
sigma_sb_cgs * twind_cgs**4.0d0
262 integer,
intent(in) :: ixi^
l, ixo^
l
263 real(8),
intent(in) :: qdt, x(ixi^s,1:
ndim), wct(ixi^s,1:nw)
264 real(8),
intent(inout) :: w(ixi^s,1:nw)
265 logical,
intent(in) :: energy, qsourcesplit
266 logical,
intent(inout) :: active
269 integer :: idir, ix^
d
270 real(8) :: gcak(ixo^s,1:3), ge(ixo^s), ptherm(ixi^s), pmin(ixi^s)
271 real(8) :: local_rho_cgs, local_twind_cgs
272 real(8) :: table_alpha, table_qbar, table_q0, table_kappae_cgs
275 if (qsourcesplit .eqv. cak_split)
then
279 if (use_cak_table)
then
281 {
do ix^db = ixo^lim^db\}
285 call set_cak_opacity(local_rho_cgs,local_twind_cgs, &
286 table_alpha,table_qbar,table_q0,table_kappae_cgs)
289 w(ix^
d,
qbar_) = table_qbar
290 w(ix^
d,
q0_) = table_q0
306 call get_gelectron(ixi^
l,ixo^
l,w,x,ge)
309 select case(method_cakforce)
311 call get_cak_force_radial(ixi^
l,ixo^
l,wct,w,x,gcak)
313 call get_cak_force_vector(ixi^
l,ixo^
l,wct,w,x,gcak)
318 if (idir == 1) gcak(ixo^s,idir) = gcak(ixo^s,idir) + ge(ixo^s)
320 w(ixo^s,iw_mom(idir)) = w(ixo^s,iw_mom(idir)) &
321 + qdt * gcak(ixo^s,idir) * wct(ixo^s,iw_rho)
325 w(ixo^s,iw_e) = w(ixo^s,iw_e) &
326 + qdt * sum(gcak(ixo^s,1:
ndir) * wct(ixo^s,iw_mom(1:
ndir)))
329 call phys_get_pthermal(w,x,ixi^
l,ixo^
l,ptherm)
330 pmin(ixo^s) = w(ixo^s,iw_rho) * tfloor
332 where (ptherm(ixo^s) < pmin(ixo^s))
333 w(ixo^s,iw_e) = w(ixo^s,iw_e) &
334 + (pmin(ixo^s) - ptherm(ixo^s)) / (cak_gamma - 1.0d0)
342 subroutine get_cak_force_radial(ixI^L,ixO^L,wCT,w,x,gcak)
346 integer,
intent(in) :: ixi^
l, ixo^
l
347 real(8),
intent(in) :: wct(ixi^s,1:nw), x(ixi^s,1:
ndim)
348 real(8),
intent(inout) :: w(ixi^s,1:nw)
349 real(8),
intent(out) :: gcak(ixo^s,1:3)
352 real(8) :: vr(ixi^s), dvrdr(ixo^s)
353 real(8) :: beta_fd(ixo^s), fdfac(ixo^s), taus(ixo^s), ge(ixo^s)
354 real(8) :: alpha(ixo^s), qbar(ixo^s), q0(ixo^s), kappae(ixo^s)
356 if (use_cak_table)
then
357 alpha(ixo^s) = w(ixo^s,
alpha_)
358 qbar(ixo^s) = w(ixo^s,
qbar_)
359 q0(ixo^s) = w(ixo^s,
q0_)
360 kappae(ixo^s) = w(ixo^s,
kappae_)
368 vr(ixi^s) = wct(ixi^s,iw_mom(1)) / wct(ixi^s,iw_rho)
369 call get_velocity_gradient(ixi^
l,ixo^
l,vr,x,1,dvrdr)
371 if (physics_type ==
'hd')
then
373 dvrdr(ixo^s) = max(abs(dvrdr(ixo^s)), smalldouble)
374 elseif (physics_type ==
'mhd')
then
376 dvrdr(ixo^s) = max(dvrdr(ixo^s), smalldouble)
380 call get_gelectron(ixi^
l,ixo^
l,w,x,ge)
383 select case (type_cak_1d)
384 case(pointstar, fdisc)
385 taus(ixo^s) = qbar(ixo^s) * kappae(ixo^s) * clight &
386 * wct(ixo^s,iw_rho) / dvrdr(ixo^s)
387 gcak(ixo^s,1) = qbar(ixo^s) / (1.0d0 - alpha(ixo^s)) * ge(ixo^s) &
388 / taus(ixo^s)**alpha(ixo^s)
391 taus(ixo^s) = q0(ixo^s) * kappae(ixo^s) * clight &
392 * wct(ixo^s,iw_rho) / dvrdr(ixo^s)
393 gcak(ixo^s,1) = qbar(ixo^s) * ge(ixo^s) / (1.0d0 - alpha(ixo^s)) &
394 * ( (1.0d0 + taus(ixo^s))**(1.0d0 - alpha(ixo^s)) - 1.0d0 ) &
399 beta_fd(ixo^s) = ( 1.0d0 - vr(ixo^s)/(x(ixo^s,1) * dvrdr(ixo^s)) ) &
400 * (rstar/x(ixo^s,1))**2.0d0
402 select case (type_cak_1d)
405 case(fdisc, fdisc_cutoff)
406 where (beta_fd(ixo^s) >= 1.0d0)
407 fdfac(ixo^s) = 1.0d0/(1.0d0 + alpha(ixo^s))
408 elsewhere (beta_fd(ixo^s) < -1.0d10)
409 fdfac(ixo^s) = abs(beta_fd(ixo^s))**alpha(ixo^s) &
410 / (1.0d0 + alpha(ixo^s))
411 elsewhere (abs(beta_fd(ixo^s)) > 1.0
d-3)
413 (1.0d0 - (1.0d0 - beta_fd(ixo^s))**(1.0d0 + alpha(ixo^s))) &
414 / (beta_fd(ixo^s)*(1.0d0 + alpha(ixo^s)))
416 fdfac(ixo^s) = 1.0d0 - 0.5d0*alpha(ixo^s)*beta_fd(ixo^s) &
417 * ( 1.0d0 + 1.0d0/3.0d0 * (1.0d0 - alpha(ixo^s))*beta_fd(ixo^s) )
422 gcak(ixo^s,1) = gcak(ixo^s,1) * fdfac(ixo^s)
423 gcak(ixo^s,2) = 0.0d0
424 gcak(ixo^s,3) = 0.0d0
427 w(ixo^s,
gcak1_) = gcak(ixo^s,1)
428 w(ixo^s,
fdf_) = fdfac(ixo^s)
430 end subroutine get_cak_force_radial
433 subroutine get_cak_force_vector(ixI^L,ixO^L,wCT,w,x,gcak)
438 integer,
intent(in) :: ixi^
l, ixo^
l
439 real(8),
intent(in) :: wct(ixi^s,1:nw), x(ixi^s,1:
ndim)
440 real(8),
intent(inout) :: w(ixi^s,1:nw)
441 real(8),
intent(out) :: gcak(ixo^s,1:3)
444 integer :: ix^
d, itray, ipray
445 real(8) :: a1, a2, a3, wyray, y, wpray, phiray, wtot, mustar, dvndn
446 real(8) :: costp, sintp, cospp, sinpp, cott0
447 real(8) :: vr(ixi^s), vt(ixi^s), vp(ixi^s), inv_rho(ixi^s), inv_r(ixi^s)
448 real(8) :: vrr(ixi^s), vtr(ixi^s), vpr(ixi^s)
449 real(8) :: dvrdr(ixo^s), dvtdr(ixo^s), dvpdr(ixo^s)
450 real(8) :: dvrdt(ixo^s), dvtdt(ixo^s), dvpdt(ixo^s)
451 real(8) :: dvrdp(ixo^s), dvtdp(ixo^s), dvpdp(ixo^s)
452 real(8) :: gcaktmp1, gcaktmp2, gcaktmp3, taus, integrand
453 real(8) :: alpha(ixo^s), qbar(ixo^s), q0(ixo^s), kappae(ixo^s)
455 if (use_cak_table)
then
456 alpha(ixo^s) = w(ixo^s,
alpha_)
457 qbar(ixo^s) = w(ixo^s,
qbar_)
458 q0(ixo^s) = w(ixo^s,
q0_)
459 kappae(ixo^s) = w(ixo^s,
kappae_)
467 inv_rho(ixi^s) = 1.0d0/wct(ixi^s,iw_rho)
468 inv_r(ixi^s) = 1.0d0/x(ixi^s,1)
471 vt(ixo^s) = 0.0d0; vtr(ixo^s) = 0.0d0
472 vp(ixo^s) = 0.0d0; vpr(ixo^s) = 0.0d0
474 dvrdr(ixo^s) = 0.0d0; dvtdr(ixo^s) = 0.0d0; dvpdr(ixo^s) = 0.0d0
475 dvrdt(ixo^s) = 0.0d0; dvtdt(ixo^s) = 0.0d0; dvpdt(ixo^s) = 0.0d0
476 dvrdp(ixo^s) = 0.0d0; dvtdp(ixo^s) = 0.0d0; dvpdp(ixo^s) = 0.0d0
479 vr(ixi^s) = wct(ixi^s,iw_mom(1)) * inv_rho(ixi^s)
480 vrr(ixi^s) = vr(ixi^s) * inv_r(ixi^s)
483 vt(ixi^s) = wct(ixi^s,iw_mom(2)) * inv_rho(ixi^s)
484 vtr(ixi^s) = vt(ixi^s) * inv_r(ixi^s)
487 vp(ixi^s) = wct(ixi^s,iw_mom(3)) * inv_rho(ixi^s)
488 vpr(ixi^s) = vp(ixi^s) * inv_r(ixi^s)
493 call get_velocity_gradient(ixi^
l,ixo^
l,vr,x,1,dvrdr)
496 call get_velocity_gradient(ixi^
l,ixo^
l,vr,x,2,dvrdt)
497 call get_velocity_gradient(ixi^
l,ixo^
l,vt,x,1,dvtdr)
498 call get_velocity_gradient(ixi^
l,ixo^
l,vt,x,2,dvtdt)
501 call get_velocity_gradient(ixi^
l,ixo^
l,vp,x,1,dvpdr)
502 call get_velocity_gradient(ixi^
l,ixo^
l,vp,x,2,dvpdt)
506 call get_velocity_gradient(ixi^
l,ixo^
l,vr,x,3,dvrdp)
507 call get_velocity_gradient(ixi^
l,ixo^
l,vt,x,3,dvtdp)
508 call get_velocity_gradient(ixi^
l,ixo^
l,vp,x,3,dvpdp)
512 {
do ix^db=ixomin^db,ixomax^db\}
519 do itray = 1,nthetaray
537 mustar = sqrt(max(1.0d0 - (rstar*inv_r(ix^
d))**2.0d0, 0.0d0))
538 costp = 1.0d0 - y*(1.0d0 - mustar)
539 sintp = sqrt(max(1.0d0 - costp*costp, 0.0d0))
542 {^nooned cott0 = cos(x(ix^
d,2))/max(sin(x(ix^
d,2)), smalldouble)}
545 wtot = wyray * wpray * (1.0d0 - mustar)
553 dvndn = a1*a1 * dvrdr(ix^
d) + a2*a2 * (dvtdt(ix^
d) + vrr(ix^
d)) &
554 + a3*a3 * (dvpdp(ix^
d) + cott0 * vtr(ix^
d) + vrr(ix^
d)) &
555 + a1*a2 * (dvtdr(ix^
d) + dvrdt(ix^
d) - vtr(ix^
d)) &
556 + a1*a3 * (dvpdr(ix^
d) + dvrdp(ix^
d) - vpr(ix^
d)) &
557 + a2*a3 * (dvpdt(ix^
d) + dvtdp(ix^
d) - cott0 * vpr(ix^
d))
562 taus = q0(ix^
d) * kappae(ix^
d) * clight * wct(ix^
d,iw_rho) / dvndn
563 integrand = ((1.0d0 + taus)**(1.0d0 - alpha(ix^
d)) - 1.0d0) / taus
567 gcaktmp1 = gcaktmp1 + integrand * a1 * wtot
568 gcaktmp2 = gcaktmp2 + integrand * a2 * wtot
569 gcaktmp3 = gcaktmp3 + integrand * a3 * wtot
573 gcak(ix^
d,1:3) = [gcaktmp1, gcaktmp2, gcaktmp3] &
574 * kappae(ix^
d) * qbar(ix^
d) / (1.0d0 - alpha(ix^
d))
579 gcak = gcak/dpi * lstar/(4.0d0*dpi*rstar**2.0d0 * clight)
581 if (fix_vector_force_1d)
then
582 gcak(ixo^s,2) = 0.0d0
583 gcak(ixo^s,3) = 0.0d0
587 w(ixo^s,
gcak1_) = gcak(ixo^s,1)
588 w(ixo^s,
gcak2_) = gcak(ixo^s,2)
589 w(ixo^s,
gcak3_) = gcak(ixo^s,3)
591 end subroutine get_cak_force_vector
594 subroutine get_gelectron(ixI^L,ixO^L,w,x,ge)
597 integer,
intent(in) :: ixi^
l, ixo^
l
598 real(8),
intent(in) :: w(ixi^s,1:nw), x(ixi^s,1:
ndim)
599 real(8),
intent(out):: ge(ixo^s)
601 real(8) :: kappae(ixo^s)
603 if (use_cak_table)
then
604 kappae(ixo^s) = w(ixo^s,
kappae_)
609 ge(ixo^s) = kappae(ixo^s) * lstar/(4.0d0*dpi * clight * x(ixo^s,1)**2.0d0)
611 end subroutine get_gelectron
617 integer,
intent(in) :: ixi^
l, ixo^
l
618 real(8),
intent(in) ::
dx^
d, x(ixi^s,1:
ndim)
619 real(8),
intent(in) :: wprim(ixi^s,1:nw)
620 real(8),
intent(inout) :: dtnew
623 real(8) :: ge(ixo^s), max_gr, dt_cak
625 call get_gelectron(ixi^
l,ixo^
l,wprim,x,ge)
630 max_gr = max( maxval(abs(ge(ixo^s) + wprim(ixo^s,
gcak1_))), epsilon(1.0d0) )
631 dt_cak = minval( sqrt(
block%dx(ixo^s,1)/max_gr) )
635 if (method_cakforce == vectorforce)
then
636 max_gr = max( maxval(abs(wprim(ixo^s,
gcak2_))), epsilon(1.0d0) )
637 dt_cak = minval( sqrt(
block%dx(ixo^s,1) *
block%dx(ixo^s,2)/max_gr) )
641 max_gr = max( maxval(abs(wprim(ixo^s,
gcak3_))), epsilon(1.0d0) )
642 dt_cak = minval( sqrt(
block%dx(ixo^s,1) * sin(
block%dx(ixo^s,3))/max_gr) )
651 subroutine get_velocity_gradient(ixI^L,ixO^L,v,x,idir,grad_vn)
654 integer,
intent(in) :: ixi^
l, ixo^
l, idir
655 real(8),
intent(in) :: v(ixi^s), x(ixi^s,1:
ndim)
656 real(8),
intent(out) :: grad_vn(ixo^s)
659 real(8) :: forw(ixo^s), backw(ixo^s), cent(ixo^s)
660 integer :: jrx^
l, hrx^
l{^nooned,jtx^
l, htx^
l}{^ifthreed,jpx^
l, hpx^
l}
663 jrx^
l=ixo^
l+
kr(1,^
d);
664 hrx^
l=ixo^
l-
kr(1,^
d);
668 jtx^
l=ixo^
l+
kr(2,^
d);
669 htx^
l=ixo^
l-
kr(2,^
d);
674 jpx^
l=ixo^
l+
kr(3,^
d);
675 hpx^
l=ixo^
l-
kr(3,^
d);
681 forw(ixo^s) = (x(ixo^s,1) - x(hrx^s,1)) * v(jrx^s) &
682 / ((x(jrx^s,1) - x(ixo^s,1)) * (x(jrx^s,1) - x(hrx^s,1)))
684 backw(ixo^s) = -(x(jrx^s,1) - x(ixo^s,1)) * v(hrx^s) &
685 / ((x(ixo^s,1) - x(hrx^s,1)) * (x(jrx^s,1) - x(hrx^s,1)))
687 cent(ixo^s) = (x(jrx^s,1) + x(hrx^s,1) - 2.0d0*x(ixo^s,1)) * v(ixo^s) &
688 / ((x(ixo^s,1) - x(hrx^s,1)) * (x(jrx^s,1) - x(ixo^s,1)))
691 forw(ixo^s) = (x(ixo^s,2) - x(htx^s,2)) * v(jtx^s) &
692 / (x(ixo^s,1) * (x(jtx^s,2) - x(ixo^s,2)) * (x(jtx^s,2) - x(htx^s,2)))
694 backw(ixo^s) = -(x(jtx^s,2) - x(ixo^s,2)) * v(htx^s) &
695 / ( x(ixo^s,1) * (x(ixo^s,2) - x(htx^s,2)) * (x(jtx^s,2) - x(htx^s,2)))
697 cent(ixo^s) = (x(jtx^s,2) + x(htx^s,2) - 2.0d0*x(ixo^s,2)) * v(ixo^s) &
698 / ( x(ixo^s,1) * (x(ixo^s,2) - x(htx^s,2)) * (x(jtx^s,2) - x(ixo^s,2)))
702 forw(ixo^s) = (x(ixo^s,3) - x(hpx^s,3)) * v(jpx^s) &
703 / ( x(ixo^s,1)*sin(x(ixo^s,2)) * (x(jpx^s,3) - x(ixo^s,3)) * (x(jpx^s,3) - x(hpx^s,3)))
705 backw(ixo^s) = -(x(jpx^s,3) - x(ixo^s,3)) * v(hpx^s) &
706 / ( x(ixo^s,1)*sin(x(ixo^s,2)) * (x(ixo^s,3) - x(hpx^s,3)) * (x(jpx^s,3) - x(hpx^s,3)))
708 cent(ixo^s) = (x(jpx^s,3) + x(hpx^s,3) - 2.0d0*x(ixo^s,3)) * v(ixo^s) &
709 / ( x(ixo^s,1)*sin(x(ixo^s,2)) * (x(ixo^s,3) - x(hpx^s,3)) * (x(jpx^s,3) - x(ixo^s,3)))
714 grad_vn(ixo^s) = backw(ixo^s) + cent(ixo^s) + forw(ixo^s)
716 end subroutine get_velocity_gradient
719 subroutine rays_init(ntheta_point,nphi_point)
723 integer,
intent(in) :: ntheta_point, nphi_point
726 real(8) :: ymin, ymax, phipmin, phipmax, adum
738 allocate(ay(ntheta_point))
739 allocate(wy(ntheta_point))
740 allocate(aphi(nphi_point))
741 allocate(wphi(nphi_point))
744 call gauss_legendre_quadrature(ymin,ymax,ntheta_point,ay,wy)
745 call gauss_legendre_quadrature(phipmin,phipmax,nphi_point,aphi,wphi)
766 print*,
'==========================='
767 print*,
' Radiation ray setup '
768 print*,
'==========================='
769 print*,
'Theta ray points + weights '
770 do ii = 1,ntheta_point
771 print*,ii,ay(ii),wy(ii)
774 print*,
'Phi ray points + weights '
776 print*,ii,aphi(ii),wphi(ii)
788 allocate(ay(ntheta_point))
789 allocate(wy(ntheta_point))
790 allocate(aphi(nphi_point))
791 allocate(wphi(nphi_point))
794 call mpi_bcast(ay,ntheta_point,mpi_double_precision,0,
icomm,
ierrmpi)
795 call mpi_bcast(wy,ntheta_point,mpi_double_precision,0,
icomm,
ierrmpi)
796 call mpi_bcast(aphi,nphi_point,mpi_double_precision,0,
icomm,
ierrmpi)
797 call mpi_bcast(wphi,nphi_point,mpi_double_precision,0,
icomm,
ierrmpi)
800 end subroutine rays_init
803 subroutine gauss_legendre_quadrature(xlow,xhi,n,x,w)
810 real(8),
intent(in) :: xlow, xhi
811 integer,
intent(in) :: n
812 real(8),
intent(out) :: x(n), w(n)
815 real(8) :: p1, p2, p3, pp, xl, xm, z, z1
816 real(8),
parameter :: error=3.0
d-14
820 xm = 0.5d0*(xhi + xlow)
821 xl = 0.5d0*(xhi - xlow)
824 z = cos( dpi * (i - 0.25d0)/(n + 0.5d0) )
827 do while (abs(z1 - z) > error)
834 p1 = ( (2.0d0*j - 1.0d0)*z*p2 - (j - 1.0d0)*p3 )/j
837 pp = n*(z*p1 - p2) / (z*z - 1.0d0)
844 w(i) = 2.0d0*xl / ((1.0d0 - z*z) * pp*pp)
848 end subroutine gauss_legendre_quadrature
Module to include CAK radiation line force in (magneto)hydrodynamic models Computes both the force fr...
subroutine, public cak_add_source(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
real(8), public gayley_qbar
real(8), public gayley_q0
real(8), public cak_alpha
Line-ensemble parameters in the Gayley (1995) formalism.
subroutine, public set_cak_force_norm(rstar_cgs, twind_cgs)
Compute some (unitless) variables for CAK force normalisation.
real(8), public kappae_cgs
Free-electron scattering opacity.
subroutine, public cak_get_dt(wprim, ixil, ixol, dtnew, dxd, x)
Check time step for total radiation contribution.
integer, public gcak1_
Extra slots to store quantities in w-array.
subroutine, public cak_init(phys_gamma)
Initialize the module.
This module reads in CAK line opacities in the Gayley (1995) notation (alpha, Qbar,...
subroutine, public init_cak_table(tabledir, set_custom_tabledir)
This routine is called when the FLD or CAK module is initialised.
subroutine, public set_cak_opacity(rho, temp, alpha_output, qbar_output, q0_output, kappae_output)
This subroutine calculates the opacity for a given temperature-density structure. Opacities are read ...
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module for physical and numeric constants.
double precision, parameter sigma_sb_cgs
Stefan Boltzmann constant in cgs from (2 pi^5 kB^4)/(15 c^2 h^3).
double precision, parameter dpi
Pi.
double precision, parameter const_c
universal constants as specified in cgs units
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 unit_time
Physical scaling factor for time.
double precision unit_density
Physical scaling factor for density.
integer, parameter unitpar
file handle for IO
logical any_source_split
if any normal source term is added in split fasion
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter ndim
Number of spatial dimensions for grid variables.
double precision unit_length
Physical scaling factor for length.
character(len=std_len), dimension(:), allocatable par_files
Which par files are used as input.
integer icomm
The MPI communicator.
integer mype
The rank of the current MPI task.
integer ndir
Number of spatial dimensions (components) for vector variables.
double precision courantpar
The Courant (CFL) number used for the simulation.
integer ierrmpi
A global MPI error return code.
double precision, dimension(:), allocatable, parameter d
logical slab
Cartesian geometry or not.
integer npe
The number of MPI tasks.
double precision unit_velocity
Physical scaling factor for velocity.
integer, parameter unitterm
Unit for standard output.
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
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_get_pthermal), pointer phys_get_pthermal
character(len=name_len) physics_type
String describing the physics type of the simulation.
Module with all the methods that users can customize in AMRVAC.