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
4b6a1783
Commit
4b6a1783
authored
2 months ago
by
Adrien Crovato
Browse files
Options
Downloads
Patches
Plain Diff
Fix API by passing 'task' correctly.
parent
75fa95e4
No related branches found
No related tags found
No related merge requests found
Pipeline
#51340
failed
2 months ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
blast/api/blaster_api.py
+2
-1
2 additions, 1 deletion
blast/api/blaster_api.py
blast/interfaces/dart/blDartInterface.py
+22
-19
22 additions, 19 deletions
blast/interfaces/dart/blDartInterface.py
with
24 additions
and
20 deletions
blast/api/blaster_api.py
+
2
−
1
View file @
4b6a1783
...
...
@@ -41,6 +41,7 @@ def init_blaster(cfg, icfg, iSolverName='DART', task='analysis'):
All inputs have default values except Re.
- icg: Dict with options. Inviscid solver configuration.
- iSolverName (string): Name of the inviscid solver.
- task (string): Type of task (available: analysis, optimization) (default: analysis)
Outputs
-------
...
...
@@ -104,7 +105,7 @@ def init_blaster(cfg, icfg, iSolverName='DART', task='analysis'):
# Viscous solver object.
vSolver
=
blast
.
Driver
(
_Re
,
_Minf
,
_cfl0
,
_nSections
,
_xtrF
[
0
],
_xtrF
[
1
],
_span
,
_verbose
=
_verbose
)
# Solvers interface.
solverAPI
=
interface
(
icfg
,
vSolver
,
cfg
)
solverAPI
=
interface
(
icfg
,
vSolver
,
cfg
,
task
)
# Coupler
coupler
=
Coupler
(
solverAPI
,
vSolver
,
_maxCouplIter
=
_couplIter
,
_couplTol
=
_couplTol
,
_iterPrint
=
_iterPrint
,
_resetInv
=
_resetInv
)
...
...
This diff is collapsed.
Click to expand it.
blast/interfaces/dart/blDartInterface.py
+
22
−
19
View file @
4b6a1783
...
...
@@ -40,7 +40,7 @@ class DartInterface(SolversInterface):
adjointSolver : object
Adjoint solver object.
"""
def
__init__
(
self
,
dartCfg
,
vSolver
,
_cfg
):
def
__init__
(
self
,
dartCfg
,
vSolver
,
_cfg
,
task
):
"""
Constructor.
Parameters
...
...
@@ -51,13 +51,16 @@ class DartInterface(SolversInterface):
Viscous solver object.
_cfg : dict
Configuration parameters of the VII interface.
task : string, optional
Type of task (available: analysis, optimization) (default: analysis)
"""
# Load DART module
if
'
dart_path
'
in
dartCfg
:
# First try imposed path
try
:
init_dart
=
__import__
(
dartCfg
[
'
dart_path
'
],
fromlist
=
[
'
init_dart
'
]).
init_dart
print
(
f
'
DART loaded from specified path
{
dartCfg
[
"
dart_path
"
]
}
for
{
dartCfg
[
"
task
"
]
}
.
'
)
print
(
f
'
DART loaded from specified path
{
dartCfg
[
"
dart_path
"
]
}
for
{
task
}
.
'
)
except
ImportError
:
raise
ImportError
(
f
'
{
ccolors
.
ANSI_RED
}
Could not load DART from specified path:
{
dartCfg
[
"
dart_path
"
]
}
.
{
ccolors
.
ANSI_RESET
}
'
)
else
:
...
...
@@ -65,14 +68,14 @@ class DartInterface(SolversInterface):
for
name
,
path
in
dartflo_import_paths
.
items
():
try
:
init_dart
=
__import__
(
path
,
fromlist
=
[
'
init_dart
'
]).
init_dart
print
(
f
'
DART loaded from
{
name
}
path for
{
dartCfg
[
"
task
"
]
}
.
'
)
print
(
f
'
DART loaded from
{
name
}
path for
{
task
}
.
'
)
break
except
ImportError
:
continue
else
:
raise
ImportError
(
f
'
{
ccolors
.
ANSI_RED
}
Could not load DART.
{
ccolors
.
ANSI_RESET
}
'
)
self
.
iobj
=
init_dart
(
dartCfg
,
task
=
dartCfg
[
'
task
'
]
,
viscous
=
True
)
self
.
iobj
=
init_dart
(
dartCfg
,
task
=
task
,
viscous
=
True
)
self
.
solver
=
self
.
iobj
.
get
(
'
sol
'
)
# Solver
self
.
blw
=
[
self
.
iobj
.
get
(
'
blwb
'
),
self
.
iobj
.
get
(
'
blww
'
)]
self
.
adjointSolver
=
self
.
iobj
.
get
(
'
adj
'
)
...
...
@@ -81,12 +84,12 @@ class DartInterface(SolversInterface):
if
'
iMsh
'
not
in
_cfg
:
_cfg
[
'
iMsh
'
]
=
self
.
blw
SolversInterface
.
__init__
(
self
,
vSolver
,
_cfg
)
def
run
(
self
):
"""
Run the solver.
"""
return
self
.
solver
.
run
()
def
writeCp
(
self
,
sfx
=
''
):
"""
Write Cp distribution around the airfoil on file.
...
...
@@ -123,7 +126,7 @@ class DartInterface(SolversInterface):
if
self
.
getVerbose
()
>
1
:
print
(
'
writing data file
'
+
'
Cp
'
+
sfx
+
'
.dat
'
)
np
.
savetxt
(
'
Cp
'
+
sfx
+
'
.dat
'
,
data
,
fmt
=
'
%1.6e
'
,
delimiter
=
'
,
'
,
header
=
'
x, y, z, Cp
'
,
comments
=
''
)
elif
self
.
getnDim
()
==
3
:
# Save surface cp
data
=
np
.
zeros
((
self
.
iobj
[
'
bnd
'
].
nodes
.
size
(),
4
))
...
...
@@ -138,7 +141,7 @@ class DartInterface(SolversInterface):
if
self
.
getVerbose
()
>
1
:
print
(
'
Saving Cp files in vtk format. Msh {:s}, Tag {:.0f}
'
.
format
(
self
.
iobj
[
'
msh
'
].
name
,
self
.
cfg
[
'
saveTag
'
]))
invUtils
.
write_slices
(
self
.
iobj
[
'
msh
'
].
name
,
self
.
cfg
[
'
writeSections
'
],
self
.
cfg
[
'
saveTag
'
],
sfx
=
sfx
)
def
save
(
self
,
sfx
=
'
inviscid
'
):
"""
Save the solution.
...
...
@@ -153,17 +156,17 @@ class DartInterface(SolversInterface):
"""
Return the angle of attack.
"""
return
self
.
solver
.
pbl
.
alpha
def
setAoA
(
self
,
aoa
):
"""
Set the angle of attack.
"""
self
.
solver
.
pbl
.
update
(
aoa
)
def
getMinf
(
self
):
"""
Return the Mach number.
"""
return
self
.
solver
.
pbl
.
M_inf
def
getCl
(
self
):
"""
Return the lift coefficient.
"""
...
...
@@ -178,27 +181,27 @@ class DartInterface(SolversInterface):
"""
Return the moment coefficient.
"""
return
self
.
solver
.
Cm
def
getVerbose
(
self
):
"""
Return the verbosity level.
"""
return
self
.
solver
.
verbose
def
getnDim
(
self
):
"""
Return the number of dimensions.
"""
return
self
.
iobj
[
'
pbl
'
].
nDim
def
getnNodesDomain
(
self
):
"""
Return the number of nodes in the domain.
"""
return
self
.
solver
.
pbl
.
msh
.
nodes
.
size
()
def
reset
(
self
):
"""
Reset the solution.
"""
self
.
solver
.
reset
()
def
getInviscidBC
(
self
):
"""
Extract the inviscid paramaters at the edge of the boundary layer
and use it as a boundary condition in the viscous solver.
...
...
@@ -238,7 +241,7 @@ class DartInterface(SolversInterface):
raise
RuntimeError
(
'
dartInterface::Could not resolve how to set
\
the mesh. Either
''
nDim
''
is incorrect or
''
msh
''
was not set for
\
3D computations
'
)
def
getMesh
(
self
):
"""
Return the mesh on blowing boundaries
"""
...
...
@@ -355,7 +358,7 @@ class DartInterface(SolversInterface):
connect2
=
np
.
zeros
((
len
(
connectListElems
)),
dtype
=
int
)
for
i
,
e
in
enumerate
(
self
.
blw
[
0
].
tag
.
elems
):
connect2
[
connectListElems
[
i
]]
=
i
self
.
iBnd
[
0
].
nodesCoord
=
np
.
column_stack
((
data
[:,
1
],
data
[:,
2
],
\
data
[:,
3
],
data
[:,
4
]))
self
.
iBnd
[
0
].
setConnectList
(
connectListNodes
,
connect2
)
...
...
@@ -403,7 +406,7 @@ class DartInterface(SolversInterface):
dataW
[:,
4
]
=
dataW
[
connectListNodes
,
4
]
self
.
iBnd
[
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
[
1
].
tag
.
elems
):
connect2_w
[
connectListElems
[
i
]]
=
i
...
...
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