Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ZN_gen_grid.f90
Go to the documentation of this file.
1 ! *********************************************************************
2 ! * Rocstar Simulation Suite *
3 ! * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4 ! * *
5 ! * Illinois Rocstar LLC *
6 ! * Champaign, IL *
7 ! * www.illinoisrocstar.com *
8 ! * sales@illinoisrocstar.com *
9 ! * *
10 ! * License: See LICENSE file in top level of distribution package or *
11 ! * http://opensource.org/licenses/NCSA *
12 ! *********************************************************************
13 ! *********************************************************************
14 ! * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15 ! * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16 ! * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17 ! * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18 ! * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19 ! * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20 ! * Arising FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21 ! * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22 ! *********************************************************************
23 !
24 ! ---------------------------------------------------------------------------
25 !
26 ! SUBROUTINE : ZN_gen_grid
27 !
28 ! purpose : grid generation
29 !
30 ! Authors : P. Loner
31 !
32 ! Creation Date : Sep. 3, 2002
33 !
34 ! Modifications :
35 !
36 ! No. Date Authors Description
37 ! 1 09/03/02 K. Tang Global variables G_ZN
38 !
39 ! ---------------------------------------------------------------------------
40 !
41 !
42 ! arguments :
43 !
44 ! G_ZN : Global variables for Rocburn_1D_ZN
45 ! gridtype : = 1 expoential grid
46 ! = 2 boundary layer grid
47 ! numx : maximum number of grid points
48 ! beta : stretch parameter
49 ! xmax : the maximum dimension in x-coordinate
50 ! x : the x-coordinate array
51 ! z : the z-coordinate arary
52 ! zx : the first derivative of z
53 ! zxx : the second derivative of z
54 ! delz : the z spacing
55 !
56 ! ---------------------------------------------------------------------------
57 !
58  SUBROUTINE zn_gen_grid(G_ZN, gridtype, numx, x, z, zx, zxx)
59 
61 
62  IMPLICIT NONE
63  include 'mpif.h'
64 
65  TYPE (g_burn_1d), POINTER :: g_zn
66  INTEGER, INTENT(IN) :: gridtype, numx
67  REAL(DBL), INTENT (OUT) :: x(:), z(:), zx(:), zxx(:)
68 !
69 !
70 ! ---------------------------------------------------------------------------
71 ! local variables
72 
73  REAL(DBL) :: bpm,bp1,bm1,czx,czxx,term,term2
74  INTEGER :: i
75 
76 ! ---------------------------------------------------------------------------
77  IF(g_zn%xmax >= 0.0) then
78  print *,' ROCBURN_ZN: rank=',g_zn%rank,' xmax >= 0'
79  print *,' ROCBURN_ZN: job aborted!'
80  stop
81  END IF
82 
83  IF(numx.gt.(g_zn%nxmax)) then
84  print *,' ROCBURN_ZN: rankk=',g_zn%rank,' numx=',numx, &
85  ' nxmax=',g_zn%nxmax
86  print *,' ROCBURN_ZN: nx > maximum number of', &
87  ' allowed spatial nodes'
88  print *,' ROCBURN_ZN: job aborted!'
89  stop
90  END IF
91 
92  g_zn%delz = 1.0/dble(numx-1)
93 
94  IF(g_zn%rank ==0) THEN
95  print *,' ROCBURN_ZN: delz=',g_zn%delz
96  print *,' ROCBURN_ZN: nxmax=',g_zn%nxmax
97  END IF
98 
99  IF (gridtype == 1) THEN
100 !
101 ! exponential grid
102 !
103 
104  DO i=1,numx
105  z(i) = dble(i-1)*g_zn%delz
106  x(i) = log(1.-z(i))/g_zn%beta
107  IF (i.eq.numx) THEN
108  x(i) = -10.
109  END IF
110  zx(i) = -g_zn%beta*exp(g_zn%beta*x(i))
111  zxx(i) = -g_zn%beta**2*exp(g_zn%beta*x(i))
112  END DO ! i
113 
114  ELSE
115 !
116 ! Anderson, Tanehill and Pletcher boundary layer grid control
117 !
118 
119  bp1=g_zn%beta+1.0
120  bm1=g_zn%beta-1.0
121  bpm=bp1/bm1
122  czx=2.0*g_zn%beta/log(bpm)/g_zn%xmax
123  czxx=-2.0/g_zn%xmax*czx
124 
125  DO i=1,numx
126  z(i)=dble(i-1)*g_zn%delz
127  term=bpm**(1.0-z(i))
128  x(i)=g_zn%xmax*(bp1-bm1*term)/(term+1.0)
129  term2=g_zn%beta**2-(1.0-x(i)/g_zn%xmax)**2
130  zx(i)=czx/term2
131  zxx(i)= czxx*(1.0-x(i)/g_zn%xmax)/term2**2
132  END DO ! i
133 
134  END IF
135 
136  IF(g_zn%rank == 0) THEN
137  WRITE (*,*)
138  WRITE (*,*)' ROCBURN_ZN: Smallest delta x = ',x(1)-x(2)
139  WRITE (*,*)' ROCBURN_ZN: Largest delta x = ',x(numx-1)-x(numx)
140  WRITE (*,*)
141  END IF
142 
143  RETURN
144 
145  END SUBROUTINE zn_gen_grid
146 
147 
148 
149 
150 
151 
subroutine zn_gen_grid(G_ZN, gridtype, numx, x, z, zx, zxx)
Definition: ZN_gen_grid.f90:58
void int int int REAL REAL REAL * z
Definition: write.cpp:76
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
virtual std::ostream & print(std::ostream &os) const