OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
alew5.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!|| alew5 ../engine/source/ale/grid/alew5.F
25!||--- called by ------------------------------------------------------
26!|| alewdx ../engine/source/ale/grid/alewdx.F
27!||--- calls -----------------------------------------------------
28!|| alewdx_grid_bcs ../engine/source/ale/grid/alewdx_grid_bcs.F
29!|| my_barrier ../engine/source/system/machine.F
30!|| spmd_xvois ../engine/source/mpi/fluid/spmd_cfd.F
31!||--- uses -----------------------------------------------------
32!|| ale_connectivity_mod ../common_source/modules/ale/ale_connectivity_mod.f
33!|| ale_mod ../common_source/modules/ale/ale_mod.F
34!||====================================================================
35 SUBROUTINE alew5(
36 1 X ,V ,W , WA ,
37 2 ALE_NN_CONNECT ,NALE ,NODFT , NODLT ,
38 3 NBRCVOIS ,NBSDVOIS,LNRCVOIS, LNSDVOIS,
39 4 SKEW ,ISKEW ,ICODT )
40C-----------------------------------------------
41C M o d u l e s
42C-----------------------------------------------
44 USE ale_mod
45C-----------------------------------------------
46C D e s c r i p t i o n
47C-----------------------------------------------
48C LAPLACIAN GRID SMOOTHING
49C Compute Grid for /ALE/GRID/LAPLACIAN
50C-----------------------------------------------
51C D: is global displacement from t=0
52C W: is Grid displacement
53C WEIGHT : 1/n = umbrella
54C l_ij/sum(l_ik,k) = fujiwara operator (we must update CFL with DT2< edge_min**2/LAMBDA)
55C
56C please note that W will be used as a displacement in this subroutine and translated into grid velocity again before returning
57C
58C X,D,V are allocated to SX,SD,DV=3*(NUMNOD_L+NUMVVOIS_L)
59C in grid subroutine it may needed to access nodes which
60C are connected to a remote elem. They are sored in X(1:3,NUMNOD+1:)
61C Consequently X is defined here X(3,SX/3) instead of X(3,NUMNOD) as usually
62C-----------------------------------------------
63C I m p l i c i t T y p e s
64C-----------------------------------------------
65#include "implicit_f.inc"
66C-----------------------------------------------
67C C o m m o n B l o c k s
68C-----------------------------------------------
69#include "com01_c.inc"
70#include "com04_c.inc"
71#include "com08_c.inc"
72#include "param_c.inc"
73#include "tabsiz_c.inc"
74C-----------------------------------------------
75C D u m m y A r g u m e n t s
76C-----------------------------------------------
77! SPMD CASE : SX >= 3*NUMNOD (SX = 3*(NUMNOD_L+NRCVVOIS_L))
78! X(1:3,1:NUMNOD) : local nodes
79! (1:3, NUMNOD+1:) additional nodes (also on adjacent domains but connected to the boundary of the current domain)
80! idem with D(SD), and V(SV)
81C-----------------------------------------------
82 INTEGER NALE(NUMNOD), NODFT, NODLT,
83 . NBRCVOIS(*),NBSDVOIS(*),
84 . LNRCVOIS(*),LNSDVOIS(*),ISKEW(*),ICODT(*)
85 my_real X(3,SX/3),V(3,SV/3), W(3,SW/3), WA(3,*), SKEW(LSKEW,*)
86 TYPE(t_connectivity), INTENT(IN) :: ALE_NN_CONNECT
87C-----------------------------------------------
88C L o c a l V a r i a b l e s
89C-----------------------------------------------
90 INTEGER I, LENCOM, K, ITER,NITER,NUM
91 my_real VEC(3),LAMBDA,IFORM, WEIGHT(6),SOM,SOM2,MIN_DIST,MAX_DIST
92 my_real, DIMENSION(:), ALLOCATABLE :: DIST
93 INTEGER :: IAD, IAD1, IAD2, NODE_ID
94C-----------------------------------------------
95C S o u r c e L i n e s
96C-----------------------------------------------
97 lambda=ale%GRID%ALPHA
98 niter=nint(ale%GRID%VGX)
99 iform=nint(ale%GRID%GAMMA)
100
101 wa(1:3,nodft:nodlt)=x(1:3,nodft:nodlt)
102 CALL my_barrier
103
104 DO iter=1,niter
105
106 IF(nspmd > 1)THEN
107!$OMP SINGLE
108 lencom = nbrcvois(nspmd+1)+nbsdvois(nspmd+1)
109 CALL spmd_xvois(wa ,nbrcvois,nbsdvois,lnrcvois,lnsdvois,lencom)
110!$OMP END SINGLE
111 END IF
112
113 IF(iform == 1)THEN
114 !default formulation (2020.0)
115 DO i = nodft, nodlt
116 IF(iabs(nale(i)) == 1) THEN
117 iad1 = ale_nn_connect%IAD_CONNECT(i)
118 iad2 = ale_nn_connect%IAD_CONNECT(i + 1) - 1
119 num = 0
120 vec(1:3) = zero
121 DO iad = iad1, iad2
122 num = num + 1
123 node_id = ale_nn_connect%CONNECTED(iad)
124 vec(1) = vec(1) + wa(1, node_id)
125 vec(2) = vec(2) + wa(2, node_id)
126 vec(3) = vec(3) + wa(3, node_id)
127 ENDDO
128
129 vec(1) = vec(1) / num - wa(1,i)
130 vec(2) = vec(2) / num - wa(2,i)
131 vec(3) = vec(3) / num - wa(3,i)
132
133 !update VEC depending on boundary conditions
134 CALL alewdx_grid_bcs(skew, iskew, icodt, vec, nale, i) !set VEC to 0 depending on user BCS
135 w(1,i) = wa(1,i) + lambda * vec(1)
136 w(2,i) = wa(2,i) + lambda * vec(2)
137 w(3,i) = wa(3,i) + lambda * vec(3)
138
139 ELSE
140 w(1,i) = wa(1,i)
141 w(2,i) = wa(2,i)
142 w(3,i) = wa(3,i)
143 ENDIF
144 ENDDO
145 ELSEIF(iform == 2)THEN
146 ! experimental formulation
147 DO i = nodft, nodlt
148 IF(iabs(nale(i)) == 1) THEN
149 iad1 = ale_nn_connect%IAD_CONNECT(i)
150 iad2 = ale_nn_connect%IAD_CONNECT(i + 1) - 1
151 num = 0
152 vec(1:3) = zero
153 ALLOCATE(dist(iad2 - iad1 + 1))
154 DO iad = iad1, iad2
155 num = num + 1
156 node_id = ale_nn_connect%CONNECTED(iad)
157 vec(1) = wa(1,node_id) - wa(1,i)
158 vec(2) = wa(2,node_id) - wa(2,i)
159 vec(3) = wa(3,node_id) - wa(3,i)
160 dist(iad) = sqrt(vec(1)*vec(1)+vec(2)*vec(2)+vec(3)*vec(3))
161
162 ENDDO
163 som = sum(dist(1:num))
164
165 min_dist = minval(dist(1:num))
166 max_dist = maxval(dist(1:num))
167 som2 = zero
168 DO k=1,num
169 som2 = som2 + one / dist(k)
170 ENDDO
171
172 DO k=1,num
173 weight(k)=dist(k)/som
174 ENDDO
175 vec(1:3)=zero
176 DO iad = iad1, iad2
177 node_id = ale_nn_connect%CONNECTED(iad)
178 vec(1) = vec(1) + weight(k) * (wa(1,node_id) - wa(1,i))
179 vec(2) = vec(2) + weight(k) * (wa(2,node_id) - wa(2,i))
180 vec(3) = vec(3) + weight(k) * (wa(3,node_id) - wa(3,i))
181 ENDDO
182
183 !update VEC depending on boundary conditions
184 CALL alewdx_grid_bcs(skew, iskew, icodt, vec ,nale, i)
185 w(1,i) = wa(1,i) + lambda * vec(1)
186 w(2,i) = wa(2,i) + lambda * vec(2)
187 w(3,i) = wa(3,i) + lambda * vec(3)
188
189 ELSE
190 w(1,i)=wa(1,i)
191 w(2,i)=wa(2,i)
192 w(3,i)=wa(3,i)
193 ENDIF
194 DEALLOCATE(dist)
195 ENDDO
196 ENDIF
197
198 CALL my_barrier
199 wa(1:3,nodft:nodlt)=w(1:3,nodft:nodlt)
200
201 ENDDO !next ITER
202
203
204 DO i = nodft, nodlt
205 IF(iabs(nale(i)) == 1 .AND. dt2 > zero) THEN
206 w(1,i)=(wa(1,i)-x(1,i))/dt2
207 w(2,i)=(wa(2,i)-x(2,i))/dt2
208 w(3,i)=(wa(3,i)-x(3,i))/dt2
209 ELSEIF(nale(i) == 0)THEN
210 w(1,i)=v(1,i)
211 w(2,i)=v(2,i)
212 w(3,i)=v(3,i)
213 ELSE
214 w(1,i)=zero
215 w(2,i)=zero
216 w(3,i)=zero
217 ENDIF
218 ENDDO
219
220 RETURN
221 END
subroutine alew5(x, v, w, wa, ale_nn_connect, nale, nodft, nodlt, nbrcvois, nbsdvois, lnrcvois, lnsdvois, skew, iskew, icodt)
Definition alew5.F:40
subroutine alewdx_grid_bcs(skew, iskew, icodt, vec, nale, node_id)
type(ale_) ale
Definition ale_mod.F:249
subroutine spmd_xvois(x, nbrcvois, nbsdvois, lnrcvois, lnsdvois, lencom)
Definition spmd_cfd.F:40
subroutine my_barrier
Definition machine.F:31