-
Notifications
You must be signed in to change notification settings - Fork 0
/
readmesh.f90
189 lines (164 loc) · 5.08 KB
/
readmesh.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
! MESHBD +MESHT
!
C ***************************************************************
C * *
C * Generate nodal and element data on the body surface of *
C * an arbitrary body *
C * *
C ***************************************************************
C
SUBROUTINE MESHBD(NCOR) !NCOR REMOVED Mar.17
USE test
IMPLICIT NONE
! INTEGER NELEM,NELEMB,NELEMF,NNODE,NNODED,NNB,NNBD,NNF,NNTCH
INTEGER NCOR,IPL,IPOLAR(50)
INTEGER I,IE,M,INODE,NCNN,K,KK
REAL*8 A1,A2,R1,R2,Z1
REAL*8 XOFSET(50),YOFSET(50),ZOFSET(50)
!
! ------------------------------------------------------------
!----------added by Song Mar.17
! OPEN(2, FILE='INPUT/DATBDMS.txt', STATUS='OLD')
!------------------------------------------------------------
! mvarÖÐISYS: number of symmetric planes
! NELEMB: number of elements on body surface
! NNB: number of nodes on the body surface according to coordinate
! NNBD: number of nodes on the body surface according to directives
! READ(2,*) ISYS !number of symmetric planes
! READ(2,*) NELEMB, NNB, NNBD, IPOL
!
! NNODE=NNB
! NNODED=NNBD
! NELEM=NELEMB
! NCOR = IPOL
!---------------------------------to here--------------------
DO 5 I=1, NCOR
READ(2,*) M, IPOLAR(I), XOFSET(I),YOFSET(I),ZOFSET(I)
5 CONTINUE
!
DO 10 INODE=1, NNB
READ(2,*) M, IPL, R1, A1, Z1
IF(IPOLAR(IPL).EQ.0) THEN
XYZ(1,INODE)=R1+XOFSET(IPL)
XYZ(2,INODE)=A1+YOFSET(IPL)
ELSE IF(IPOLAR(IPL).EQ.1) THEN
XYZ(1,INODE)=R1*DCOS(A1*PI/180.0D0)+XOFSET(IPL)
XYZ(2,INODE)=R1*DSIN(A1*PI/180.0D0)+YOFSET(IPL)
ENDIF
XYZ(3,INODE)=Z1+ZOFSET(IPL)
10 CONTINUE
!
DO 11 INODE=1, NNBD
READ(2,*) M,IPL,R2,A2,DXYZ(3,INODE)
IF(IPOLAR(IPL).EQ.0) THEN
DXYZ(1,INODE)= R2
DXYZ(2,INODE)= A2
ELSE IF(IPOLAR(IPL).NE.0) THEN
DXYZ(1,INODE)=R2*DCOS( A2*PI/180.0D0 )
DXYZ(2,INODE)=R2*DSIN( A2*PI/180.0D0 )
ENDIF
11 CONTINUE
C
C
DO 20 I=1, NELEMB
IE=I
IETYPE(IE)=1
READ(2,*) M, NCN(IE)
READ(2,*) (NCON(I,K), K=1, NCN(IE))
20 CONTINUE
!
DO 30 I=1, NELEMB
IE=I
READ(2,*) M, NCNN
READ(2,*) (NCOND(I,K), K=1, NCN(IE))
30 CONTINUE
!
WRITE(10,102)
DO INODE=1,NNODE
WRITE(10,114) INODE,XYZ(1,INODE),XYZ(2,INODE),XYZ(3,INODE)
ENDDO
WRITE(10,104)
DO INODE=1, NNODE
WRITE(10,114) INODE,DXYZ(1,INODE),DXYZ(2,INODE),DXYZ(3,INODE)
ENDDO
102 FORMAT( ' INODE X Y Z')
104 FORMAT( ' INODE nx ny nz')
114 FORMAT(I6,4(3x,E11.4))
! CLOSE(2)
RETURN
END
C
C *******************************************************
C * *
C * Compute mesh position at T-time *
C * *
C *******************************************************
C
SUBROUTINE MESHT
USE test
USE PVar_mod
IMPLICIT NONE
INTEGER IE,J
C
C Rotation
C
DO 100 IE=1, NELEM
DO 80 J=1, NCN(IE)
TXYZE(1,J,IE)=(TXYZE(1,J,IE)-XC)*TRXYZ(1,1)+
1 (TXYZE(2,J,IE)-YC)*TRXYZ(1,2)+
2 (TXYZE(3,J,IE)-ZC)*TRXYZ(1,3)
TXYZE(2,J,IE)=(TXYZE(1,J,IE)-XC)*TRXYZ(2,1)+
1 (TXYZE(2,J,IE)-YC)*TRXYZ(2,2)+
2 (TXYZE(3,J,IE)-ZC)*TRXYZ(2,3)
TXYZE(3,J,IE)=(TXYZE(1,J,IE)-XC)*TRXYZ(3,1)+
1 (TXYZE(2,J,IE)-YC)*TRXYZ(3,2)+
2 (TXYZE(3,J,IE)-ZC)*TRXYZ(3,3)
80 CONTINUE
C
100 CONTINUE
C
C Translation
C
DO 200 IE=1, NELEM
DO 180 J=1, NCN(IE)
TXYZE(1,J,IE)=TXYZE(1,J,IE)+XC+DISP(1)
TXYZE(2,J,IE)=TXYZE(2,J,IE)+YC+DISP(2)
TXYZE(3,J,IE)=TXYZE(3,J,IE)+ZC+DISP(3)
180 CONTINUE
C
200 CONTINUE
C
RETURN
END
!C
!C ******************************************************
!C * Attention: the order of rotations *
!C * *
!C ******************************************************
!C
SUBROUTINE TRMAX
USE test
USE PVar_mod
IMPLICIT NONE
REAL*4 CSAX,SNAX,CSAY,SNAY,CSAZ,SNAZ
REAL*4 TRX(3,3),TRY(3,3),TRZ(3,3),TRXY(3,3)
!C
CSAX=COS(DISP(4))
SNAX=SIN(DISP(4))
CSAY=COS(DISP(5))
SNAY=SIN(DISP(5))
CSAZ=COS(DISP(6))
SNAZ=SIN(DISP(6))
!
TRXYZ(1,1)= CSAY*CSAZ
TRXYZ(2,1)= CSAX*SNAZ+SNAX*SNAY*CSAZ
TRXYZ(3,1)= SNAX*SNAZ-CSAX*SNAY*CSAZ
TRXYZ(1,2)=-CSAY*SNAZ
TRXYZ(2,2)= CSAX*CSAZ-SNAX*SNAY*SNAZ
TRXYZ(3,2)= SNAX*CSAZ+CSAX*SNAY*SNAZ
TRXYZ(1,3)= SNAY
TRXYZ(2,3)=-SNAX*CSAY
TRXYZ(3,3)= CSAX*CSAY
!
RETURN
END