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

Go to the source code of this file.

Functions/Subroutines

subroutine orientations (inpc, textpart, orname, orab, norien, norien_, istep, istat, n, iline, ipol, inl, ipoinp, inp, ipoinpc)
 

Function/Subroutine Documentation

◆ orientations()

subroutine orientations ( character*1, dimension(*)  inpc,
character*132, dimension(16)  textpart,
character*80, dimension(*)  orname,
real*8, dimension(7,*)  orab,
integer  norien,
integer  norien_,
integer  istep,
integer  istat,
integer  n,
integer  iline,
integer  ipol,
integer  inl,
integer, dimension(2,*)  ipoinp,
integer, dimension(3,*)  inp,
integer, dimension(0:*)  ipoinpc 
)
21 !
22 ! reading the input deck: *ORIENTATION
23 !
24  implicit none
25 !
26  character*1 inpc(*)
27  character*80 orname(*)
28  character*132 textpart(16)
29 !
30  integer norien,norien_,istep,istat,n,key,i,iline,ipol,inl,
31  & ipoinp(2,*),inp(3,*),ipoinpc(0:*),iaxis,j
32 !
33  real*8 orab(7,*),a(3,3),c(3,3),angle,p(3),dc,ds,pi
34 !
35  if(istep.gt.0) then
36  write(*,*)
37  & '*ERROR reading *ORIENTATION: *ORIENTATION should be'
38  write(*,*) ' placed before all step definitions'
39  call exit(201)
40  endif
41 !
42  norien=norien+1
43  if(norien.gt.norien_) then
44  write(*,*) '*ERROR reading *ORIENTATION: increase norien_'
45  call exit(201)
46  endif
47 !
48 ! rectangular coordinate system: orab(7,norien)=1
49 ! cylindrical coordinate system: orab(7,norien)=-1
50 ! default is rectangular
51 !
52  orab(7,norien)=1.d0
53 !
54  do i=2,n
55  if(textpart(i)(1:5).eq.'NAME=') then
56  orname(norien)=textpart(i)(6:85)
57  if(textpart(i)(86:86).ne.' ') then
58  write(*,*) '*ERROR reading *ORIENTATION: name too long'
59  write(*,*) ' (more than 80 characters)'
60  write(*,*) ' orientation name:',textpart(i)(1:132)
61  call exit(201)
62  endif
63  elseif(textpart(i)(1:7).eq.'SYSTEM=') then
64  if(textpart(i)(8:8).eq.'C') then
65  orab(7,norien)=-1.d0
66  endif
67  else
68  write(*,*)
69  & '*WARNING reading *ORIENTATION: parameter not recognized:'
70  write(*,*) ' ',
71  & textpart(i)(1:index(textpart(i),' ')-1)
72  call inputwarning(inpc,ipoinpc,iline,
73  &"*ORIENTATION%")
74  endif
75  enddo
76 !
77  call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
78  & ipoinp,inp,ipoinpc)
79  if((istat.lt.0).or.(key.eq.1)) then
80  write(*,*)
81  & '*ERROR reading *ORIENTATION: definition of the following'
82  write(*,*) ' orientation is not complete: ',orname(norien)
83  call exit(201)
84  endif
85 !
86  do i=1,6
87  read(textpart(i)(1:20),'(f20.0)',iostat=istat) orab(i,norien)
88  if(istat.gt.0) call inputerror(inpc,ipoinpc,iline,
89  &"*ORIENTATION%")
90  enddo
91 !
92  call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
93  & ipoinp,inp,ipoinpc)
94 !
95  if((istat.lt.0).or.(key.eq.1)) return
96 !
97  read(textpart(1)(1:10),'(i10)',iostat=istat) iaxis
98  if(istat.gt.0) call inputerror(inpc,ipoinpc,iline,
99  &"*ORIENTATION%")
100  read(textpart(2)(1:20),'(f20.0)',iostat=istat) angle
101  if(istat.gt.0) call inputerror(inpc,ipoinpc,iline,
102  &"*ORIENTATION%")
103 !
104 ! additional rotation about an angle only for rectangular
105 ! coordinate systems
106 !
107  if(orab(7,norien).lt.0.d0) then
108  write(*,*) '*ERROR reading *ORIENTATION'
109  write(*,*) ' additional rotation about an angle'
110  write(*,*) ' is only allowed for rectangular systems'
111  call exit(201)
112  endif
113 !
114  call transformatrix(orab(1,norien),p,a)
115 !
116 ! vector on the rotation axis
117 !
118  do i=1,3
119  p(i)=a(i,iaxis)
120  enddo
121 !
122 ! rotation matrix
123 !
124  pi=4.d0*datan(1.d0)
125  angle=angle*pi/180.d0
126  dc=dcos(angle)
127  ds=dsin(angle)
128  c(1,1)=dc+(1.d0-dc)*p(1)*p(1)
129  c(1,2)=-ds*p(3)+(1.d0-dc)*p(1)*p(2)
130  c(1,3)=ds*p(2)+(1.d0-dc)*p(1)*p(3)
131  c(2,1)=ds*p(3)+(1.d0-dc)*p(2)*p(1)
132  c(2,2)=dc+(1.d0-dc)*p(2)*p(2)
133  c(2,3)=-ds*p(1)+(1.d0-dc)*p(2)*p(3)
134  c(3,1)=-ds*p(2)+(1.d0-dc)*p(3)*p(1)
135  c(3,2)=ds*p(1)+(1.d0-dc)*p(3)*p(2)
136  c(3,3)=dc+(1.d0-dc)*p(3)*p(3)
137 !
138 ! rotate vector along the local x-axis and store
139 ! as first point in orab
140 !
141  do i=1,3
142  orab(i,norien)=0.d0
143  do j=1,3
144  orab(i,norien)=orab(i,norien)+c(i,j)*a(j,1)
145  enddo
146  enddo
147 !
148 ! rotate vector along the local y-axis and store as
149 ! second point in orab
150 !
151  do i=1,3
152  orab(i+3,norien)=0.d0
153  do j=1,3
154  orab(i+3,norien)=orab(i+3,norien)+c(i,j)*a(j,2)
155  enddo
156  enddo
157 !
158  call getnewline(inpc,textpart,istat,n,key,iline,ipol,inl,
159  & ipoinp,inp,ipoinpc)
160 !
161  return
subroutine inputwarning(inpc, ipoinpc, iline, text)
Definition: inputwarning.f:20
subroutine transformatrix(xab, p, a)
Definition: transformatrix.f:20
subroutine getnewline(inpc, textpart, istat, n, key, iline, ipol, inl, ipoinp, inp, ipoinpc)
Definition: getnewline.f:21
subroutine inputerror(inpc, ipoinpc, iline, text)
Definition: inputerror.f:20
Hosted by OpenAircraft.com, (Michigan UAV, LLC)