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

Go to the source code of this file.

Functions/Subroutines

subroutine interpolateinface (kk, xstate, xstateini, numpts, nstate_, mi, islavsurf, pslavsurf, ne0, islavsurfold, pslavsurfold)
 

Function/Subroutine Documentation

◆ interpolateinface()

subroutine interpolateinface ( integer  kk,
real*8, dimension(nstate_,mi(1),*)  xstate,
real*8, dimension(nstate_,mi(1),*)  xstateini,
integer  numpts,
integer  nstate_,
integer, dimension(*)  mi,
integer, dimension(2,*)  islavsurf,
real*8, dimension(3,*)  pslavsurf,
integer  ne0,
integer, dimension(2,*)  islavsurfold,
real*8, dimension(3,*)  pslavsurfold 
)
31 !
32  implicit none
33 !
34  integer numpts,i_int,n_int,i,j,k,kk,l,ll,nn,
35  & koncont(3,2*numpts+1),itri,kflag,neigh(1),kneigh,
36  & imastop(3,2*numpts+1),indexcj,nopespringj,list(numpts),
37  & igauss,mi(*),nstate_,itriangle(100),itriold,
38  & ifaceq(8,6),ip(numpts),ne0,iloc,itrinew,ntriangle,
39  & ifacet(6,4),ifacew1(4,5),ifacew2(8,5),n,islavsurf(2,*),
40  & ibin(numpts),ivert1,ntriangle_,nterms,m,islavsurfold(2,*),
41  & nx(2*numpts+1),ny(2*numpts+1),isol,id
42 !
43  real*8 xstate(nstate_,mi(1),*),p(3),pslavsurfold(3,*),
44  & xstateini(nstate_,mi(1),*),coi(2,numpts+3),pneigh(3,3),
45  & cg(2,2*numpts+1),xdist,pslavsurf(3,*),xil,etl,ratio(3),
46  & z(9,3),x(2*numpts+1),xo(2*numpts+1),
47  & y(2*numpts+1),yo(2*numpts+1),straight(9,2*numpts+1),dist
48 !
49 ! nodes per face for hex elements
50 !
51  data ifaceq /4,3,2,1,11,10,9,12,
52  & 5,6,7,8,13,14,15,16,
53  & 1,2,6,5,9,18,13,17,
54  & 2,3,7,6,10,19,14,18,
55  & 3,4,8,7,11,20,15,19,
56  & 4,1,5,8,12,17,16,20/
57 !
58 ! nodes per face for tet elements
59 !
60  data ifacet /1,3,2,7,6,5,
61  & 1,2,4,5,9,8,
62  & 2,3,4,6,10,9,
63  & 1,4,3,8,10,7/
64 !
65 ! nodes per face for linear wedge elements
66 !
67  data ifacew1 /1,3,2,0,
68  & 4,5,6,0,
69  & 1,2,5,4,
70  & 2,3,6,5,
71  & 3,1,4,6/
72 !
73 ! nodes per face for quadratic wedge elements
74 !
75  data ifacew2 /1,3,2,9,8,7,0,0,
76  & 4,5,6,10,11,12,0,0,
77  & 1,2,5,4,7,14,10,13,
78  & 2,3,6,5,8,15,11,14,
79  & 3,1,4,6,9,13,12,15/
80 !
81  kneigh=1
82 !
83  do i=1,numpts
84  list(i)=i
85  enddo
86 !
87 ! Loop over the old integration points within the face
88 !
89  ll=0
90  do l=islavsurfold(2,kk)+1,islavsurfold(2,kk+1)
91  ll=ll+1
92  coi(1,ll)=pslavsurfold(1,l)
93  coi(2,ll)=pslavsurfold(2,l)
94  ip(ll)=ne0+l
95  enddo
96 !
97 ! Calling deltri for triangulation
98 !
99  kflag=2
100 !
101  call deltri(numpts,numpts,coi(1,1:numpts+3),coi(2,1:numpts+3),
102  & list,ibin,koncont,imastop,n)
103 !
104 ! Arranging imastop field corresponding to "imastop"
105 !
106  nn=0
107  do i=1,n
108  ivert1=imastop(1,i)
109  imastop(1,i)=imastop(2,i)
110  imastop(2,i)=imastop(3,i)
111  imastop(3,i)=ivert1
112  enddo
113 !
114 ! determining the center of gravity and the bounding planes
115 ! of the triangles
116 !
117  call updatecont2d(koncont,n,coi,cg,straight)
118 !
119 ! sorting the centers of gravity
120 !
121  do l=1,n
122  xo(l)=cg(1,l)
123  x(l)=xo(l)
124  nx(l)=l
125  yo(l)=cg(2,l)
126  y(l)=yo(l)
127  ny(l)=l
128  enddo
129  kflag=2
130  call dsort(x,nx,n,kflag)
131  call dsort(y,ny,n,kflag)
132 !
133 ! Loop over the new integration points
134 !
135  do iloc=islavsurf(2,kk)+1,islavsurf(2,kk+1)
136  xdist=9.d0
137  igauss=iloc
138 !
139 ! coordinates of the new integration point
140 !
141  p(1)=pslavsurf(1,igauss)
142  p(2)=pslavsurf(2,igauss)
143 !
144 ! closest triangle center of gravity
145 !
146  call near2d(xo,yo,x,y,nx,ny,p(1),p(2),
147  & n,neigh,kneigh)
148 !
149  isol=0
150 !
151  itriold=0
152  itri=neigh(1)
153  ntriangle=0
154  ntriangle_=100
155 !
156  loop1: do
157  do l=1,3
158  ll=3*l-2
159  dist=straight(ll,itri)*p(1)+
160  & straight(ll+1,itri)*p(2)+
161  & straight(ll+2,itri)
162 !
163  if(dist.gt.0.d0) then
164  itrinew=imastop(l,itri)
165  if(itrinew.eq.0) then
166 c write(*,*) '**border reached'
167  exit loop1
168  elseif(itrinew.eq.itriold) then
169 c write(*,*) '**solution in between triangles'
170  isol=itri
171  exit loop1
172  else
173  call nident(itriangle,itrinew,ntriangle,id)
174  if(id.gt.0) then
175  if(itriangle(id).eq.itrinew) then
176 c write(*,*) '**circular path;no solution'
177  exit loop1
178  endif
179  endif
180  ntriangle=ntriangle+1
181  if(ntriangle.gt.ntriangle_) then
182 c write(*,*) '**too many iterations'
183  exit loop1
184  endif
185  do k=ntriangle,id+2,-1
186  itriangle(k)=itriangle(k-1)
187  enddo
188  itriangle(id+1)=itrinew
189  itriold=itri
190  itri=itrinew
191  cycle loop1
192  endif
193  elseif(l.eq.3) then
194 c write(*,*) '**regular solution'
195  isol=itri
196  exit loop1
197  endif
198  enddo
199  enddo loop1
200 !
201  if(isol.eq.0) then
202 !
203 ! mapping the new integration point onto the nearest
204 ! triangle
205 !
206  do k=1,3
207  do m=1,2
208  pneigh(m,k)=coi(m,koncont(k,itri))
209  enddo
210  pneigh(3,k)=0.d0
211  enddo
212  p(3)=0.d0
213  nterms=3
214 !
215  call attach(pneigh,p,nterms,ratio,dist,xil,etl)
216 !
217  do m=1,2
218  p(m)=0.d0
219  do k=1,3
220  p(m)=p(m)+ratio(k)*pneigh(m,k)
221  enddo
222  enddo
223  endif
224 !
225 ! Assigning xstate values from the vertices of the triangle
226 ! to the field z (integration point values from xstateini)
227 !
228  do k=1,3
229  do i=1,9
230  z(i,k)=xstateini(i,1,ip(koncont(k,itri)))
231  enddo
232  enddo
233 !
234 ! Calling plane_eq to interpolate values using plane equation
235 !
236  do i=1,9
237  call plane_eq(
238  & coi(1,koncont(1,itri)),coi(2,koncont(1,itri)),z(i,1),
239  & coi(1,koncont(2,itri)),coi(2,koncont(2,itri)),z(i,2),
240  & coi(1,koncont(3,itri)),coi(2,koncont(3,itri)),z(i,3),
241  & p(1),p(2),xstate(i,1,ne0+iloc))
242  enddo
243 !
244  enddo
245 !
246  return
subroutine plane_eq(x1, y1, z1, x2, y2, z2, x3, y3, z3, x0, y0, output)
Definition: plane_eq.f:33
subroutine updatecont2d(koncont, ncont, co, cg, straight)
Definition: updatecont2d.f:20
static double * dist
Definition: radflowload.c:42
subroutine nident(x, px, n, id)
Definition: nident.f:26
subroutine dsort(dx, iy, n, kflag)
Definition: dsort.f:6
subroutine near2d(xo, yo, x, y, nx, ny, xp, yp, n, neighbor, k)
Definition: near2d.f:20
subroutine deltri(numpts, n, x, y, list, bin, v, e, numtri)
Definition: deltri.f:24
subroutine attach(pneigh, pnode, nterms, ratio, dist, xil, etl)
Definition: attach.f:20
Hosted by OpenAircraft.com, (Michigan UAV, LLC)