OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
inigrav_eos.F File Reference
#include "implicit_f.inc"
#include "param_c.inc"
#include "com01_c.inc"
#include "tabsiz_c.inc"

Go to the source code of this file.

Functions/Subroutines

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)

Function/Subroutine Documentation

◆ inigrav_eos()

subroutine inigrav_eos ( integer, intent(in) nelg,
integer, intent(in) nel,
integer, intent(in) ng,
integer, intent(in) matid,
integer, dimension(npropmi, *), intent(in) ipm,
intent(in) grav0,
intent(in) rho0,
dimension(*), intent(in) depth,
dimension(npropm, *), intent(in) pm,
dimension(*), intent(in) bufmat,
type(elbuf_struct_), dimension(ngroup), intent(in), target elbuf_tab,
intent(in) psurf,
integer, dimension(nel), intent(in) list,
dimension(nel), intent(inout) pres,
integer, intent(in) imat,
integer, intent(in) mlw,
integer, dimension(snpc), intent(in) npf,
dimension(stf), intent(in) tf,
integer, intent(in) nummat,
type(matparam_struct_), dimension(nummat), intent(in) mat_param )

Definition at line 30 of file inigrav_eos.F.

32C-----------------------------------------------
33C M o d u l e s
34C-----------------------------------------------
35 USE elbufdef_mod
36 USE matparam_def_mod
37 USE eosmain_mod , ONLY : eosmain
38C-----------------------------------------------
39C I m p l i c i t T y p e s
40C-----------------------------------------------
41#include "implicit_f.inc"
42C-----------------------------------------------
43C C o m m o n B l o c k s
44C-----------------------------------------------
45#include "param_c.inc"
46#include "com01_c.inc"
47#include "tabsiz_c.inc"
48C-----------------------------------------------
49C D u m m y A r g u m e n t s
50C-----------------------------------------------
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
56 my_real, INTENT(IN) :: rho0
57 INTEGER,INTENT(IN)::NPF(SNPC)
58 my_real,INTENT(IN)::tf(stf)
59 TYPE(MATPARAM_STRUCT_) ,DIMENSION(NUMMAT), INTENT(IN) :: MAT_PARAM
60C-----------------------------------------------
61C L o c a l V a r i a b l e s
62C-----------------------------------------------
63 INTEGER :: I,K
64 INTEGER :: EOSTYPE, ITER, MAX_ITER, MAT(NEL), REMAINING_ELTS, NBMAT, NVAREOS, NVARTMP_EOS
65 my_real :: bid(nel) !bfrac not used int his context
66 my_real :: tol, incr
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)
71
72 LOGICAL :: CONT, CONVERGED(NEL)
73 TYPE(G_BUFEL_), POINTER :: GBUF
74 TYPE(L_BUFEL_), POINTER :: LBUF
75 TYPE(BUF_EOS_), POINTER :: EBUF
76C-----------------------------------------------
77C S o u r c e L i n e s
78C-----------------------------------------------
79
80C LIST IS SUBGROUP TO TREAT : ONLY ELEM WITH RELEVANT PARTS ARE KEPT
81C NEL IS ISEZ OF LIST
82C NELG IS SIZE OF ORIGINAL GROUP : needed to shift indexes in GBUF%SIG & MBUF%VAR
83C IMAT : relevant for multifluid eos. imat=0 => monomaterial law
84
85 gbuf => elbuf_tab(ng)%GBUF
86 NULLIFY(lbuf)
87 NULLIFY(ebuf)
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
91 IF(imat>0)THEN
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
96 ENDIF
97
98 eostype = mat_param(matid)%IEOS
99 eostype = ipm(4, matid) ! still used temporarily in this section
100 iter = 0
101 max_iter = 30
102 cont =.true.
103 error(1:nel) = ep30
104 tol = em4
105 converged(1:nel) =.false.
106
107 !===================================================================!
108 ! BUFFER INITIALIZATION !
109 !===================================================================!
110 ! local array instead of pointers since they may be reshaped with a
111 ! subgroup (1:NEL) c (1:NELG) depending on element PART (possibly several PARTS in a given group)
112 DO k = 1, nel
113 rhozero(k) = pm(1,matid)
114 psh(k) = pm(88, matid)
115 mat(k) = matid
116 pref(k) = psurf - rho0 * grav0 * depth(k) !RHO in : RHO0_mixture (gravity model applied to the mixture not to the single submaterial)
117 vol(k) = one ! Real volume value not useful here, just an indicator : ONE = compute, ZERO = do not compute
118 mu(k) = zero
119 sig(k,1) = -pm(31,matid)
120 sig(k,2) = -pm(31,matid)
121 sig(k,3) = -pm(31,matid)
122 sig(k,4) = zero
123 sig(k,5) = zero
124 sig(k,6) = zero
125 ENDDO
126
127 IF(imat==0)THEN ! WORK IN GBUF
128 DO k = 1, nel
129 i = list(k)
130 rho(k) = gbuf%RHO(k)
131 off(k) = gbuf%OFF(i)
132 eint(k) = gbuf%EINT(i)
133 v0(k) = gbuf%VOL(i)
134 ENDDO
135 ELSE ! THEN IMAT>0 WORK IN LBUF
136 DO k = 1, nel
137 i = list(k)
138 rho(k) = pm(1,matid) !submaterial
139 off(k) = lbuf%OFF(i)
140 eint(k) = lbuf%EINT(i)
141 v0(k) = lbuf%VOL(i)
142 ENDDO
143 ENDIF
144 !EINT=Eint/V in this context with law 151
145 !===================================================================!
146 ! ITERATIONS !
147 !===================================================================!
148 remaining_elts = nel !Number of elements for which convergence is not achieved
149 DO WHILE(cont .AND. iter < max_iter) !Start nonlinear solver loop
150 iter = iter + 1
151 DO k = 1, nel
152 mu(k) = rho(k) / rhozero(k) - one
153 df(k) = rhozero(k) / rho(k)
154 eint(k) = eint(k) / df(k) !with IFLAG==2 we need ESPE=Df*EINT
155 ENDDO
156 CALL eosmain(2 , nel , eostype , pm , off , eint,
157 . rho , rhozero , mu , mu2 , espe ,
158 . dvol , df , vol , mat , psh ,
159 . pres , dpdm , dpde , theta ,
160 . bufmat, sig , mu , mlw ,
161 . npf , tf , ebuf%VAR , nvareos, mat_param(matid),
162 . bid , nvartmp_eos, ebuf%VARTMP)
163 DO k=1,nel
164 eint(k)=eint(k)*df(k) ! set back to Eint/V
165 ENDDO
166 !===================================================================!
167 ! CHECK CONVERGENCY !
168 !===================================================================!
169 !loop over retained element in the current group I \in LIST(1:NEL)
170 DO k = 1, nel
171 IF (.NOT. converged(k)) THEN ! No need to take the square root, only the squared sound speed is needed here
172 dpdrho(k) = dpdm(k) / rhozero(k) !DPDM is total derivative (variation along isentropic path)
173 !GRUN(K) = DPDE(K) / (ONE + MU(K))
174 func(k) = pres(k)-pref(k)
175 dfunc(k) = dpdrho(k) !- GRUN(K) * PRES(K) / RHO(K)
176 incr = - func(k) / dfunc(k)
177 rho_old = rho(k)
178 rho(k) = rho(k) + incr
179 error(k)= max( abs(incr)/rhozero(k) , abs(func(k)) )
180
181 incr = - (pres(k)+psh(k)+half*dpdrho(k)*incr)*(rhozero(k)/rho(k)-rhozero(k)/rho_old)
182 eint(k) = eint(k) + incr !EINT is in fact Eint/V with law 151 here
183 IF(dpde(k)==zero)eint(k)=zero
184
185 IF (error(k) < tol .OR. iter == max_iter) THEN
186 converged(k) = .true.
187 remaining_elts = remaining_elts - 1
188 vol(k) = zero
189 i = list(k)
190 df(k) = rhozero(i) / rho(k)
191 IF(imat==0)THEN
192 gbuf%RHO(i) = rho(k)
193 gbuf%SIG(i ) = - pres(k)
194 gbuf%SIG(i + nelg) = - pres(k)
195 gbuf%SIG(i + 2 * nelg) = - pres(k)
196 gbuf%EINT(i) = eint(k)/df(k) !Eint/V with law 151 here => EINT*DF == Eint/V0
197 ELSE
198 lbuf%RHO(i) = rho(k)
199 lbuf%SIG(i ) = - pres(k)
200 lbuf%SIG(i + nelg) = - pres(k)
201 lbuf%SIG(i + 2 * nelg) = - pres(k)
202 lbuf%EINT(i) = eint(k)/df(k) !Eint/V with law 151 here
203 ENDIF
204 ENDIF
205 ENDIF
206 ENDDO
207 cont = (remaining_elts /= 0)
208 ENDDO ! WHILE
209
210
#define my_real
Definition cppsort.cpp:32
#define max(a, b)
Definition macros.h:21
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)
Definition eosmain.F:80