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

Go to the source code of this file.

Functions/Subroutines

subroutine transformatrix (xab, p, a)
 

Function/Subroutine Documentation

◆ transformatrix()

subroutine transformatrix ( real*8, dimension(7), intent(in)  xab,
real*8, dimension(3), intent(in)  p,
real*8, dimension(3,3), intent(out)  a 
)
20 !
21 ! determines the transformation matrix a in a point p for a carthesian
22 ! (xab(7)>0) or cylindrical transformation (xab(7)<0)
23 !
24  implicit none
25 !
26  integer j
27 !
28  real*8 xab(7),p(3),a(3,3),e1(3),e2(3),e3(3),dd
29 !
30  intent(in) xab,p
31 !
32  intent(out) a
33 !
34  if(xab(7).gt.0) then
35 !
36 ! carthesian transformation
37 !
38  e1(1)=xab(1)
39  e1(2)=xab(2)
40  e1(3)=xab(3)
41 !
42  e2(1)=xab(4)
43  e2(2)=xab(5)
44  e2(3)=xab(6)
45 !
46  dd=dsqrt(e1(1)*e1(1)+e1(2)*e1(2)+e1(3)*e1(3))
47  do j=1,3
48  e1(j)=e1(j)/dd
49  enddo
50 !
51  dd=e1(1)*e2(1)+e1(2)*e2(2)+e1(3)*e2(3)
52  do j=1,3
53  e2(j)=e2(j)-dd*e1(j)
54  enddo
55 !
56  dd=dsqrt(e2(1)*e2(1)+e2(2)*e2(2)+e2(3)*e2(3))
57  do j=1,3
58  e2(j)=e2(j)/dd
59  enddo
60 !
61  e3(1)=e1(2)*e2(3)-e2(2)*e1(3)
62  e3(2)=e1(3)*e2(1)-e1(1)*e2(3)
63  e3(3)=e1(1)*e2(2)-e2(1)*e1(2)
64 !
65  else
66 !
67 ! cylindrical coordinate system in point p
68 !
69  e1(1)=p(1)-xab(1)
70  e1(2)=p(2)-xab(2)
71  e1(3)=p(3)-xab(3)
72 !
73  e3(1)=xab(4)-xab(1)
74  e3(2)=xab(5)-xab(2)
75  e3(3)=xab(6)-xab(3)
76 !
77  dd=dsqrt(e3(1)*e3(1)+e3(2)*e3(2)+e3(3)*e3(3))
78 !
79  do j=1,3
80  e3(j)=e3(j)/dd
81  enddo
82 !
83  dd=e1(1)*e3(1)+e1(2)*e3(2)+e1(3)*e3(3)
84 !
85  do j=1,3
86  e1(j)=e1(j)-dd*e3(j)
87  enddo
88 !
89  dd=dsqrt(e1(1)*e1(1)+e1(2)*e1(2)+e1(3)*e1(3))
90 !
91 ! check whether p belongs to the cylindrical coordinate axis
92 ! if so, an arbitrary vector perpendicular to the axis can
93 ! be taken
94 !
95  if(dd.lt.1.d-10) then
96 c write(*,*) '*WARNING in transformatrix: point on axis'
97  if(dabs(e3(1)).gt.1.d-10) then
98  e1(2)=1.d0
99  e1(3)=0.d0
100  e1(1)=-e3(2)/e3(1)
101  elseif(dabs(e3(2)).gt.1.d-10) then
102  e1(3)=1.d0
103  e1(1)=0.d0
104  e1(2)=-e3(3)/e3(2)
105  else
106  e1(1)=1.d0
107  e1(2)=0.d0
108  e1(3)=-e3(1)/e3(3)
109  endif
110  dd=dsqrt(e1(1)*e1(1)+e1(2)*e1(2)+e1(3)*e1(3))
111  endif
112 !
113  do j=1,3
114  e1(j)=e1(j)/dd
115  enddo
116 !
117  e2(1)=e3(2)*e1(3)-e1(2)*e3(3)
118  e2(2)=e3(3)*e1(1)-e1(3)*e3(1)
119  e2(3)=e3(1)*e1(2)-e1(1)*e3(2)
120 !
121  endif
122 !
123 ! finding the transformation matrix
124 !
125  do j=1,3
126  a(j,1)=e1(j)
127  a(j,2)=e2(j)
128  a(j,3)=e3(j)
129  enddo
130 !
131  return
Hosted by OpenAircraft.com, (Michigan UAV, LLC)