CalculiX  2.13
A Free Software Three-Dimensional Structural Finite Element Program
linkdissimilar.f File Reference

Go to the source code of this file.

Functions/Subroutines

subroutine linkdissimilar (co, csab, rcscg, rcs0cg, zcscg, zcs0cg, nrcg, nzcg, straight, nodef, ratio, nterms, rp, zp, netri, nodei, ifacetet, inodface, noded, xn, yn, zn, ier, multistage)
 

Function/Subroutine Documentation

◆ linkdissimilar()

subroutine linkdissimilar ( real*8, dimension(3,*)  co,
real*8, dimension(7)  csab,
real*8, dimension(*)  rcscg,
real*8, dimension(*)  rcs0cg,
real*8, dimension(*)  zcscg,
real*8, dimension(*)  zcs0cg,
integer, dimension(*)  nrcg,
integer, dimension(*)  nzcg,
real*8, dimension(9,*)  straight,
integer, dimension(8)  nodef,
real*8, dimension(9)  ratio,
integer  nterms,
real*8  rp,
real*8  zp,
integer  netri,
integer  nodei,
integer, dimension(*)  ifacetet,
integer, dimension(*)  inodface,
integer  noded,
real*8  xn,
real*8  yn,
real*8  zn,
integer  ier,
logical  multistage 
)
23 !
24 ! links dissimilar meshes for cyclic symmetry
25 !
26  implicit none
27 !
28  logical multistage
29 !
30  integer nneigh,j,nodef(8),nodei,nrcg(*),
31  & nzcg(*),nterms,ineigh(20),itrimax,i,netri,
32  & itri,ifirst,ilast,ifacetet(*),inodface(*),noded,ier
33 !
34  real*8 co(3,*),csab(7),rp,zp,xi,et,xn,yn,zn,rp1,zp1,rp2,zp2,
35  & straight(9,*),zcscg(*),rcscg(*),zcs0cg(*),rcs0cg(*),distmax,
36  & dist,ratio(9),pneigh(3,9),pnode(3),xap,yap,zap,
37  & x12,y12,z12,x13,y13,z13,area,typdist
38 !
39 ! finding for each node on the right side a corresponding
40 ! triangle
41 !
42  nneigh=10
43 !
44  call near2d(rcs0cg,zcs0cg,rcscg,zcscg,nrcg,nzcg,rp,zp,
45  & netri,ineigh,nneigh)
46 !
47  distmax=1.d30
48 !
49  do j=1,nneigh
50  itri=ineigh(j)
51  dist=max(rp*straight(1,itri)+zp*straight(2,itri)+
52  & straight(3,itri),0.d0)+
53  & max(rp*straight(4,itri)+zp*straight(5,itri)+
54  & straight(6,itri),0.d0)+
55  & max(rp*straight(7,itri)+zp*straight(8,itri)+
56  & straight(9,itri),0.d0)
57  if(dist.le.0.d0) then
58  distmax=0.d0
59  itrimax=itri
60  exit
61  endif
62  if(dist.lt.distmax) then
63  itrimax=itri
64  distmax=dist
65  endif
66  enddo
67 !
68  itri=itrimax
69 !
70  ilast=ifacetet(itri)
71  do
72  itri=itri-1
73  if(itri.eq.0) then
74  ifirst=0
75  exit
76  endif
77  if(ifacetet(itri).ne.ilast) then
78  ifirst=ifacetet(itri)
79  exit
80  endif
81  enddo
82  nterms=ilast-ifirst
83 !
84  if(multistage) then
85  do i=1,nterms
86  nodef(i)=inodface(ifirst+i)
87  do j=1,3
88  pneigh(j,i)=co(j,nodef(i))
89  enddo
90  enddo
91  do j=1,3
92  pnode(j)=co(j,nodei)
93  enddo
94 !
95  xap=pnode(1)-csab(1)
96  yap=pnode(2)-csab(2)
97  zap=pnode(3)-csab(3)
98 !
99  zp1=xap*xn+yap*yn+zap*zn
100  rp1=dsqrt((xap-zp1*xn)**2+(yap-zp1*yn)**2+(zap-zp1*zn)**2)
101  else
102  do i=1,nterms
103  nodef(i)=inodface(ifirst+i)
104 !
105  xap=co(1,nodef(i))-csab(1)
106  yap=co(2,nodef(i))-csab(2)
107  zap=co(3,nodef(i))-csab(3)
108 !
109  zp1=xap*xn+yap*yn+zap*zn
110  pneigh(1,i)=zp1
111  pneigh(2,i)=
112  & dsqrt((xap-zp1*xn)**2+(yap-zp1*yn)**2+(zap-zp1*zn)**2)
113  pneigh(3,i)=0.d0
114  enddo
115 !
116  pnode(1)=zp
117  pnode(2)=rp
118  pnode(3)=0.d0
119  endif
120 !
121  call attach(pneigh,pnode,nterms,ratio,dist,xi,et)
122 !
123  if(multistage) then
124 !
125  xap=pnode(1)-csab(1)
126  yap=pnode(2)-csab(2)
127  zap=pnode(3)-csab(3)
128 !
129  zp2=xap*xn+yap*yn+zap*zn
130  rp2=dsqrt((xap-zp2*xn)**2+(yap-zp2*yn)**2+(zap-zp2*zn)**2)
131 !
132  do j=1,3
133  co(j,nodei)=pnode(j)
134  enddo
135  else
136  do j=1,3
137  co(j,nodei)=0.d0
138  do i=1,nterms
139  co(j,nodei)=co(j,nodei)+ratio(i)*co(j,nodef(i))
140  enddo
141  enddo
142  endif
143 !
144 ! check whether this distance is inferior to the tolerance
145 ! only for projections on the exterior border of a face
146 !
147 ! next lines removed on 16 dec 2016
148 !
149 c if((((nterms.eq.4).or.(nterms.eq.8)).and.
150 c & ((xi.le.-1.d0).or.(xi.ge.1.d0).or.
151 c & (et.le.-1.d0).or.(et.ge.1.d0))).or.
152 c & (((nterms.eq.3).or.(nterms.eq.6)).and.
153 c & ((xi.le.0.d0).or.(et.le.0.d0).or.(xi+et.ge.1.d0)))) then
154 !
155 ! calculating a typical distance of the face
156 !
157  x12=pneigh(1,2)-pneigh(1,1)
158  y12=pneigh(2,2)-pneigh(2,1)
159  z12=pneigh(3,2)-pneigh(3,1)
160  x13=pneigh(1,3)-pneigh(1,1)
161  y13=pneigh(2,3)-pneigh(2,1)
162  z13=pneigh(3,3)-pneigh(3,1)
163  area=dsqrt((y12*z13-y13*z12)**2+
164  & (x12*z13-x13*z12)**2+
165  & (x12*y13-x13*y12)**2)
166  typdist=dsqrt(area)
167 !
168  if(multistage) dist=dsqrt((rp2-rp1)**2+(zp2-zp1)**2)
169  if(dist.ge.typdist/10.d0) then
170  write(*,*) '*WARNING in linkdissimilar: no suitable partner'
171  write(*,*) ' face found for node', noded,'.'
172  write(*,*)
173  & ' Nodes belonging to the best partner face:'
174  write(*,*) (nodef(i),i=1,nterms)
175  write(*,*) ' Euclidean distance within '
176  write(*,*) ' a radial plane: ',dist
177  write(*,*)
178  ier=-1
179  write(40,*) noded
180  endif
181 c endif
182 !
183  return
#define max(a, b)
Definition: cascade.c:32
static double * dist
Definition: radflowload.c:42
subroutine near2d(xo, yo, x, y, nx, ny, xp, yp, n, neighbor, k)
Definition: near2d.f:20
subroutine attach(pneigh, pnode, nterms, ratio, dist, xil, etl)
Definition: attach.f:20
Hosted by OpenAircraft.com, (Michigan UAV, LLC)