Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sdpm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aerospace and Mechanical Engineering
sdpm
Commits
3ef6c487
Commit
3ef6c487
authored
9 months ago
by
Adrien Crovato
Browse files
Options
Downloads
Patches
Plain Diff
Add z coordinate to slices
parent
e28e5174
No related branches found
No related tags found
1 merge request
!3
Version 1.2
Pipeline
#37678
passed with warnings
9 months ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sdpm/utils.py
+11
-8
11 additions, 8 deletions
sdpm/utils.py
with
11 additions
and
8 deletions
sdpm/utils.py
+
11
−
8
View file @
3ef6c487
...
...
@@ -91,9 +91,12 @@ def create_slices(body, sol, fname, ys):
for
i
in
range
(
len
(
ys
)):
# get data on cut section
coords
,
connct
,
cvalues
=
extract_data
(
cut_grid
(
grid
,
[
0.
,
ys
[
i
],
0.
]),
snames
)
# normalize x-coordinate by local chord
xc
=
np
.
zeros
((
coords
.
shape
[
0
],
1
))
xc
[:,
0
]
=
(
coords
[:,
0
]
-
min
(
coords
[:,
0
]))
/
(
max
(
coords
[:,
0
])
-
min
(
coords
[:,
0
]))
# normalize x and z-coordinates by local chord
xc
=
np
.
zeros
((
coords
.
shape
[
0
],
2
))
ile
=
np
.
argmin
(
coords
[:,
0
])
# LE index
crd
=
max
(
coords
[:,
0
])
-
min
(
coords
[:,
0
])
# chord
xc
[:,
0
]
=
(
coords
[:,
0
]
-
coords
[
ile
,
0
])
/
crd
xc
[:,
1
]
=
(
coords
[:,
2
]
-
coords
[
ile
,
2
])
/
crd
# average value at points from values at cell center
nvalues
=
np
.
zeros
((
coords
.
shape
[
0
],
len
(
sol
.
keys
())))
for
j
in
range
(
connct
.
shape
[
0
]):
...
...
@@ -101,16 +104,16 @@ def create_slices(body, sol, fname, ys):
for
k
in
range
(
len
(
pids
)):
for
l
in
range
(
len
(
sol
.
keys
())):
nvalues
[
connct
[
j
][
k
],
l
]
+=
cvalues
[
snames
[
l
]][
j
]
/
len
(
pids
)
# create dataset holding
x-
coordinates and values and sort it
# create dataset holding coordinates and values and sort it
xc_vals
=
np
.
hstack
((
xc
,
nvalues
))
sort
(
connct
,
xc_vals
)
xc_vals
=
np
.
vstack
((
xc_vals
,
xc_vals
[
0
,:]))
# write to file
hdr
=
'
x/c
'
hdr
=
f
'
y =
{
ys
[
i
]
}
, c =
{
crd
}
\n
'
hdr
+=
'
{:>9s}, {:>10s}
'
.
format
(
'
x/c
'
,
'
z/c
'
)
for
name
in
snames
:
hdr
+=
f
'
,
{
name
}
'
hdr
+=
f
'
\n
y =
{
ys
[
i
]
}
'
np
.
savetxt
(
fname
+
f
'
_slice_
{
i
}
.dat
'
,
xc_vals
,
fmt
=
'
%1.5e
'
,
delimiter
=
'
,
'
,
header
=
hdr
)
hdr
+=
'
, {:>10s}
'
.
format
(
name
)
np
.
savetxt
(
fname
+
f
'
_slice_
{
i
}
.dat
'
,
xc_vals
,
fmt
=
'
%+1.4e
'
,
delimiter
=
'
,
'
,
header
=
hdr
)
def
interpolate_modes
(
fname
,
surf_nodes
,
flat
=
True
):
"""
Read modal displacements and interpolate them on surface grid
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment