OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
convec.F
Go to the documentation of this file.
1Copyright> OpenRadioss
2Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3Copyright>
4Copyright> This program is free software: you can redistribute it and/or modify
5Copyright> it under the terms of the GNU Affero General Public License as published by
6Copyright> the Free Software Foundation, either version 3 of the License, or
7Copyright> (at your option) any later version.
8Copyright>
9Copyright> This program is distributed in the hope that it will be useful,
10Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12Copyright> GNU Affero General Public License for more details.
13Copyright>
14Copyright> You should have received a copy of the GNU Affero General Public License
15Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16Copyright>
17Copyright>
18Copyright> Commercial Alternative: Altair Radioss Software
19Copyright>
20Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21Copyright> software under a commercial license. Contact Altair to discuss further if the
22Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23!||====================================================================
24!|| convec ../engine/source/constraints/thermic/convec.F
25!||--- called by ------------------------------------------------------
26!|| resol ../engine/source/engine/resol.F
27!||--- calls -----------------------------------------------------
28!|| finter ../engine/source/tools/curve/finter.F
29!|| omp_get_thread_num ../engine/source/engine/openmp_stub.F90
30!||--- uses -----------------------------------------------------
31!|| glob_therm_mod ../common_source/modules/mat_elem/glob_therm_mod.F90
32!|| python_funct_mod ../common_source/modules/python_mod.F90
33!|| sensor_mod ../common_source/modules/sensor_mod.F90
34!||====================================================================
35 SUBROUTINE convec (IBCV ,FCONV ,NPC ,TF , X ,
36 1 TEMP ,NSENSOR ,SENSOR_TAB ,FTHE ,IAD ,
37 2 FTHESKY, PYTHON ,GLOB_THERM)
38C-----------------------------------------------
39C M o d u l e s
40C-----------------------------------------------
41 USE python_funct_mod
42 USE sensor_mod
43 use glob_therm_mod
44C-----------------------------------------------
45C I m p l i c i t T y p e s
46C-----------------------------------------------
47#include "implicit_f.inc"
48#include "comlock.inc"
49#include "param_c.inc"
50C-----------------------------------------------
51C C o m m o n B l o c k s
52C-----------------------------------------------
53#include "com04_c.inc"
54#include "com08_c.inc"
55#include "parit_c.inc"
56C-----------------------------------------------,
57C D u m m y A r g u m e n t s
58C-----------------------------------------------
59 type (glob_therm_) ,intent(inout) :: glob_therm
60 INTEGER ,INTENT(IN) :: NSENSOR
61 INTEGER NPC(*),IAD(4,*)
62 INTEGER IBCV(GLOB_THERM%NICONV,*)
63C REAL
65 . fconv(glob_therm%LFACTHER,*), tf(*), x(3,*),
66 . fthesky(lsky), temp(*), fthe(*)
67 TYPE (SENSOR_STR_) ,DIMENSION(NSENSOR) ,INTENT(IN) :: SENSOR_TAB
68 TYPE(PYTHON_) :: PYTHON
69C-----------------------------------------------
70C L o c a l V a r i a b l e s
71C-----------------------------------------------
72 INTEGER NL,N1,N2,N3,N4,ISENS,IFUNC_OLD,IFUNC,IAD1,IAD2,IAD3,IAD4,IFLAG
73 my_real :: NX, NY,NZ, DYDX,TS,FLUX,TS_OLD,FCX,FCY,T_INF,TE,AREA,H,
74 . startt, stopt, fcy_old, offg
75 my_real :: heat_conv_l ! thread-local
76 my_real finter
77 EXTERNAL finter
78 INTEGER :: OMP_GET_THREAD_NUM,ITSK
79 EXTERNAL omp_get_thread_num
80 INTEGER S1
81 INTEGER :: ISMOOTH
82
83C=======================================================================
84 ifunc_old = 0
85 ts_old = zero
86 fcy_old= zero
87 heat_conv_l = zero
88 s1 = numnod
89 t_inf = zero
90!
91 IF(iparit==0) THEN
92 itsk = omp_get_thread_num()
93
94C-----------------------------------------------------------
95C CODE SPMD PARITH/OFF OU SMP NE PAS OUBLIER LE CODE P/ON !
96C-----------------------------------------------------------
97!$OMP DO SCHEDULE(GUIDED)
98 DO nl=1,glob_therm%NUMCONV
99 offg = fconv(6,nl)
100 IF(offg <= zero) cycle
101
102 startt = fconv(4,nl)
103 stopt = fconv(5,nl)
104C
105 isens = ibcv(6,nl)
106 IF(isens == 0)THEN
107 ts = tt*glob_therm%THEACCFACT - startt
108 ELSE
109 startt = startt + sensor_tab(isens)%TSTART
110 stopt = stopt + sensor_tab(isens)%TSTART
111 ts = tt*glob_therm%THEACCFACT -(startt + sensor_tab(isens)%TSTART)
112 ENDIF
113C
114 IF(tt*glob_therm%THEACCFACT < startt) cycle
115 IF(tt*glob_therm%THEACCFACT > stopt ) cycle
116 n1 = ibcv(1,nl)
117 n2 = ibcv(2,nl)
118 n3 = ibcv(3,nl)
119 n4 = ibcv(4,nl)
120 ifunc = ibcv(5,nl)
121 fcy = fconv(1,nl)
122 fcx = fconv(2,nl)
123 h = fconv(3,nl)
124C----------------------
125C CONVECTION FLUX
126C----------------------
127 IF(ifunc_old /= ifunc .OR. ts_old /= ts .OR. fcy_old /= fcy ) THEN
128 ismooth = 0
129 IF (ifunc > 0) ismooth = npc(2*nfunct+ifunc+1)
130 IF(ismooth < 0) THEN
131 CALL python_call_funct1d(python, -ismooth,ts*fcx, t_inf)
132 t_inf = fcy*t_inf
133 ELSE
134 t_inf = fcy*finter(ifunc, ts*fcx,npc,tf,dydx)
135 ENDIF
136 ifunc_old = ifunc
137 ts_old = ts
138 fcy_old= fcy
139 ENDIF
140C ANALYSE 3D
141 IF(n4 > 0)THEN
142C
143 nx= (x(2,n3)-x(2,n1))*(x(3,n4)-x(3,n2))
144 + -(x(3,n3)-x(3,n1))*(x(2,n4)-x(2,n2))
145 ny= (x(3,n3)-x(3,n1))*(x(1,n4)-x(1,n2))
146 + -(x(1,n3)-x(1,n1))*(x(3,n4)-x(3,n2))
147 nz= (x(1,n3)-x(1,n1))*(x(2,n4)-x(2,n2))
148 + -(x(2,n3)-x(2,n1))*(x(1,n4)-x(1,n2))
149C
150 te = fourth*(temp(n1) + temp(n2) + temp(n3) + temp(n4))
151 area = half*sqrt( nx*nx + ny*ny + nz*nz)
152 flux = area*h*(t_inf - te)*dt1*glob_therm%THEACCFACT
153 heat_conv_l = heat_conv_l + flux
154 flux = fourth*flux
155C
156 fthe(s1*itsk+n1) = fthe(s1*itsk+n1) + flux
157 fthe(s1*itsk+n2) = fthe(s1*itsk+n2) + flux
158 fthe(s1*itsk+n3)= fthe(s1*itsk+n3) + flux
159 fthe(s1*itsk+n4)= fthe(s1*itsk+n4) + flux
160
161C
162 ELSEIF(n3 > 0) THEN !TRUE TRIANGLES
163 nx= (x(2,n3)-x(2,n1))*(x(3,n3)-x(3,n2))
164 + -(x(3,n3)-x(3,n1))*(x(2,n3)-x(2,n2))
165 ny= (x(3,n3)-x(3,n1))*(x(1,n3)-x(1,n2))
166 + -(x(1,n3)-x(1,n1))*(x(3,n3)-x(3,n2))
167 nz= (x(1,n3)-x(1,n1))*(x(2,n3)-x(2,n2))
168 + -(x(2,n3)-x(2,n1))*(x(1,n3)-x(1,n2))
169C
170 te = third*(temp(n1) + temp(n2) + temp(n3) )
171 area = half*sqrt( nx*nx + ny*ny + nz*nz)
172 flux = area*h*(t_inf - te)*dt1*glob_therm%THEACCFACT
173 heat_conv_l = heat_conv_l + flux
174 flux = third*flux
175C
176 fthe(s1*itsk+n1) = fthe(s1*itsk+n1) + flux
177 fthe(s1*itsk+n2) = fthe(s1*itsk+n2) + flux
178 fthe(s1*itsk+n3)= fthe(s1*itsk+n3) + flux
179
180 ELSE !ANALYSE 2D
181 ny= -x(3,n2)+x(3,n1)
182 nz= x(2,n2)-x(2,n1)
183C
184 te = half*(temp(n1) + temp(n2) )
185 area = sqrt( ny*ny + nz*nz)
186 flux = area*h*(t_inf - te)*dt1*glob_therm%THEACCFACT
187 heat_conv_l = heat_conv_l + flux
188 flux = half*flux
189C
190 fthe(s1*itsk+n1)=fthe(s1*itsk+n1) + flux
191 fthe(s1*itsk+n2)=fthe(s1*itsk+n2) + flux
192C
193 ENDIF
194 ENDDO
195!$OMP END DO
196
197!$OMP CRITICAL
198 glob_therm%HEAT_CONV = glob_therm%HEAT_CONV + heat_conv_l
199!$OMP END CRITICAL
200 ELSE
201C-------------------------
202C CODE SPMD PARITH/ON
203C CODE NON VECTORIEL
204C-------------------------
205!$OMP DO SCHEDULE(GUIDED)
206 DO nl=1,glob_therm%NUMCONV
207 startt = fconv(4,nl)
208 stopt = fconv(5,nl)
209 offg = fconv(6,nl)
210 isens = ibcv(6,nl)
211 IF(isens == 0)THEN
212 ts = tt*glob_therm%THEACCFACT - startt
213 ELSE
214 startt = startt + sensor_tab(isens)%TSTART
215 stopt = stopt + sensor_tab(isens)%TSTART
216 ts = tt*glob_therm%THEACCFACT -(startt + sensor_tab(isens)%TSTART)
217 ENDIF
218 iflag = 1
219 IF(tt*glob_therm%THEACCFACT < startt) iflag = 0
220 IF(tt*glob_therm%THEACCFACT > stopt ) iflag = 0
221 IF(offg <= zero) iflag = 0
222C---------------------
223C CONVECTION FLUX
224C---------------------
225 IF(iflag==1) THEN
226 n1 =ibcv(1,nl)
227 n2 =ibcv(2,nl)
228 n3 =ibcv(3,nl)
229 n4 =ibcv(4,nl)
230 ifunc = ibcv(5,nl)
231 fcy = fconv(1,nl)
232 fcx = fconv(2,nl)
233 h = fconv(3,nl)
234 IF(ifunc_old /= ifunc .OR. ts_old /= ts) THEN
235 ismooth = 0
236 IF (ifunc > 0) ismooth = npc(2*nfunct+ifunc+1)
237 IF(ismooth < 0) THEN
238 CALL python_call_funct1d(python, -ismooth,ts*fcx, t_inf)
239 t_inf = fcy*t_inf
240 ELSE
241 t_inf = fcy*finter(ifunc,ts*fcx,npc,tf,dydx)
242 ENDIF
243 ifunc_old = ifunc
244 ts_old = ts
245 ENDIF
246C ANALYSE 3D
247 IF(n4 > 0)THEN
248 nx= (x(2,n3)-x(2,n1))*(x(3,n4)-x(3,n2))
249 + -(x(3,n3)-x(3,n1))*(x(2,n4)-x(2,n2))
250 ny= (x(3,n3)-x(3,n1))*(x(1,n4)-x(1,n2))
251 + -(x(1,n3)-x(1,n1))*(x(3,n4)-x(3,n2))
252 nz= (x(1,n3)-x(1,n1))*(x(2,n4)-x(2,n2))
253 + -(x(2,n3)-x(2,n1))*(x(1,n4)-x(1,n2))
254C
255 te = fourth*(temp(n1) + temp(n2) + temp(n3) + temp(n4))
256 area = half*sqrt( nx*nx + ny*ny + nz*nz)
257 flux = area*h*(t_inf - te)*dt1*glob_therm%THEACCFACT
258 heat_conv_l = heat_conv_l + flux
259 flux = fourth*flux
260C
261 iad1 = iad(1,nl)
262 fthesky(iad1) = flux
263 iad2 = iad(2,nl)
264 fthesky(iad2) = flux
265 iad3 = iad(3,nl)
266 fthesky(iad3) = flux
267 iad4 = iad(4,nl)
268 fthesky(iad4) = flux
269C
270 ELSEIF( n3 > 0) THEN !TRUE TRIANGLES.
271 nx= (x(2,n3)-x(2,n1))*(x(3,n3)-x(3,n2))
272 + -(x(3,n3)-x(3,n1))*(x(2,n3)-x(2,n2))
273 ny= (x(3,n3)-x(3,n1))*(x(1,n3)-x(1,n2))
274 + -(x(1,n3)-x(1,n1))*(x(3,n3)-x(3,n2))
275 nz= (x(1,n3)-x(1,n1))*(x(2,n3)-x(2,n2))
276 + -(x(2,n3)-x(2,n1))*(x(1,n3)-x(1,n2))
277C
278 te = third*(temp(n1) + temp(n2) + temp(n3) )
279 area = half*sqrt( nx*nx + ny*ny + nz*nz)
280 flux = area*h*(t_inf - te)*dt1*glob_therm%THEACCFACT
281 heat_conv_l = heat_conv_l + flux
282 flux = third*flux
283C
284 iad1 = iad(1,nl)
285 fthesky(iad1) = flux
286C
287 iad2 = iad(2,nl)
288 fthesky(iad2) = flux
289C
290 iad3 = iad(3,nl)
291 fthesky(iad3) = flux
292C
293 ELSE !ANALYSE 2D
294 ny= -x(3,n2)+x(3,n1)
295 nz= x(2,n2)-x(2,n1)
296C
297 te = half*(temp(n1) + temp(n2) )
298 area = sqrt( ny*ny + nz*nz)
299 flux = area*h*(t_inf - te)*dt1*glob_therm%THEACCFACT
300 heat_conv_l = heat_conv_l + flux
301 flux = half*flux
302C
303 iad1 = iad(1,nl)
304 fthesky(iad1) = flux
305C
306 iad2 = iad(2,nl)
307 fthesky(iad2) = flux
308C
309 ENDIF
310 ELSE ! IFLAG=0
311 iad1 = iad(1,nl)
312 fthesky(iad1) = zero
313 iad2 = iad(2,nl)
314 fthesky(iad2) = zero
315 n3 = ibcv(3,nl)
316 n4 = ibcv(4,nl)
317 IF(n4 > 0)THEN
318 iad3 = iad(3,nl)
319 fthesky(iad3) = zero
320 iad4 = iad(4,nl)
321 fthesky(iad4) = zero
322 ELSEIF(n3 > 0)THEN
323 iad3 = iad(3,nl)
324 fthesky(iad3) = zero
325 ENDIF
326 ENDIF
327 ENDDO
328!$OMP END DO
329
330!$OMP CRITICAL
331 glob_therm%HEAT_CONV = glob_therm%HEAT_CONV + heat_conv_l
332!$OMP END CRITICAL
333C
334 ENDIF
335C
336 RETURN
337 END
subroutine convec(ibcv, fconv, npc, tf, x, temp, nsensor, sensor_tab, fthe, iad, fthesky, python, glob_therm)
Definition convec.F:38
#define my_real
Definition cppsort.cpp:32