9 integer,
parameter:: dp=4
10 real,
parameter:: t_mc=10.0
14 procedure(cooling_casiana),
pointer:: function => null()
15 real,
dimension(:,:,:),
pointer:: tt => null()
16 real,
dimension(:,:,:),
pointer:: qq => null()
17 real,
dimension(:,:,:),
pointer:: e => null()
20 procedure:: pre_update
21 procedure:: courant_condition
25 integer:: type=0, verbose=0
26 logical,
save:: first_time=.true.
32 SUBROUTINE init (self)
35 namelist /cooling_params/ on, verbose,
type, courant
37 call trace%begin (
'simple/cooling_t%init')
42 read (io%input, cooling_params, iostat=iostat)
43 write (io%output, cooling_params)
48 self%function => cooling_casiana
50 self%function => cooling_dalgarno
52 self%function => cooling_rosen_etal
54 self%function => cooling_shure
56 self%function => cooling_gnedin
64 SUBROUTINE pre_update (self, patch)
67 integer:: i1, i2, i3, l(3), u(3)
68 real:: scaling_constant, q1, q2, eth, tt, qq, d, e, px, py, pz
69 real:: t_min, t_max, q_min, q_max, e_min, e_max
71 call trace%begin (
'simple/cooling_t%pre_update')
73 if (.not.
allocated(patch%heating_per_unit_volume))
then 75 allocate (patch%heating_per_unit_volume(u(1),u(2),u(3)))
76 patch%heating_per_unit_volume = 0.0
79 scaling_constant = scaling%t/scaling%p
94 d = patch%mem(i1,i2,i3,patch%idx%d ,patch%it,1)
95 e = patch%mem(i1,i2,i3,patch%idx%e ,patch%it,1)
96 px = patch%mem(i1,i2,i3,patch%idx%px,patch%it,1)
97 py = patch%mem(i1,i2,i3,patch%idx%py,patch%it,1)
98 pz = patch%mem(i1,i2,i3,patch%idx%pz,patch%it,1)
99 eth = e - 0.5*(px**2+py**2+pz**2)/d
100 tt =
real(scaling%temp*(patch%gamma-1d0))*eth/d
104 q1 = self%function(tt)*d*scaling_constant
105 q2 = (t_mc/tt-1.0)*eth/patch%dtime*courant
106 qq = merge(q1,q2,tt>t_mc)
109 self%dtime = min(self%dtime, courant*eth/qq)
110 t_min = min(t_min,tt)
111 t_max = max(t_max,tt)
112 q_min = min(q_min,qq)
113 q_max = max(q_max,qq)
114 e_min = min(e_min,eth)
115 e_max = max(e_max,eth)
119 if (patch%istep < 2)
then 120 patch%heating_per_unit_volume = 0.0
122 if (verbose > 0)
then 123 write(stdout,*)
'simple/cooling_t%pre_update: T_min,max =', t_min, t_max
124 write(stdout,*)
'simple/cooling_t%pre_update: Q_min,max =', q_min, q_max
128 END SUBROUTINE pre_update
133 SUBROUTINE courant_condition (self, patch)
136 integer:: i1, i2, i3, l(3), u(3)
137 real,
dimension(:,:,:),
pointer:: e
139 call trace%begin (
'simple/cooling_t%courant_condition')
140 if (on .and. self%dtime < patch%dtime)
then 141 if (verbose > 0)
then 142 write (stdout,
'(a,i6,1p,2e12.3)') &
143 'simple/cooling_t%courant_condition: WARNING', &
144 patch%id, self%dtime, patch%dtime
150 END SUBROUTINE courant_condition
154 include
"cooling_Casiana.f90" 155 include
"cooling_Dalgarno.f90" 156 include
"cooling_Gnedin.f90" 157 include
"cooling_Rosen_etal.f90" 158 include
"cooling_Shure.f90" 160 END MODULE cooling_mod
The gpath_t layer now essentially only handles restarts.
Define code units, in terms of (here) CGS units.