OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
inivol_set.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!|| inivol_set ../starter/source/initial_conditions/inivol/inivol_set.F
25!||--- called by ------------------------------------------------------
26!|| init_inivol ../starter/source/initial_conditions/inivol/init_inivol.F90
27!||--- uses -----------------------------------------------------
28!|| message_mod ../starter/share/message_module/message_mod.F
29!||====================================================================
30 SUBROUTINE inivol_set(UVAR , NUVAR , NEL , KVOL , MLW ,
31 . ELBUF_TAB, NG , NBSUBMAT, MULTI_FVM ,
32 . IDP , IPART , NFT , IMID,
33 . MAT_PARAM)
34C-----------------------------------------------
35C M o d u l e s
36C-----------------------------------------------
37 USE elbufdef_mod
38 USE multi_fvm_mod
39 USE elbufdef_mod
40 USE message_mod
41 USE constant_mod, ONLY : nine_over_10
42 USE multimat_param_mod , ONLY : m51_n0phas, m51_nvphas
43 USE matparam_def_mod , ONLY : matparam_struct_
44C-----------------------------------------------
45C I m p l i c i t T y p e s
46C-----------------------------------------------
47#include "implicit_f.inc"
48C-----------------------------------------------
49C C o m m o n B l o c k s
50C-----------------------------------------------
51#include "com01_c.inc"
52#include "com04_c.inc"
53C-----------------------------------------------
54C D u m m y A r g u m e n t s
55C-----------------------------------------------
56 INTEGER,INTENT(IN) :: IMID
57 INTEGER,INTENT(IN) :: NEL, NUVAR, MLW, NG, NBSUBMAT,IDP,IPART(*),NFT
58 my_real,INTENT(INOUT) :: KVOL(NBSUBMAT,NEL)
59 my_real,INTENT(INOUT) :: uvar(nel,nuvar)
60 TYPE(multi_fvm_struct),INTENT(IN) :: MULTI_FVM
61 TYPE(elbuf_struct_), TARGET, DIMENSION(NGROUP),INTENT(INOUT) :: ELBUF_TAB
62 TYPE (MATPARAM_STRUCT_) ,DIMENSION(NUMMAT) ,INTENT(IN) :: MAT_PARAM
63C-----------------------------------------------
64C L o c a l V a r i a b l e s
65C-----------------------------------------------
66 INTEGER :: I, IMAT, KK
67 TYPE(G_BUFEL_) ,POINTER :: GBUF
68 TYPE(L_BUFEL_) ,POINTER :: LBUF
69 my_real :: p, p1,p2,p3,p4,sumvf,ratio
70 my_real :: vfrac0(nbsubmat)
71 INTEGER :: default_SUBMAT_id(NEL)
72C-----------------------------------------------
73C S o u r c e L i n e s
74C-----------------------------------------------
75
76 ! DETERMINE DEFAULT SUBMAT ID
77 vfrac0(1:nbsubmat) = mat_param(imid)%MULTIMAT%VFRAC(1:nbsubmat)
78 default_submat_id(1:nel) = max(1, maxloc(vfrac0,1))
79
80 !---CHECK UNOCCUPIPED SUBVOLUME AND FILL WITH DEFAULT PHASE IF SUM(vfrac>1) display an error message.
81 DO i=1,nel
82 IF(ipart(i+nft) /= idp)cycle
83 sumvf = sum(kvol(1:nbsubmat,i))
84 imat = default_submat_id(i)
85 IF(sumvf > one+em06)THEN
86 !not expected, user input must be checked : error message
87 sumvf = sum(kvol(1:nbsubmat,i))
88 sumvf = sumvf - kvol(imat,i)
89 IF(sumvf <= one .AND. sumvf > zero)THEN ! sumvf is here calculated in range 2:nbsumat
90 kvol(imat,i)=one-sumvf
91 ELSE
92 sumvf = sum(kvol(1:nbsubmat,i))
93 ratio=one/sumvf
94 kvol(1:nbsubmat,i)=ratio*kvol(1:nbsubmat,i)
95 ENDIF
96 ELSEIF(sumvf < one-em06)THEN
97 !fill unoccupied subvolume with phase-1
98 kvol(imat,i) = kvol(imat,i) + one-sumvf
99 ELSEIF(sumvf >= one-em06 .AND. sumvf <= one+em06)THEN
100 !get rid of precision issue so that sumvf is exactly 1.000000
101 ratio=one/sumvf
102 kvol(1:nbsubmat,i)=ratio*kvol(1:nbsubmat,i)
103 ENDIF
104 ENDDO
105
106 !---set initial volumetric fraction result (KVOL) in material buffer (+ posteriori checks)
107 IF(mlw == 51)THEN
108 DO imat=1,4
109 kk = m51_n0phas + (imat-1)*m51_nvphas
110 DO i=1,nel
111 IF(ipart(i+nft) /= idp)cycle
112 uvar(i,1+kk) = kvol(imat,i)
113 uvar(i,23+kk) = kvol(imat,i)
114 ENDDO
115 ENDDO
116 DO i=1,nel
117 IF(ipart(i+nft) /= idp)cycle
118 kk = m51_n0phas + (1-1)*m51_nvphas
119 p1 = uvar(i,18+kk)
120 kk = m51_n0phas + (2-1)*m51_nvphas
121 p2 = uvar(i,18+kk)
122 kk = m51_n0phas + (3-1)*m51_nvphas
123 p3 = uvar(i,18+kk)
124 kk = m51_n0phas + (4-1)*m51_nvphas
125 p4 = uvar(i,18+kk)
126 sumvf=sum(kvol(1:nbsubmat,i))
127 p = kvol(1,i)*p1 + kvol(2,i)*p2 + kvol(3,i)*p3 + kvol(4,i)*p4
128 uvar(i,4) = p
129 ENDDO
130 ELSEIF(mlw == 37)THEN
131 DO i=1,nel
132 IF(ipart(i+nft) /= idp)cycle
133 uvar(i,4) = kvol(1,i)
134 uvar(i,5) = kvol(2,i)
135 ENDDO
136 ELSEIF(mlw == 151)THEN
137 gbuf => elbuf_tab(ng)%GBUF
138 DO imat=1,multi_fvm%NBMAT
139 lbuf => elbuf_tab(ng)%BUFLY(imat)%LBUF(1,1,1)
140 DO i=1,nel
141 IF(ipart(i+nft) /= idp)cycle
142 lbuf%VOL(i) = kvol(imat,i) * gbuf%VOL(i)
143 ENDDO
144 ENDDO
145 ENDIF
146
147
148 RETURN
149 END
subroutine inivol_set(uvar, nuvar, nel, kvol, mlw, elbuf_tab, ng, nbsubmat, multi_fvm, idp, ipart, nft, imid, mat_param)
Definition inivol_set.F:34
#define max(a, b)
Definition macros.h:21