-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcomputeGrid.py
executable file
·43 lines (36 loc) · 1.18 KB
/
computeGrid.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 17 14:12:01 2019
@author: TempestGuerra
"""
import numpy as np
import HerfunChebNodesWeights as qxw
def computeGrid(DIMS, Herm, Four, ChebCol, LegCol):
# Get the domain dimensions
L1 = DIMS[0]
L2 = DIMS[1]
ZH = DIMS[2]
NX = DIMS[3]
NZ = DIMS[4]
if ChebCol:
# Compute the Chebyshev native grids
xi, wcp = qxw.cheblb(NZ) #[-1 +1]
z = 0.5 * ZH * (1.0 + xi)
elif LegCol:
# Compute the Legendre native grids
xi, wcp = qxw.leglb(NZ) #[-1 +1]
z = 0.5 * ZH * (1.0 + xi)
else:
z = np.linspace(0.0, ZH, num=NZ)
# Map reference 1D domains to physical 1D domains
if Herm and not Four:
alpha, whf = qxw.hefunclb(NX) #(-inf inf)
x = 0.5 * abs(L2 - L1) / np.amax(alpha) * alpha
elif Four and not Herm:
x = np.linspace(L1, L2, num=NX, endpoint=True)
else:
x = np.linspace(L1, L2, num=NX, endpoint=True)
# Return the REFS structure
REFS = [x, z]
return REFS