53 CHARACTER(LEN=32),
PARAMETER ::
source_name =
"optically thin cooling"
88 CALL getattr(config,
"stype", stype)
93 CALL getattr(config,
"cvis", this%cvis, 0.1)
96 CALL getattr(config,
"Tmin", this%Tmin, 1.0e-30)
99 CALL getattr(config,
"switchon", this%switchon, -1.0)
103 SELECT TYPE (phys => physics)
108 CALL this%Error(
"sources_cooling::InitSources",
"physics not supported")
111 ALLOCATE(this%Q,stat=err)
112 IF (err.NE.0)
CALL this%Error(
"sources_cooling::InitSources",
"memory allocation failed")
119 this%Q%data1d(:) = 0.0
122 CALL this%SetOutput(mesh,config,io)
131 TYPE(
dict_typ),
POINTER :: config,IO
136 CALL getattr(config,
"output/Qcool", valwrite, 0)
137 IF (valwrite .EQ. 1) &
138 CALL setattr(io,
"Qcool", &
139 this%Q%data3d(mesh%IMIN:mesh%IMAX,mesh%JMIN:mesh%JMAX,mesh%KMIN:mesh%KMAX))
152 REAL,
INTENT(IN) :: time, dt
155 SELECT TYPE(s => sterm)
157 s%density%data1d(:) = 0.0
158 s%momentum%data1d(:) = 0.0
160 SELECT TYPE(phys => physics)
162 SELECT TYPE(p => pvar)
164 CALL this%UpdateCooling(mesh,phys,time,p)
169 s%energy%data1d(:) = -this%Q%data1d(:)
179 SUBROUTINE calctimestep(this,Mesh,Physics,Fluxes,pvar,cvar,time,dt,dtcause)
188 REAL,
INTENT(IN) :: time
189 REAL,
INTENT(INOUT) :: dt
190 INTEGER,
INTENT(OUT) :: dtcause
196 SELECT TYPE(p => pvar)
198 SELECT TYPE(phys => physics)
200 SELECT TYPE(p => pvar)
202 CALL this%UpdateCooling(mesh,phys,time,p)
203 invdt = maxval(abs(this%Q%data1d(:) / p%pressure%data1d(:)), &
204 mask=mesh%without_ghost_zones%mask1d(:))
205 IF (invdt.GT.tiny(invdt)) dt = this%cvis / invdt
220 REAL,
INTENT(IN) :: time
223 REAL :: muRgamma,Namu,scaling
225 SELECT TYPE(p => pvar)
228 IF (time.GE.0.0.AND.time.LE.this%switchon)
THEN
230 scaling = sin(0.5*pi*time/this%switchon)**2
235 murgamma = physics%mu /(physics%Constants%RG*physics%gamma) &
236 / physics%Constants%cf_temperature
238 namu = physics%Constants%NA/physics%mu &
239 / physics%Constants%cf_density * physics%Constants%cf_mass
243 WHERE (mesh%without_ghost_zones%mask1d(:))
244 this%Q%data1d(:) = scaling * physics%Constants%cf_energy &
245 * (namu * p%density%data1d(:))**2 &
246 *
lambda(murgamma * physics%bccsound%data1d(:)**2)
248 this%Q%data1d(:) = 0.0
258 REAL,
INTENT(IN) :: t
260 IF (t.LT.1.26e+4)
THEN
265 ELSE IF ((t.GE.1.26e+4).AND.(t.LT.1.5e+5))
THEN
266 l = 3.7d-38 * exp(0.58*log(t))
267 ELSE IF ((t.GE.1.5e5).AND.(t.LT.2.2e+7))
THEN
268 l = 1.2d-31 * exp(-0.68*log(t))
270 l = 1.2d-39 * exp(0.41*log(t))
Dictionary for generic data types.
base module for numerical flux functions
subroutine finalize(this)
Destructor of logging_base class.
base class for mesh arrays
derived class for compound of mesh arrays
subroutine setoutput(this, config, IO)
Setup mesh fields for i/o.
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 constant acceleration
character(len=32), parameter source_name
subroutine calctimestep(this, Mesh, Physics, Fluxes, pvar, cvar, time, dt, dtcause)
subroutine externalsources(this, Mesh, Physics, Fluxes, Sources, time, dt, pvar, cvar, sterm)
subroutine initsources(this, Mesh, Physics, Fluxes, config, IO)
source terms module for simple optically thin cooling
subroutine updatecooling(this, Mesh, Physics, time, pvar)
Updates the cooling function at each time step.
elemental real function lambda(T)
simple optically thin cooling function ATTENTION: input data should be in SI-units,...