OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
invoi2.F File Reference
#include "implicit_f.inc"

Go to the source code of this file.

Functions/Subroutines

subroutine invoi2 (x, irect, lmsr, msr, nsv, iloc, irtl, nseg, nsn, nrt)

Function/Subroutine Documentation

◆ invoi2()

subroutine invoi2 ( x,
integer, dimension(4,*) irect,
integer, dimension(*) lmsr,
integer, dimension(*) msr,
integer, dimension(*) nsv,
integer, dimension(*) iloc,
integer, dimension(*) irtl,
integer, dimension(*) nseg,
integer nsn,
integer nrt )

Definition at line 29 of file invoi2.F.

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
#define my_real
Definition cppsort.cpp:32