74 CHARACTER(LEN=32),
PARAMETER ::
source_name =
"thin accretion disk cooling"
75 INTEGER,
PARAMETER ::
gray = 1
78 CHARACTER(LEN=28),
PARAMETER,
DIMENSION(3) :: &
80 "Gammie disk cooling ", &
81 "Gammie shearing box cooling" /)
108 REAL,
PARAMETER ::
texp(8) = (/ 2.0, -7.0, 0.5, -24.0, 3.0, 10.0, -2.5, 0.0 /)
109 REAL,
PARAMETER ::
rexp(8) = (/ 0.0, 0.0, 0.0, 1.0, 2./3., 1./3., 1.0, 0.0 /)
110 REAL,
PARAMETER ::
t0 = 3000
151 TYPE(
dict_typ),
POINTER :: config,IO
154 INTEGER :: cooling_func
156 CALL getattr(config,
"stype", stype)
161 SELECT TYPE (phys => physics)
166 CALL this%Error(
"sources_diskcooling::InitSources",
"physics not supported")
170 IF (physics%VDIM.GT.2)
THEN
171 CALL this%Error(
"sources_diskcooling::InitSources",
"only 2D simulations supported")
175 CALL getattr(config,
"method",cooling_func)
176 IF (cooling_func.LE.1.OR.cooling_func.GT.3) &
177 CALL this%Error(
"sources_diskcooling::InitSources",
"unknown cooling method")
180 IF (err.EQ.0)
ALLOCATE(this%Q,stat=err)
181 IF (err.NE.0)
CALL this%Error(
"sources_diskcooling::InitSources",
"memory allocation failed")
182 CALL this%cooling%InitLogging(cooling_func,
cooling_name(cooling_func))
185 SELECT CASE(this%cooling%GetType())
188 IF (physics%constants%GetType().NE.si) &
189 CALL this%Error(
"sources_diskcooling::InitSources",
"only SI units supported for gray cooling")
192 SELECT TYPE (mgeo => mesh%Geometry)
196 this%ephir%data4d(:,:,:,1) = -mesh%posvec%bcenter(:,:,:,2)/mesh%radius%bcenter(:,:,:)**2
197 this%ephir%data4d(:,:,:,2) = mesh%posvec%bcenter(:,:,:,1)/mesh%radius%bcenter(:,:,:)**2
199 CALL this%Error(
"sources_diskcooling::InitSources",
"geometry not supported")
202 SELECT TYPE (mgeo => mesh%Geometry)
206 CALL this%Error(
"sources_diskcooling::InitSources",
"geometry not supported")
210 CALL this%Error(
"sources_diskcooling::InitSources",
"unknown cooling method")
214 CALL getattr(config,
"cvis", this%cvis, 0.1)
217 CALL getattr(config,
"Tmin", this%T_0, 1.0e-30)
220 CALL getattr(config,
"Rhomin", this%rho_0, 1.0e-30)
223 CALL getattr(config,
"b_cool", this%b_cool, 1.0e+00)
226 CALL getattr(config,
"b_start", this%b_start, 0.0)
227 CALL getattr(config,
"b_final", this%b_final, this%b_cool)
230 CALL getattr(config,
"t_start", this%t_start, 0.0)
233 CALL getattr(config,
"dt_bdec", this%dt_bdec, -1.0)
239 this%Q%data1d(:) = 0.0
242 CALL this%SetOutput(mesh,config,io)
243 CALL this%InfoSources(mesh)
252 CHARACTER(LEN=32) :: param_str
254 CALL this%Info(
" cooling function: " // trim(this%cooling%GetName()))
255 SELECT CASE(this%cooling%GetType())
257 WRITE (param_str,
'(ES10.2)') this%T_0
258 CALL this%Info(
" min. temperature: " // trim(param_str))
259 WRITE (param_str,
'(ES10.2)') this%rho_0
260 CALL this%Info(
" minimum density: " // trim(param_str))
262 WRITE (param_str,
'(ES10.2)') this%b_cool
263 CALL this%Info(
" cooling parameter: " // trim(param_str))
265 WRITE (param_str,
'(ES10.2)') this%b_cool
266 CALL this%Info(
" cooling parameter: " // trim(param_str))
267 IF(this%dt_bdec.GE.0.0)
THEN
268 WRITE (param_str,
'(ES10.2)') this%b_start
269 CALL this%Info(
" initial cooling parameter: " // trim(param_str))
270 WRITE (param_str,
'(ES10.2)') this%b_final
271 CALL this%Info(
" final cooling parameter: " // trim(param_str))
272 WRITE (param_str,
'(ES10.2)') this%t_start
273 CALL this%Info(
" starting b_dec time: " // trim(param_str))
274 WRITE (param_str,
'(ES10.2)') this%dt_bdec
275 CALL this%Info(
" operating time: " // trim(param_str))
289 REAL,
INTENT(IN) :: time
292 REAL :: muRgamma,Qfactor
296 SELECT CASE(this%cooling%GetType())
299 IF (
ASSOCIATED(this%grav))
THEN
300 IF (
ALLOCATED(this%grav%height))
THEN
301 IF (
ASSOCIATED(this%grav%height%data1d))
THEN
303 murgamma = physics%mu/(physics%Constants%RG*physics%gamma)
304 qfactor = 8./3.*physics%Constants%SB
306 this%Q%data1d(:) =
lambda_gray(pvar%density%data1d(:),this%grav%height%data1d(:), &
307 murgamma*physics%bccsound%data1d(:)*physics%bccsound%data1d(:), &
308 this%rho_0,this%T_0,qfactor)
310 CALL this%Error(
"sources_diskcooling::UpdateCooling",
"disk height seems not properly assigned in gray cooling")
319 IF (this%dt_bdec.GE.0.0)
THEN
320 IF (time .LT. this%t_start)
THEN
321 this%b_cool = this%b_start
322 ELSE IF ((time .GE. this%t_start) .AND. ((time-this%t_start) .LT. &
324 this%b_cool = this%b_start + &
325 (this%b_final-this%b_start)/this%dt_bdec*(time - this%t_start)
326 ELSE IF ((time-this%t_start) .GE. this%dt_bdec)
THEN
327 this%b_cool = this%b_final
331 this%Q%data3d(:,:,:) =
lambda_gammie(pvar%pressure%data3d(:,:,:) / (physics%gamma-1.), &
332 abs((this%ephir%data4d(:,:,:,1)*pvar%velocity%data4d(:,:,:,1) &
333 +this%ephir%data4d(:,:,:,2)*(pvar%velocity%data4d(:,:,:,2)&
334 +mesh%OMEGA*mesh%radius%bcenter(:,:,:)))) / this%b_cool)
337 this%Q%data1d(:) =
lambda_gammie(pvar%pressure%data1d(:) / (physics%gamma-1.), &
338 mesh%OMEGA/this%b_cool)
346 REAL,
INTENT(IN) :: logrho,logt
354 kappa4(:) = exp(max(-40.0,min(40.0, &
357 tfactor = exp(max(-40.0,min(40.0,10.*(logt-log(
t0)))))
359 kappa_r = 1. /(tiny(kappa_r) + &
360 (1./kappa4(1) + 1./(1.+tfactor)/(kappa4(2)+kappa4(3)))**0.25 &
361 + (1./(kappa4(4)+kappa4(5)+kappa4(6)) + 1./(kappa4(7)+kappa4(8)))**0.25)
380 ELEMENTAL FUNCTION lambda_gray(Sigma,h,Tc,rho0,T0,Qf)
RESULT(Qcool)
383 REAL,
INTENT(IN) :: sigma,h,tc,rho0,
t0,qf
385 REAL :: logrho,logt,kappa,tau,tau_eff,t0tc
389 logrho = -log(max(rho0,
sqrt_twopi * h / sigma))
391 logt = log(max(
t0,tc))
396 tau = 0.5*kappa*sigma
398 tau_eff = 0.5*tau + 1./(3.*tau) + 1./
sqrt_three
402 qcool = qf/tau_eff * exp(4.0*logt) * (1.0-t0tc*t0tc*t0tc*t0tc)
415 REAL,
INTENT(IN) :: eint,t_cool_inv
418 qcool = eint * t_cool_inv
426 IF (
ALLOCATED(this%ephir))
DEALLOCATE(this%ephir)
Dictionary for generic data types.
base module for numerical flux functions
defines properties of a 3D cartesian mesh
defines properties of a 3D cylindrical mesh
subroutine finalize(this)
Destructor of logging_base class.
base class for mesh arrays
derived class for compound of mesh arrays
physics module for 1D,2D and 3D non-isothermal Euler equations
generic source terms module providing functionaly common to all source terms
source terms module for simple optically thin cooling
subroutine initsources(this, Mesh, Physics, Fluxes, config, IO)
subroutine updatecooling(this, Mesh, Physics, time, pvar)
Updates the cooling function at each time step.
character(len=32), parameter source_name
source terms module for cooling of geometrically thin accretion disks
elemental real function lambda_gray(Sigma, h, Tc, rho0, T0, Qf)
Gray cooling.
integer, parameter, public gray
elemental real function rosselandmeanopacity_new(logrho, logT)
character(len=28), dimension(3), parameter cooling_name
real, dimension(8), parameter texp
real, parameter sqrt_twopi
subroutine infosources(this, Mesh)
integer, parameter, public gammie_sb
real, dimension(8), parameter logkappa0
real, parameter sqrt_three
elemental real function lambda_gammie(Eint, t_cool_inv)
Gammie cooling.
integer, parameter, public gammie
real, dimension(8), parameter rexp
generic gravity terms module providing functionaly common to all gravity terms