Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
blaster
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
blaster
Commits
3467f256
Verified
Commit
3467f256
authored
2 months ago
by
Paul Dechamps
Browse files
Options
Downloads
Patches
Plain Diff
(feat) Update dart interface for new data structures
parent
1f95c6a3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
blast/interfaces/dart/blDartInterface.py
+40
-33
40 additions, 33 deletions
blast/interfaces/dart/blDartInterface.py
with
40 additions
and
33 deletions
blast/interfaces/dart/blDartInterface.py
+
40
−
33
View file @
3467f256
...
...
@@ -168,12 +168,17 @@ class DartInterface(SolversInterface):
for
bodyName
in
self
.
blw
.
keys
():
ibody
=
self
.
mapBodyNameToIndex
[
bodyName
]
for
ireg
in
range
(
len
(
self
.
iBnd
[
ibody
])):
for
iRow
,
row
in
enumerate
(
self
.
iBnd
[
ibody
][
ireg
].
nodesCoord
[:,
3
]):
row
=
int
(
row
)
for
iDim
in
range
(
3
):
self
.
iBnd
[
ibody
][
ireg
].
V
[
iRow
,
iDim
]
=
self
.
solver
.
U
[
row
][
iDim
]
self
.
iBnd
[
ibody
][
ireg
].
M
[
iRow
]
=
self
.
solver
.
M
[
row
]
self
.
iBnd
[
ibody
][
ireg
].
Rho
[
iRow
]
=
self
.
solver
.
rho
[
row
]
reg
=
self
.
iBnd
[
ibody
][
ireg
]
V
=
np
.
empty
((
reg
.
getnNodes
(),
self
.
getnDim
()))
M
=
np
.
empty
(
reg
.
getnNodes
())
Rho
=
np
.
empty
(
reg
.
getnNodes
())
for
iRow
,
row
in
enumerate
(
self
.
iBnd
[
ibody
][
ireg
].
getNodeRows
()):
row
=
int
(
row
)
# From np.int64 to int
for
iDim
in
range
(
self
.
getnDim
()):
V
[
iRow
,
iDim
]
=
self
.
solver
.
U
[
row
][
iDim
]
M
[
iRow
]
=
self
.
solver
.
M
[
row
]
Rho
[
iRow
]
=
self
.
solver
.
rho
[
row
]
self
.
iBnd
[
ibody
][
ireg
].
updateVariables
(
M
,
V
,
Rho
)
def
setBlowingVelocity
(
self
):
"""
Impose the blowing boundary condition
...
...
@@ -185,7 +190,7 @@ class DartInterface(SolversInterface):
b
=
self
.
blw
[
bodyName
][
self
.
mapBlwIndexToBlwName
[
bodyName
][
ireg
]]
if
self
.
getnDim
()
==
2
:
self
.
iBnd
[
ibody
][
ireg
].
connectBlowingVel
()
for
i
,
blw
in
enumerate
(
self
.
iBnd
[
ibody
][
ireg
].
b
lowingVel
):
for
i
,
blw
in
enumerate
(
self
.
iBnd
[
ibody
][
ireg
].
getB
lowingVel
ocity
()
):
b
.
setU
(
i
,
blw
)
# TODO: Remove the fact that getWing has to set iBnd.
...
...
@@ -281,8 +286,6 @@ class DartInterface(SolversInterface):
Name of the body.
"""
ibody
=
self
.
mapBodyNameToIndex
[
name
]
# Initialize boundary
self
.
iBnd
[
ibody
][
0
].
initStructures
(
self
.
blw
[
name
][
'
wing
'
].
nodes
.
size
(),
self
.
blw
[
name
][
'
wing
'
].
tag
.
elems
.
size
())
# Node number
N1
=
np
.
zeros
(
self
.
blw
[
name
][
'
wing
'
].
nodes
.
size
(),
dtype
=
int
)
# Index in boundary.nodes
...
...
@@ -387,19 +390,21 @@ class DartInterface(SolversInterface):
for
i
,
e
in
enumerate
(
self
.
blw
[
name
][
'
wing
'
].
tag
.
elems
):
connect2
[
connectListElems
[
i
]]
=
i
self
.
iBnd
[
ibody
][
0
].
nodesCoord
=
np
.
column_stack
((
data
[:,
1
],
data
[:,
2
],
\
data
[:,
3
],
data
[:,
4
]))
self
.
iBnd
[
ibody
][
0
].
setConnectList
(
connectListNodes
,
connect2
)
elemCoord
=
np
.
zeros
((
len
(
self
.
iBnd
[
ibody
][
0
].
nodesCoord
)
-
1
,
4
))
elemCoord
=
np
.
zeros
((
len
(
data
)
-
1
,
4
))
elemsRows
=
np
.
zeros
((
len
(
data
)
-
1
),
dtype
=
int
)
for
i
in
range
(
len
(
elemCoord
[:,
0
])):
elemCoord
[
i
,
0
]
=
0.5
*
(
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[
i
,
0
]
+
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[
i
+
1
,
0
])
elemCoord
[
i
,
1
]
=
0.5
*
(
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[
i
,
1
]
+
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[
i
+
1
,
1
])
elemCoord
[
i
,
2
]
=
0.5
*
(
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[
i
,
2
]
+
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[
i
+
1
,
2
])
elemCoord
[
i
,
3
]
=
i
self
.
iBnd
[
ibody
][
0
].
elemsCoord
=
elemCoord
elemCoord
[
i
,
0
]
=
0.5
*
(
data
[
i
,
1
]
+
data
[
i
+
1
,
1
])
elemCoord
[
i
,
1
]
=
0.5
*
(
data
[
i
,
2
]
+
data
[
i
+
1
,
2
])
elemCoord
[
i
,
2
]
=
0.5
*
(
data
[
i
,
3
]
+
data
[
i
+
1
,
3
])
elemsRows
[
i
]
=
i
nodesCoord
=
np
.
column_stack
((
data
[:,
1
],
data
[:,
2
],
\
data
[:,
3
]))
self
.
iBnd
[
ibody
][
0
].
setMesh
(
nodesCoord
,
elemCoord
[:,:
3
])
self
.
iBnd
[
ibody
][
0
].
setConnectLists
(
connectListNodes
,
connect2
)
self
.
iBnd
[
ibody
][
0
].
setRows
(
data
[:,
4
],
elemsRows
)
# Wake
self
.
iBnd
[
ibody
][
1
].
initStructures
(
self
.
blw
[
name
][
'
wake
'
].
nodes
.
size
(),
self
.
blw
[
name
][
'
wake
'
].
tag
.
elems
.
size
())
# Node number
N1
=
np
.
zeros
(
self
.
blw
[
name
][
'
wake
'
].
nodes
.
size
(),
dtype
=
int
)
# Index in boundary.nodes
...
...
@@ -432,21 +437,23 @@ class DartInterface(SolversInterface):
dataW
[:,
2
]
=
dataW
[
connectListNodes
,
2
]
dataW
[:,
3
]
=
dataW
[
connectListNodes
,
3
]
dataW
[:,
4
]
=
dataW
[
connectListNodes
,
4
]
self
.
iBnd
[
ibody
][
1
].
nodesCoord
=
np
.
column_stack
((
dataW
[:,
1
],
dataW
[:,
2
],
\
dataW
[:,
3
],
dataW
[:,
4
]))
connect2_w
=
np
.
zeros
((
len
(
connectListElems
)),
dtype
=
int
)
for
i
,
e
in
enumerate
(
self
.
blw
[
name
][
'
wake
'
].
tag
.
elems
):
connect2_w
[
connectListElems
[
i
]]
=
i
self
.
iBnd
[
ibody
][
1
].
setConnectList
(
connectListNodes
,
connect2_w
)
nodesCoord_w
=
np
.
column_stack
((
dataW
[:,
1
],
dataW
[:,
2
],
\
dataW
[:,
3
]))
elemCoordW
=
np
.
zeros
((
len
(
self
.
iBnd
[
ibody
][
1
].
nodesCoord
)
-
1
,
4
))
elemCoordW
=
np
.
zeros
((
len
(
dataW
)
-
1
,
3
))
elemsRows_w
=
np
.
zeros
((
len
(
dataW
)
-
1
),
dtype
=
int
)
for
i
in
range
(
len
(
elemCoordW
[:,
0
])):
elemCoordW
[
i
,
0
]
=
0.5
*
(
self
.
iBnd
[
ibody
][
1
].
nodesCoord
[
i
,
0
]
+
self
.
iBnd
[
ibody
][
1
].
nodesCoord
[
i
+
1
,
0
])
elemCoordW
[
i
,
1
]
=
0.5
*
(
self
.
iBnd
[
ibody
][
1
].
nodesCoord
[
i
,
1
]
+
self
.
iBnd
[
ibody
][
1
].
nodesCoord
[
i
+
1
,
1
])
elemCoordW
[
i
,
2
]
=
0.5
*
(
self
.
iBnd
[
ibody
][
1
].
nodesCoord
[
i
,
2
]
+
self
.
iBnd
[
ibody
][
1
].
nodesCoord
[
i
+
1
,
2
])
elemCoordW
[
i
,
3
]
=
i
self
.
iBnd
[
ibody
][
1
].
elemsCoord
=
elemCoordW
elemCoordW
[
i
,
0
]
=
0.5
*
(
dataW
[
i
,
1
]
+
dataW
[
i
+
1
,
1
])
elemCoordW
[
i
,
1
]
=
0.5
*
(
dataW
[
i
,
2
]
+
dataW
[
i
+
1
,
2
])
elemCoordW
[
i
,
2
]
=
0.5
*
(
dataW
[
i
,
3
]
+
dataW
[
i
+
1
,
3
])
elemsRows_w
[
i
]
=
i
self
.
iBnd
[
ibody
][
1
].
setMesh
(
nodesCoord_w
,
elemCoordW
)
self
.
iBnd
[
ibody
][
1
].
setConnectLists
(
connectListNodes
,
connect2_w
)
self
.
iBnd
[
ibody
][
1
].
setRows
(
dataW
[:,
4
],
elemsRows_w
)
def
__getWing3D
(
self
,
name
:
str
):
"""
Obtain the nodes
'
location and row and cg of all elements.
...
...
@@ -478,10 +485,9 @@ class DartInterface(SolversInterface):
i
+=
1
for
n
in
range
(
len
(
data
)):
self
.
iBnd
[
ibody
][
n
].
initStructures
(
data
[
n
].
shape
[
0
],
cg
[
n
].
shape
[
0
])
self
.
iBnd
[
ibody
][
n
].
nodesCoord
=
data
[
n
]
self
.
iBnd
[
ibody
][
n
].
elemsCoord
=
cg
[
n
]
self
.
iBnd
[
ibody
][
n
].
setConnectList
(
data
[
n
][:,
3
],
cg
[
n
][:,
3
])
self
.
iBnd
[
ibody
][
n
].
setMesh
(
data
[
n
][:,:
3
],
cg
[
n
][:,:
3
])
self
.
iBnd
[
ibody
][
n
].
setConnectLists
(
data
[
n
][:,
3
],
cg
[
n
][:,
3
])
self
.
iBnd
[
ibody
][
n
].
setRows
(
data
[
n
][:,
3
],
cg
[
n
][:,
3
])
### Getters
def
getAoA
(
self
):
...
...
@@ -571,7 +577,8 @@ class DartInterface(SolversInterface):
return
1.0
elif
self
.
getnDim
()
==
3
:
ibody
=
self
.
mapBodyNameToIndex
[
name
]
return
np
.
max
(
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[:,
1
])
-
np
.
min
(
self
.
iBnd
[
ibody
][
0
].
nodesCoord
[:,
1
])
nodes
=
self
.
iBnd
[
ibody
][
0
].
getNodes
(
'
all
'
)
return
np
.
max
(
nodes
[:,
1
])
-
np
.
min
(
nodes
[:,
1
])
else
:
raise
RuntimeError
(
'
Incorrect number of dimensions
'
)
...
...
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