OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
invoi2.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/.
23C
24!||====================================================================
25!|| invoi2 ../starter/source/interfaces/inter2d1/invoi2.F
26!||--- called by ------------------------------------------------------
27!|| inint2 ../starter/source/interfaces/inter2d1/inint2.F
28!||====================================================================
29 SUBROUTINE invoi2(X,IRECT,LMSR,MSR,NSV,ILOC,IRTL,NSEG,NSN,NRT)
30C-----------------------------------------------
31C D e s c r i p t i o n
32C-----------------------------------------------
33C FOR A GIVEN SECND NODE FIND THE NEAREST MAIN SEGMENT
34C-----------------------------------------------
35C I m p l i c i t T y p e s
36C-----------------------------------------------
37#include "implicit_f.inc"
38C-----------------------------------------------
39C D u m m y A r g u m e n t s
40C-----------------------------------------------
41 INTEGER NSN,NRT
42 INTEGER IRECT(4,*), LMSR(*), MSR(*), NSV(*), ILOC(*), IRTL(*),NSEG(*)
43 my_real x(3,*)
44C-----------------------------------------------
45C L o c a l V a r i a b l e s
46C-----------------------------------------------
47 INTEGER II, I, J, K, NUM, NPT, JJ, LL, L, LG, M, MG
48 my_real cms, dms, result, c2, c3, s2, s3, cs, d2, cc
49C-----------------------------------------------
50C P r e - C o n d i t i o n
51C-----------------------------------------------
52 IF(nrt == 0) RETURN
53C-----------------------------------------------
54C S o u r c e L i n e s
55C-----------------------------------------------
56
57 DO ii=1,nsn !loop over nodes in list
58 i=nsv(ii) ! current secnd node
59 j=iloc(ii) ! nearest main node
60 k=msr(j)
61 cms = (x(2,i)-x(2,k))**2 + (x(3,i)-x(3,k))**2
62 num=nseg(j+1)-nseg(j) ! number of connected main segments
63 npt=nseg(j)-1 !pointer/index
64 !---------------------------------------------
65 ! NEAREST NODE
66 !---------------------------------------------
67 DO jj=1,num !loop over connected main segments
68 ll=lmsr(npt+jj) ! segment
69 l=irect(1,ll) ! first node of segment
70 IF(l == j) l=irect(2,ll)
71 lg=msr(l)
72 dms = (x(2,i)-x(2,lg))**2 + (x(3,i)-x(3,lg))**2
73 IF(dms < cms)THEN
74 cms=dms
75 j=l
76 k=lg
77 ENDIF
78 ENDDO
79 iloc(ii)=j
80 num=nseg(j+1)-nseg(j)
81 npt=nseg(j)-1
82 !------------------------------------------------
83 ! NEAREST SEGMENT : check if node projection si inside or outside the tested segment
84 ! D2 = (projected length on main segment)² - (segment length)²
85 ! a>0, b>0 : a²-b² > 0 => a-b >0 ; a²-b² < 0 => a-b < 0
86 !------------------------------------------------
87 ! CASE D2 < 0 CASE D2 > 0
88 ! projection of I projection of I
89 ! lies on segment is out of segment
90 !
91 ! I
92 ! + I <- secnd node
93 ! / +
94 ! / |
95 ! / |
96 ! +--D2-x----+ +---------+ x <- main segment
97 ! MG K MG K
98 !
99
100 result=ep20
101 DO jj=1,num !loop over connected segment
102 ll=lmsr(jj+npt) !lag segment
103 m=irect(1,ll) !first node
104 IF(m == j) m=irect(2,ll)
105 mg=msr(m)
106 ! main segment
107 c2=x(2,mg)-x(2,k)
108 c3=x(3,mg)-x(3,k)
109 ! other node on this segment -> secnd node
110 s2=x(2,i)-x(2,k)
111 s3=x(3,i)-x(3,k)
112 !
113 cs=c2*s2+c3*s3 ! dot product
114 d2=s2*s2+s3*s3 ! distance : lag second node -> fluid node
115 IF(cs > zero)THEN
116 cc=c2*c2+c3*c3 ! lagrange segment : length
117 d2=d2-cs*cs/cc !
118 ENDIF
119 IF(d2 <= result)THEN
120 result = d2
121 irtl(ii)=ll !nearest segment
122 ENDIF
123 ENDDO !next JJ
124
125
126 ENDDO ! NEXT II
127
128 RETURN
129 END
#define my_real
Definition cppsort.cpp:32
subroutine invoi2(x, irect, lmsr, msr, nsv, iloc, irtl, nseg, nsn, nrt)
Definition invoi2.F:30