Blame view

SRC/GENERAL_MODULES/plot_geometry.F90 6.5 KB
886c558b   Steve Greedy   SACAMOS Public Re...
1
!
fe64b32b   Chris Smartt   Update file heade...
2
! This file is part of SACAMOS, State of the Art CAble MOdels for Spice. 
886c558b   Steve Greedy   SACAMOS Public Re...
3
4
5
! It was developed by the University of Nottingham and the Netherlands Aerospace 
! Centre (NLR) for ESA under contract number 4000112765/14/NL/HK.
! 
fe64b32b   Chris Smartt   Update file heade...
6
! Copyright (C) 2016-2018 University of Nottingham
886c558b   Steve Greedy   SACAMOS Public Re...
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! 
! SACAMOS is free software: you can redistribute it and/or modify it under the 
! terms of the GNU General Public License as published by the Free Software 
! Foundation, either version 3 of the License, or (at your option) any later 
! version.
! 
! SACAMOS is distributed in the hope that it will be useful, but 
! WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
! or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License 
! for more details.
! 
! A copy of the GNU General Public License version 3 can be found in the 
! file GNU_GPL_v3 in the root or at <http://www.gnu.org/licenses/>.
! 
! SACAMOS uses the EISPACK library (in /SRC/EISPACK). EISPACK is subject to 
! the GNU Lesser General Public License. A copy of the GNU Lesser General Public 
! License version can be found in the file GNU_LGPL in the root of EISPACK 
! (/SRC/EISPACK ) or at <http://www.gnu.org/licenses/>.
! 
! The University of Nottingham can be contacted at: ggiemr@nottingham.ac.uk
!
fe64b32b   Chris Smartt   Update file heade...
28
!
886c558b   Steve Greedy   SACAMOS Public Re...
29
30
31
32
! FILE CONTENTS:
!SUBROUTINE write_circle
!SUBROUTINE write_rectangle
!SUBROUTINE write_Dshape
44c11f06   Chris Smartt   Include software ...
33
!SUBROUTINE write_semicircle
886c558b   Steve Greedy   SACAMOS Public Re...
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
!
!SUBROUTINE write_circle
!
! NAME
!     SUBROUTINE write_circle
!
! DESCRIPTION
!     write a circle with specified x,y centre and radius to file for plotting with gnuplot
!
!     
! COMMENTS
!     return the extent of the plotting area...
!
! HISTORY
!
!     started 10/05/2013 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_circle(x,y,r,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,r                 ! centre x and y coordinates and radius
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax   ! extent of the plotting area
  integer, intent(IN)    :: unit                  ! unit to write to  
  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
  
! START

  CALL generate_circle_points(npts,shape_x,shape_y,x,y,r)
  
  do i=1,npts
    
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_circle
!
!SUBROUTINE write_rectangle
!
! NAME
!     SUBROUTINE write_rectangle
!
! DESCRIPTION
!     write a rectangle with specified x,y centre, width, height and angle to file for plotting with gnuplot
!
!     
! COMMENTS
!     return the extent of the plotting area...
!
! HISTORY
!
!     started 23/9/2016 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_rectangle(x,y,w,h,theta,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,w,h,theta         ! centre x and y coordinates, width, height and angle of rectangle
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax   ! extent of the plotting area
  integer, intent(IN)    :: unit                  ! unit to write to  
  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
 
! START

  CALL generate_rectangle_points(npts,shape_x,shape_y,x,y,theta,w,h)
  
  do i=1,npts
  
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_rectangle

!
! NAME
!     SUBROUTINE write_Dshape
!
! DESCRIPTION
!     write a Dshape with specified x,y centre, width1, width2, conductor separation, shell offset and angle to file for plotting with gnuplot
!
!     
! COMMENTS
!     Also return the extent of the plotting area
!
! HISTORY
!
!     started 15/11/2016 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_Dshape(x,y,w1,w2,s,r,theta,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,w1,w2,s,r,theta  ! centre x and y coordinates, width1, width2, separation of wire rows, offset of D shapeand angle
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax  ! extent of the plotting area
  integer, intent(IN)    :: unit                 ! unit to write to  
  
! local variables  

  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
 
! START

  CALL generate_Dshape_points(npts,shape_x,shape_y,x,y,w1,w2,s,r,theta)
  
  do i=1,npts
  
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_Dshape
44c11f06   Chris Smartt   Include software ...
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
!
!SUBROUTINE write_semicircle
!
! NAME
!     SUBROUTINE write_semicircle
!
! DESCRIPTION
!     write a semicircle with specified x,y centre and radius to file for plotting with gnuplot
!     the semicircle is in the region y>=0
!
!     
! COMMENTS
!     return the extent of the plotting area...
!
! HISTORY
!
!     started 10/05/2013 CJS
!     using generate_shapes.F90 20/4/2017 CJS
!
!
SUBROUTINE write_semicircle(x,y,r,unit,xmin,xmax,ymin,ymax)
   
USE type_specifications
USE constants

IMPLICIT NONE

  real(dp),intent(IN)    :: x,y,r                 ! centre x and y coordinates and radius
  real(dp),intent(INOUT) :: xmin,xmax,ymin,ymax   ! extent of the plotting area
  integer, intent(IN)    :: unit                  ! unit to write to  
  
! local variables  
  
  integer :: npts
  real(dp),allocatable :: shape_x(:)
  real(dp),allocatable :: shape_y(:)
  
  integer :: i
  
! START

  CALL generate_semicircle_points(npts,shape_x,shape_y,x,y,r)
  
  do i=1,npts
    
    write(unit,8000)shape_x(i),shape_y(i)
8000 format (4E14.6)

    xmin=min(xmin,shape_x(i))
    xmax=max(xmax,shape_x(i))
    ymin=min(ymin,shape_y(i))
    ymax=max(ymax,shape_y(i))
  
  end do
  
  write(unit,*)
  write(unit,*)

  DEALLOCATE( shape_x )
  DEALLOCATE( shape_y )
   
  RETURN
  
END SUBROUTINE write_semicircle