30 SUBROUTINE inigrav_eos(NELG, NEL, NG, MATID, IPM, GRAV0, RHO0, DEPTH, PM, BUFMAT,
31 . ELBUF_TAB,PSURF,LIST,PRES,IMAT,MLW,NPF,TF,NUMMAT,MAT_PARAM)
41#include "implicit_f.inc"
47#include "tabsiz_c.inc"
51 INTEGER,
INTENT(IN) :: NUMMAT
52 INTEGER,
INTENT(IN) :: NEL, NG, MATID, IPM(NPROPMI, *), LIST(NEL),NELG, IMAT, MLW
53 my_real,
INTENT(IN) :: grav0, depth(*), pm(npropm, *), bufmat(*),psurf
54 my_real,
INTENT(INOUT) :: pres(nel)
55 TYPE(elbuf_struct_),
DIMENSION(NGROUP),
TARGET,
INTENT(IN) :: ELBUF_TAB
57 INTEGER,
INTENT(IN)::NPF(SNPC)
59 TYPE(matparam_struct_) ,
DIMENSION(NUMMAT),
INTENT(IN) :: MAT_PARAM
64 INTEGER :: EOSTYPE, ITER, MAX_ITER, MAT(NEL), REMAINING_ELTS, NBMAT, NVAREOS, NVARTMP_EOS
67 my_real :: func(nel), dfunc(nel), error(nel), rhozero(nel), rho(nel),
68 . mu(nel), mu2(nel), espe(nel), dvol(nel), df(nel), vol(nel), psh(nel),
69 . dpdrho(nel), dpdm(nel), dpde(nel), theta(nel), ecold(nel), p0(nel),
70 . grun(nel),pref(nel), off(nel), eint(nel), sig(nel,6),rho_old,v0(nel)
72 LOGICAL :: CONT, CONVERGED(NEL)
73 TYPE(g_bufel_),
POINTER :: GBUF
74 TYPE(),
POINTER :: LBUF
75 TYPE(buf_eos_),
POINTER :: EBUF
85 gbuf => elbuf_tab(ng)%GBUF
88 ebuf => elbuf_tab(ng)%BUFLY(1)%EOS(1, 1, 1)
89 nvareos = elbuf_tab(ng)%BUFLY(1)%NVAR_EOS
90 nvartmp_eos = elbuf_tab(ng)%BUFLY(1)%NVARTMP_EOS
92 lbuf => elbuf_tab(ng)%BUFLY(imat)%LBUF(1, 1, 1)
93 ebuf => elbuf_tab(ng)%BUFLY(imat)%EOS(1, 1, 1)
94 nvareos = elbuf_tab(ng)%BUFLY(imat)%NVAR_EOS
95 nvartmp_eos = elbuf_tab(ng)%BUFLY(imat)%NVARTMP_EOS
98 eostype = mat_param(matid)%IEOS
99 eostype = ipm(4, matid)
105 converged(1:nel) =.false.
115 rhozero(k) = pm(1,matid)
116 psh(k) = pm(88, matid)
118 pref(k) = psurf - rho0 * grav0 * depth(k)
121 sig(k,1) = -pm(31,matid)
122 sig(k,2) = -pm(31,matid)
123 sig(k,3) = -pm(31,matid)
134 eint(k) = gbuf%EINT(i)
142 eint(k) = lbuf%EINT(i)
151 DO WHILE(cont .AND. iter < max_iter)
154 mu(k) = rho(k) / rhozero(k) - one
155 df(k) = rhozero(k) / rho(k)
156 eint(k) = eint(k) / df(k)
158 CALL eosmain(2 , nel , eostype , pm , off , eint,
159 . rho , rhozero , mu , mu2 , espe ,
160 . dvol , df , vol , mat , psh ,
161 . pres , dpdm , dpde , theta ,
162 . bufmat, sig , mu , mlw ,
163 . npf , tf , ebuf%VAR , nvareos, mat_param(matid),
164 . bid , nvartmp_eos, ebuf%VARTMP)
166 eint(k)=eint(k)*df(k)
173 IF (.NOT. converged(k))
THEN
176 func(k) = pres(k)-pref(k)
177 dfunc(k) = dpdrho(k) !- grun(k) * pres(k) / rho(k)
178 incr = - func(k) / dfunc(k)
180 rho(k) = rho(k) + incr
181 error(k)=
max( abs(incr)/rhozero(k) , abs(func(k)) )
183 incr = - (pres(k)+psh(k)+half*dpdrho(k)*incr)*(rhozero(k)/rho(k)-rhozero(k)/rho_old)
184 eint(k) = eint(k) + incr
185 IF(dpde(k)==zero)eint(k)=zero
187 IF (error(k) < tol .OR. iter == max_iter)
THEN
188 converged(k) = .true.
189 remaining_elts = remaining_elts - 1
192 df(k) = rhozero(i) / rho(k)
195 gbuf%SIG(i ) = - pres(k)
196 gbuf%SIG(i + nelg) = - pres(k)
197 gbuf%SIG(i + 2 * nelg) = - pres(k)
198 gbuf%EINT(i) = eint(k)/df(k)
201 lbuf%SIG(i ) = - pres(k)
202 lbuf%SIG(i + nelg) = - pres(k)
203 lbuf%SIG(i + 2 * nelg) = - pres(k)
204 lbuf%EINT(i) = eint(k)/df(k)
209 cont = (remaining_elts /= 0)
subroutine inigrav_eos(nelg, nel, ng, matid, ipm, grav0, rho0, depth, pm, bufmat, elbuf_tab, psurf, list, pres, imat, mlw, npf, tf, nummat, mat_param)
subroutine eosmain(iflag, nel, eostyp, pm, off, eint, rho, rho0, mu, mu2, espe, dvol, df, vnew, mat, psh, pnew, dpdm, dpde, theta, bufmat, sig, mu_bak, mlw, npf, tf, vareos, nvareos, mat_param, bfrac, nvartmp, vartmp)