FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Engineering_Python/VelInterp2D.py at master · OnScale/Engineering_Python · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
OnScale
/
Engineering_Python
Public
Notifications
You must be signed in to change notification settings
Fork
1
Star
0
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Engineering_Python
/
VelInterp2D.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
74 lines (56 loc) · 1.48 KB
Breadcrumbs
Engineering_Python
/
VelInterp2D.py
Copy path
File metadata and controls
74 lines (56 loc) · 1.48 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 28 12:58:01 2014
@author: Gerry Harvey
Script to interpolate XY Velocities and
write to 2 col ascii for import to Flex
Improvements:
- Write direct into out1 format
- be callable from flxinp file
- need to have pylibs pathed for that
"""
# Read Velocity files
data
=
loadtxt
(
'PZFlex2d.csv'
,
delimiter
=
','
);
# Read positional data
X
=
data
[:,
0
];
Y
=
data
[:,
1
];
# Read velocity data
Xv
=
data
[:,
2
];
Yv
=
data
[:,
3
];
"""
set up grid and flip out for symm conditions
No. of points can be read from flxinp or symb files
"""
Nx_sym
=
188
;
Nx
=
Nx_sym
*
2
;
Ny
=
1872
;
Nelem
=
Nx
*
Ny
Nelem_sym
=
Nx_sym
*
Ny
# Get max and min X & Y
XMax
=
max
(
X
);
XMin
=
min
(
X
);
YMax
=
max
(
Y
);
YMin
=
min
(
Y
);
# Create interp frid
Xi
=
linspace
(
XMin
,
XMax
,
Nx
);
Yi
=
linspace
(
YMin
,
YMax
,
Ny
);
[
XGrid
,
YGrid
]
=
meshgrid
(
Xi
,
Yi
);
# interpolate
XvInt
=
griddata
(
X
,
Y
,
Xv
,
XGrid
,
YGrid
);
YvInt
=
griddata
(
X
,
Y
,
Yv
,
XGrid
,
YGrid
);
# Half Arrays along X-axis for symm conditions in Flex
XvInt
=
XvInt
[:,
Nx_sym
:]
YvInt
=
YvInt
[:,
Nx_sym
:]
# Format for export to text file
XvInt_colm
=
reshape
(
XvInt
,
Nelem_sym
,
1
);
YvInt_colm
=
reshape
(
YvInt
,
Nelem_sym
,
1
);
# Remove NaN/Masked array vaules
XvInt_colm
=
np
.
nan_to_num
(
XvInt_colm
)
YvInt_colm
=
np
.
nan_to_num
(
YvInt_colm
)
# Create array for 2-col format
XY_Vels
=
zeros
([
Nelem_sym
,
2
]);
# place interpolated values in correct cols
XY_Vels
[:,
0
]
=
XvInt_colm
;
XY_Vels
[:,
1
]
=
YvInt_colm
;
# write file
savetxt
(
'XYvels.dat'
,
XY_Vels
,
delimiter
=
' '
)
Back
|
FazBrowse Home
|
New Git URL