Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NTRfC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
TFD - Institut für Turbomaschinen und Fluid-Dynamik
tools
NTRfC
Commits
1997a9c9
Commit
1997a9c9
authored
2 years ago
by
Malte Nyhuis
Browse files
Options
Downloads
Patches
Plain Diff
minor performance improvement
parent
7d578e3f
No related branches found
No related tags found
1 merge request
!10
Merge recent changes in master to we_ahrens
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ntrfc/meshquality/nondimensionals.py
+10
-9
10 additions, 9 deletions
ntrfc/meshquality/nondimensionals.py
with
10 additions
and
9 deletions
ntrfc/meshquality/nondimensionals.py
+
10
−
9
View file @
1997a9c9
...
...
@@ -46,19 +46,20 @@ def cellDirections(cellUMean, wallNorm):
#################################################################################
def
closestWallNormalPoint
(
point
,
surfaceMesh
):
surfacenormals
=
surfaceMesh
.
extract_surface
().
compute_normals
()
def
closestWallNormalPoint
(
point
,
surfacenormals
):
surfacepoint_id
=
surfacenormals
.
find_closest_point
(
point
)
wallpoint
=
surfacenormals
.
points
[
surfacepoint_id
]
return
surfacenormals
.
point_arrays
[
"
Normals
"
][
surfacepoint_id
],
wallpoint
-
point
def
calcWallNormalVectors
(
cellIds
,
surfaceMesh
,
volmesh
):
def
calcWallNormalVectors
(
surfaceMesh
,
volmesh
):
surfacenormals
=
[]
surfacevectors
=
[]
surfacenormals_surface
=
surfaceMesh
.
extract_surface
().
compute_normals
()
cellIds
=
np
.
arange
(
0
,
volmesh
.
number_of_cells
)
for
cellIdx
in
cellIds
:
center
=
volmesh
[
"
cellCenters
"
][
cellIdx
]
surfacenormal
,
surfacevector
=
closestWallNormalPoint
(
center
,
surface
Mesh
)
surfacenormal
,
surfacevector
=
closestWallNormalPoint
(
center
,
surface
normals_surface
)
surfacenormals
.
append
(
surfacenormal
)
surfacevectors
.
append
(
surfacevector
)
...
...
@@ -67,10 +68,10 @@ def calcWallNormalVectors(cellIds, surfaceMesh, volmesh):
return
surfacenormals
,
surfacevectors
def
cellSpans
(
labelChunk
,
solutionMesh
,
calcFrom
):
def
cellSpans
(
solutionMesh
,
calcFrom
):
spans
=
[]
for
cellIdx
in
labelChunk
:
cellIds
=
np
.
arange
(
0
,
solutionMesh
.
number_of_cells
)
for
cellIdx
in
cellIds
:
x_span
=
0
x_weight
=
0
...
...
@@ -202,11 +203,11 @@ def calc_dimensionless_gridspacing(volmesh, surfaces, use_velfield, use_rhofield
cellIds
=
[
i
for
i
in
range
(
volmesh
.
GetNumberOfCells
())]
print
(
"
calculating wall-normal vectors...
"
)
surfaceNormals
,
surfaceVectors
=
calcWallNormalVectors
(
cellIds
,
surfaceMesh
,
volmesh
)
surfaceNormals
,
surfaceVectors
=
calcWallNormalVectors
(
surfaceMesh
,
volmesh
)
volmesh
[
"
wallNormal
"
]
=
surfaceNormals
print
(
"
calculating cell spans from WallNormals and CellEdges...
"
)
spanS
=
cellSpans
(
cellIds
,
volmesh
,
use_velfield
)
spanS
=
cellSpans
(
volmesh
,
use_velfield
)
volmesh
[
"
xSpan
"
]
=
np
.
array
([
i
[
0
]
for
i
in
spanS
])
# calculate cell span in flow direction
volmesh
[
"
ySpan
"
]
=
np
.
array
([
i
[
1
]
for
i
in
spanS
])
# calculate cell span in wall normal direction
volmesh
[
"
zSpan
"
]
=
np
.
array
([
i
[
2
]
for
i
in
spanS
])
# calculate cell span in span direction
...
...
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