Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dartflo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Dechamps Paul
dartflo
Commits
ddda1874
Commit
ddda1874
authored
3 years ago
by
Adrien Crovato
Browse files
Options
Downloads
Patches
Plain Diff
Minor fixes in internal API and utils.
parent
92534434
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dart/api/internal/polar.py
+12
-13
12 additions, 13 deletions
dart/api/internal/polar.py
dart/api/internal/trim.py
+2
-1
2 additions, 1 deletion
dart/api/internal/trim.py
dart/utils.py
+5
-11
5 additions, 11 deletions
dart/utils.py
with
19 additions
and
25 deletions
dart/api/internal/polar.py
+
12
−
13
View file @
ddda1874
...
...
@@ -81,34 +81,33 @@ class Polar:
"""
Compute the polar
"""
# initialize the loop
ac
=
0
if
self
.
alphas
[
0
]
==
self
.
alphas
[
-
1
]
else
1
self
.
Cls
=
[]
self
.
Cds
=
[]
self
.
Cms
=
[]
print
(
ccolors
.
ANSI_BLUE
+
'
Sweeping AoA from
'
,
self
.
alphas
[
0
],
'
to
'
,
self
.
alphas
[
-
1
],
ccolors
.
ANSI_RESET
)
for
alpha
in
self
.
alphas
:
for
i
in
range
(
len
(
self
.
alphas
))
:
# define current angle of attack
alpha
=
alpha
*
math
.
pi
/
180
# update problem
alpha
=
self
.
alphas
[
i
]
*
math
.
pi
/
180
acs
=
'
_{:04d}
'
.
format
(
i
)
# update problem and reset ICs to improve robustness in transonic cases
self
.
pbl
.
update
(
alpha
)
self
.
sol
.
reset
()
# run the solver and save the results
print
(
ccolors
.
ANSI_BLUE
+
'
Running the solver for
'
,
alpha
*
180
/
math
.
pi
,
'
degrees
'
,
ccolors
.
ANSI_RESET
)
print
(
ccolors
.
ANSI_BLUE
+
'
Running the solver for
'
,
self
.
alphas
[
i
]
,
'
degrees
'
,
ccolors
.
ANSI_RESET
)
self
.
tms
[
"
solver
"
].
start
()
self
.
sol
.
run
()
self
.
tms
[
"
solver
"
].
stop
()
self
.
sol
.
save
(
self
.
wrtr
,
ac
)
self
.
sol
.
save
(
self
.
wrtr
,
ac
s
)
# extract Cp
if
self
.
dim
==
2
:
Cp
=
dU
.
extract
(
self
.
bnd
.
groups
[
0
].
tag
.
elems
,
self
.
sol
.
Cp
)
tU
.
write
(
Cp
,
'
Cp_airfoil
_
'
+
str
(
ac
)
+
'
.dat
'
,
'
%1.5e
'
,
'
,
'
,
'
alpha =
'
+
str
(
alpha
*
180
/
math
.
pi
)
+
'
deg
\n
x, y, z, Cp
'
,
''
)
tU
.
write
(
Cp
,
f
'
Cp_airfoil
{
acs
}
.dat
'
,
'
%1.5e
'
,
'
,
'
,
'
alpha =
'
+
str
(
alpha
*
180
/
math
.
pi
)
+
'
deg
\n
x, y, z, Cp
'
,
''
)
elif
self
.
dim
==
3
and
self
.
format
==
'
vtk
'
and
self
.
slice
:
dU
.
writeSlices
(
self
.
msh
.
name
,
self
.
slice
,
self
.
tag
,
ac
)
dU
.
writeSlices
(
self
.
msh
.
name
,
self
.
slice
,
self
.
tag
,
ac
s
)
# extract force coefficients
self
.
Cls
.
append
(
self
.
sol
.
Cl
)
self
.
Cds
.
append
(
self
.
sol
.
Cd
)
self
.
Cms
.
append
(
self
.
sol
.
Cm
)
# end loop
ac
+=
1
def
disp
(
self
):
"""
Display the results and draw the polar
...
...
@@ -127,6 +126,6 @@ class Polar:
print
(
self
.
tms
)
# plot results
if
self
.
alphas
[
0
]
!=
self
.
alphas
[
-
1
]:
tU
.
plot
(
self
.
alphas
,
self
.
Cls
,
"
alpha
"
,
"
Cl
"
,
""
)
tU
.
plot
(
self
.
alphas
,
self
.
Cds
,
"
alpha
"
,
"
Cd
"
,
""
)
tU
.
plot
(
self
.
alphas
,
self
.
Cms
,
"
alpha
"
,
"
Cm
"
,
""
)
tU
.
plot
(
self
.
alphas
,
self
.
Cls
,
'
alpha
'
,
'
Cl
'
,
''
)
tU
.
plot
(
self
.
alphas
,
self
.
Cds
,
'
alpha
'
,
'
Cd
'
,
''
)
tU
.
plot
(
self
.
alphas
,
self
.
Cms
,
'
alpha
'
,
'
Cm
'
,
''
)
This diff is collapsed.
Click to expand it.
dart/api/internal/trim.py
+
2
−
1
View file @
ddda1874
...
...
@@ -86,8 +86,9 @@ class Trim:
while
True
:
# define current angle of attack
print
(
ccolors
.
ANSI_BLUE
+
'
Setting AoA to
'
,
self
.
alpha
*
180
/
math
.
pi
,
ccolors
.
ANSI_RESET
)
# update problem
# update problem
and reset ICs to improve robustness in transonic cases
self
.
pbl
.
update
(
self
.
alpha
)
self
.
sol
.
reset
()
# run the solver
self
.
tms
[
"
solver
"
].
start
()
status
=
self
.
sol
.
run
()
...
...
This diff is collapsed.
Click to expand it.
dart/utils.py
+
5
−
11
View file @
ddda1874
...
...
@@ -111,7 +111,7 @@ def extract(vElems, vData):
i
+=
1
return
data
def
writeSlices
(
mshName
,
ys
,
wId
,
n
=
0
):
def
writeSlices
(
mshName
,
ys
,
wId
,
sfx
=
''
):
"""
Write slice data for each ys coordinate along the span (only works with VTK)
Parameters
...
...
@@ -122,8 +122,8 @@ def writeSlices(mshName, ys, wId, n = 0):
y-coordinates of slices
wId : int
index of physical tag to slice (see gmsh)
n :
in
t
(optional
, > 0
)
index of mesh/solution file (
will be appended to mesh file name
)
sfx : str
in
g
(optional)
suffix that
will be appended to mesh
/solution
file name
"""
import
numpy
as
np
try
:
...
...
@@ -134,10 +134,7 @@ def writeSlices(mshName, ys, wId, n = 0):
import
tboxVtk.reader
as
vtkR
import
tboxVtk.cutter
as
vtkC
reader
=
vtkR
.
Reader
()
if
n
==
0
:
reader
.
open
(
mshName
)
else
:
reader
.
open
(
mshName
+
'
_
'
+
str
(
n
))
reader
.
open
(
mshName
+
sfx
)
cutter
=
vtkC
.
Cutter
(
reader
.
reader
.
GetOutputPort
())
for
i
in
range
(
0
,
len
(
ys
)):
pts
,
elems
,
vals
=
cutter
.
extract
(
cutter
.
cut
(
wId
,
[
0.
,
ys
[
i
],
0.
],
[
0.
,
1.
,
0.
]),
2
,
[
'
Cp
'
])
...
...
@@ -147,7 +144,4 @@ def writeSlices(mshName, ys, wId, n = 0):
data
=
np
.
hstack
((
data
,
vals
[
'
Cp
'
]))
tU
.
sort
(
elems
,
data
)
data
=
np
.
vstack
((
data
,
data
[
0
,:]))
if
n
==
0
:
tU
.
write
(
data
,
'
slice_
'
+
str
(
i
)
+
'
.dat
'
,
'
%1.5e
'
,
'
,
'
,
'
x, y, z, x/c, Cp
'
,
''
)
else
:
tU
.
write
(
data
,
'
slice_
'
+
str
(
n
)
+
'
_
'
+
str
(
i
)
+
'
.dat
'
,
'
%1.5e
'
,
'
,
'
,
'
x, y, z, x/c, Cp
'
,
''
)
tU
.
write
(
data
,
mshName
+
sfx
+
'
_slice_
'
+
str
(
i
)
+
'
.dat
'
,
'
%1.5e
'
,
'
,
'
,
'
x, y, z, x/c, Cp
'
,
''
)
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