15 integer :: eos_type = 0
16 integer :: n_lambda = 1
18 logical :: do_rt = .false.
23 procedure:: temperature
25 procedure:: lookup_table
27 type(
eos_t),
public:: eos
35 SUBROUTINE init (self)
38 logical,
save:: first_time=.true.
39 real,
save:: gamma=1.4
40 real,
save:: kappa=0.1
41 logical,
save:: do_rt = .false.
42 integer,
save:: itimer=0
43 namelist /eos_params/ gamma, do_rt, kappa
45 call trace%begin (
'eos_t%init', itimer=itimer)
46 if (io%master) print *, &
47 '------------------------ ideal equation-of-state -----------------------------' 53 rewind(io%input);
read (io%input, eos_params, iostat=iostat)
54 if (io%master)
write (io%output, eos_params)
59 self%kappa = kappa * scaling%m/scaling%l**2
60 call trace%end(itimer)
65 FUNCTION pressure (self, d, e)
RESULT (pg)
67 real(kind=KindScalarVar),
dimension(:,:,:),
pointer:: d, e
68 real(kind=KindScalarVar),
dimension(size(d,1),size(d,2),size(d,3)):: pg
70 pg = (self%gamma-1.0)*d*e
75 FUNCTION temperature (self, d, e)
RESULT (tt)
77 real,
dimension(:,:,:),
pointer:: d, e
78 real,
dimension(size(d,1),size(d,2),size(d,3)):: tt
80 tt = (self%gamma-1.0)*e
86 SUBROUTINE lookup (self, dim, lnd, ee, lnx, x, lny, y, pg, tt, ss, rk, src, gamma)
89 real,
optional:: gamma
90 real,
dimension(:,:,:),
intent(in),
pointer,
optional :: lnx, x, lny, y, lnd, ee
91 real,
dimension(:,:,:),
optional :: pg, tt, ss
92 real,
dimension(:,:,:,:),
optional :: src, rk
93 real,
dimension(:,:,:),
pointer :: x_loc, y_loc
95 integer,
save:: itimer=0
98 call trace%begin (
'eos_t%lookup', itimer=itimer)
99 if (
present(gamma))
then 102 if (
present(lnd))
then 103 call mpi%abort(
'trying to use lnd in eos/ideal/eos_mod.f90')
104 else if (
present(ee))
then 105 call mpi%abort(
'trying to use ee in eos/ideal/eos_mod.f90')
110 else if (
present(lny))
then 111 allocate (y_loc(dim(1),dim(2),dim(3)))
114 call mpi%abort (
'eos_t: missing 2nd argument')
119 else if (
present(lnx))
then 120 allocate (x_loc(dim(1),dim(2),dim(3)))
123 call mpi%abort (
'eos_t: missing 1st argument')
126 if (
present(tt))
then 127 tt = (self%gamma-1.0)*x_loc
129 if (
present(src))
then 130 stefan = cgs%stefan/(scaling%p*scaling%u)*scaling%temp**4
132 src(:,:,:,i) = stefan*
real(((self%gamma-1.0)*x_loc),kind=8)**4
135 if (
present(pg))
then 136 pg = (self%gamma-1.0)*y_loc*x_loc
138 if (
present(rk))
then 140 rk(:,:,:,i) = y_loc*self%kappa
143 if (
present(lnx))
deallocate(x_loc)
144 if (
present(lny))
deallocate(y_loc)
145 call trace%end(itimer)
146 END SUBROUTINE lookup
154 SUBROUTINE lookup_table (self, dim, e, ee, d, lnd, lne,lnee, pg, tt, ne, rk, src, gamma)
158 real,
optional:: gamma
159 real,
dimension(:,:,:),
intent(in),
pointer,
optional :: e, lne, d, lnee, lnd, ee
160 real,
dimension(:,:,:),
optional :: pg, tt, ne
161 real,
dimension(:,:,:,:),
optional :: src, rk
162 real,
dimension(:,:,:),
pointer :: d_loc, ee_loc
164 integer,
save:: itimer=0
167 call trace%begin (
'eos_t%lookup', itimer=itimer)
168 if (
present(gamma))
then 171 if (
present(lnd))
then 172 call mpi%abort(
'trying to use lnd in eos/ideal/eos_mod.f90')
173 else if (
present(ee))
then 174 call mpi%abort(
'trying to use ee in eos/ideal/eos_mod.f90')
179 else if (
present(lnd))
then 180 allocate (d_loc(dim(1),dim(2),dim(3)))
183 call mpi%abort (
'eos_t: missing 1st argument')
186 if (
present(ee))
then 188 else if (
present(lne))
then 189 allocate (ee_loc(dim(1),dim(2),dim(3)))
190 ee_loc = exp(lne)/d_loc
191 else if (
present(e))
then 192 allocate (ee_loc(dim(1),dim(2),dim(3)))
195 call mpi%abort (
'eos_t: missing 2nd argument')
198 if (
present(tt))
then 199 tt = (self%gamma-1.0)*ee_loc
201 if (
present(src))
then 202 stefan = cgs%stefan/(scaling%p*scaling%u)*scaling%temp**4
204 src(:,:,:,i) = stefan*
real(((self%gamma-1.0)*ee_loc),kind=8)**4
207 if (
present(pg))
then 208 pg = (self%gamma-1.0)*ee_loc*d_loc
210 if (
present(rk))
then 212 rk(:,:,:,i) = d_loc*self%kappa
215 if (
present(lne).or.
present(e).or.
present(lnee))
deallocate(ee_loc)
216 if (
present(lnd))
deallocate(d_loc)
217 call trace%end(itimer)
218 END SUBROUTINE lookup_table
Define code units, in terms of (here) CGS units.
Equation of state module for any sort of tables, provided by a reader.
Fundamental constants in CGS and SI units.