Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
The Gitlab server is succesfully updated to version 15.1.0
Open sidebar
Frederik Zahle
SEAMRotor
Commits
f5a62230
Commit
f5a62230
authored
Dec 26, 2015
by
Frederik Zahle
Browse files
fixing tests and other minor things
parent
73f4694a
Pipeline
#288
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
seamrotor/seamrotor.py
View file @
f5a62230
...
...
@@ -11,10 +11,9 @@ from scipy.optimize import minimize
class
SEAMBladeStructure
(
Component
):
def
__init__
(
self
):
def
__init__
(
self
,
nsections
=
21
):
super
(
SEAMBladeStructure
,
self
).
__init__
()
self
.
add_param
(
'Nsections'
,
21
,
desc
=
'number of sections'
)
self
.
add_param
(
'lifetime_cycles'
,
1.e7
,
desc
=
''
)
self
.
add_param
(
'wohler_exponent_blade_flap'
,
10.0
,
desc
=
''
)
...
...
@@ -31,13 +30,13 @@ class SEAMBladeStructure(Component):
self
.
add_param
(
'TIF_EDext'
,
1.
,
desc
=
'Technology improvement factor edge extreme'
)
self
.
add_param
(
'TIF_FLfat'
,
1.
,
desc
=
'Technology improvement factor flap LEQ'
)
self
.
add_param
(
'PMtarget'
,
1.0
,
desc
=
''
)
self
.
add_param
(
'PMtarget
_blade
'
,
1.0
,
desc
=
''
)
self
.
add_param
(
'sc_frac_flap'
,
0.3
,
desc
=
'spar cap fraction of chord'
)
self
.
add_param
(
'sc_frac_edge'
,
0.8
,
desc
=
'spar cap fraction of thickness'
)
self
.
add_param
(
'SF_blade'
,
1.1
,
desc
=
'factor??'
)
self
.
add_param
(
'Slim_ext_blade'
,
200.0
,
units
=
'MPa'
,
desc
=
''
)
self
.
add_param
(
'Slim_fat_blade'
,
27
,
units
=
'MPa'
,
desc
=
''
)
self
.
add_param
(
'Slim_fat_blade'
,
27
.
,
units
=
'MPa'
,
desc
=
''
)
self
.
add_param
(
'AddWeightFactorBlade'
,
1.2
,
desc
=
'Additional weight factor for blade shell'
)
self
.
add_param
(
'blade_density'
,
2100.
,
units
=
'kg/m**3'
,
desc
=
'density of blades'
)
...
...
@@ -45,6 +44,8 @@ class SEAMBladeStructure(Component):
self
.
add_output
(
'blade_mass'
,
15.0
,
units
=
'kg'
,
desc
=
'Blade mass'
)
self
.
add_output
(
'root_chord'
,
3.5
,
units
=
'm'
,
desc
=
'blade root chord'
)
self
.
nsections
=
nsections
def
solve_nonlinear
(
self
,
params
,
unknowns
,
resids
):
rotor_radius
=
params
[
'rotor_diameter'
]
/
2.
...
...
@@ -70,7 +71,7 @@ class SEAMBladeStructure(Component):
W
=
Ine
/
(
thick
/
2.
)
sfat
=
np
.
maximum
(
1.e-6
,
params
[
'SF_blade'
]
*
1.e3
*
Mfat_flap
/
W
/
1.e6
)
PM
=
params
[
'lifetime_cycles'
]
/
(
pow
(
10
,
(
params
[
'Slim_fat_blade'
]
-
params
[
'wohler_exponent_blade_flap'
]
*
np
.
log10
(
sfat
))))
return
abs
(
PM
-
params
[
'PMtarget'
])
/
norm
return
abs
(
PM
-
params
[
'PMtarget
_blade
'
])
/
norm
# Solving for t in edge direction, fatigue
def
solve_tfat_edge
(
t
,
C
,
thick
,
Mfat_edge
,
norm
):
...
...
@@ -78,9 +79,9 @@ class SEAMBladeStructure(Component):
W
=
Ine
/
(
C
/
2.
)
sfat
=
np
.
maximum
(
1.e-6
,
params
[
'SF_blade'
]
*
1.e3
*
Mfat_edge
/
W
/
1.e6
)
PM
=
params
[
'lifetime_cycles'
]
/
(
pow
(
10
,
(
params
[
'Slim_fat_blade'
]
-
params
[
'wohler_exponent_blade_flap'
]
*
np
.
log10
(
sfat
))))
return
abs
(
PM
-
params
[
'PMtarget'
])
/
norm
return
abs
(
PM
-
params
[
'PMtarget
_blade
'
])
/
norm
r
=
np
.
linspace
(
0
,
rotor_radius
,
params
[
'N
sections
'
]
)
r
=
np
.
linspace
(
0
,
rotor_radius
,
self
.
n
sections
)
C
=
np
.
zeros
(
r
.
shape
)
thick
=
np
.
zeros
(
r
.
shape
)
root_chord
=
rotor_radius
/
25.
...
...
@@ -93,7 +94,7 @@ class SEAMBladeStructure(Component):
unknowns
[
'root_chord'
]
=
root_chord
for
i
in
range
(
params
[
'N
sections
'
]
):
for
i
in
range
(
self
.
n
sections
):
# Calculating the chord and thickness
if
r
[
i
]
>
(
params
[
'MaxChordrR'
]
*
rotor_radius
):
...
...
@@ -158,34 +159,33 @@ class SEAMBladeStructure(Component):
self
.
Mfat_edge
=
Mfat_edge
# Calculating thickness flapwise extreme
text_flap
=
np
.
zeros
(
params
[
'N
sections
'
]
)
for
i
in
range
(
params
[
'N
sections
'
]
):
text_flap
=
np
.
zeros
(
self
.
n
sections
)
for
i
in
range
(
self
.
n
sections
):
norm
=
solve_text_flap
(
0.01
,
C
[
i
],
thick
[
i
],
Mext_flap
[
i
],
1.
)
res
=
minimize
(
solve_text_flap
,
0.01
,
args
=
(
C
[
i
],
thick
[
i
],
Mext_flap
[
i
],
norm
),
bounds
=
[(
1.e-6
,
0.5
)],
method
=
'SLSQP'
,
tol
=
1.e-8
)
text_flap
[
i
]
=
res
[
'x'
]
if
not
res
[
'success'
]:
print
(
'WARNING enter text_flap'
,
i
,
res
)
# Calculating thickness edgewise extreme
text_edge
=
np
.
zeros
(
params
[
'N
sections
'
]
)
for
i
in
range
(
params
[
'N
sections
'
]
):
norm
=
solve_text_edge
(
0.01
,
C
[
i
],
thick
[
i
],
Mext_
flap
[
i
],
1.
)
text_edge
=
np
.
zeros
(
self
.
n
sections
)
for
i
in
range
(
self
.
n
sections
):
norm
=
solve_text_edge
(
0.01
,
C
[
i
],
thick
[
i
],
Mext_
edge
[
i
],
1.
)
res
=
minimize
(
solve_text_edge
,
0.01
,
args
=
(
C
[
i
],
thick
[
i
],
Mext_edge
[
i
],
norm
),
bounds
=
[(
1.e-6
,
0.5
)],
method
=
'SLSQP'
,
tol
=
1.e-8
)
text_edge
[
i
]
=
res
[
'x'
]
if
not
res
[
'success'
]:
print
(
'WARNING solve_text_edge'
,
i
,
res
)
# Calculating thickness flapwise fatigue
tfat_flap
=
np
.
zeros
(
params
[
'N
sections
'
]
)
for
i
in
range
(
params
[
'N
sections
'
]
):
norm
=
solve_tfat_flap
(
0.01
,
C
[
i
],
thick
[
i
],
M
ex
t_flap
[
i
],
1.
)
tfat_flap
=
np
.
zeros
(
self
.
n
sections
)
for
i
in
range
(
self
.
n
sections
):
norm
=
solve_tfat_flap
(
0.01
,
C
[
i
],
thick
[
i
],
M
fa
t_flap
[
i
],
1.
)
res
=
minimize
(
solve_tfat_flap
,
0.01
,
args
=
(
C
[
i
],
thick
[
i
],
Mfat_flap
[
i
],
norm
),
bounds
=
[(
1.e-6
,
0.5
)],
method
=
'SLSQP'
,
tol
=
1.e-8
)
tfat_flap
[
i
]
=
res
[
'x'
]
if
not
res
[
'success'
]:
print
(
'WARNING solve_tfat_flap'
,
i
,
res
)
# Calculating thickness edgewise fatigue
tfat_edge
=
np
.
zeros
(
params
[
'N
sections
'
]
)
for
i
in
range
(
params
[
'N
sections
'
]
):
norm
=
solve_tfat_edge
(
0.01
,
C
[
i
],
thick
[
i
],
M
ext_flap
[
i
],
1.
)
tfat_edge
=
np
.
zeros
(
self
.
n
sections
)
for
i
in
range
(
self
.
n
sections
):
norm
=
solve_tfat_edge
(
0.01
,
C
[
i
],
thick
[
i
],
M
fat_edge
[
i
],
1.
)
res
=
minimize
(
solve_tfat_edge
,
0.01
,
args
=
(
C
[
i
],
thick
[
i
],
Mfat_edge
[
i
],
norm
),
bounds
=
[(
1.e-6
,
0.5
)],
method
=
'SLSQP'
,
tol
=
1.e-8
)
tfat_edge
[
i
]
=
res
[
'x'
]
if
not
res
[
'success'
]:
print
(
'WARNING solve_tfat_edge'
,
i
,
res
)
...
...
seamrotor/test/test_seamrotor.py
View file @
f5a62230
...
...
@@ -2,49 +2,38 @@
import
unittest
import
numpy
as
np
from
openmdao.
core
import
Group
,
Problem
from
openmdao.
api
import
Group
,
Problem
,
ScipyOptimizer
,
IndepVarComp
from
seamrotor.seamrotor
import
SEAMBladeStructure
# __author__ = 'pire'
from
openmdao.drivers.pyoptsparse_driver
import
pyOptSparseDriver
def
setup_prob
():
top
=
Problem
(
root
=
Group
())
blade
=
top
.
root
.
add
(
'blade'
,
SEAMBladeStructure
(),
promotes
=
[
'*'
])
top
=
Problem
(
root
=
Group
())
blade
=
top
.
root
.
add
(
'blade'
,
SEAMBladeStructure
(
21
),
promotes
=
[
'*'
])
top
.
setup
()
blade
.
params
[
'Nsections'
]
=
21
blade
.
params
[
'lifetime_cycles'
]
=
1e7
blade
.
params
[
'wohler_exponent_blade_flap'
]
=
10.0
blade
.
params
[
'PMtarget'
]
=
1.0
blade
.
params
[
'rotor_diameter'
]
=
177.
#[m]
# blade.params['RootChord'] = 2.0 #[m]
# blade.params['MaxChord'] = 2.5 #[m]
blade
.
params
[
'MaxChordrR'
]
=
0.2
#[m]
blade
.
params
[
'blade_root_flap_max'
]
=
47225.
blade
.
params
[
'blade_root_edge_max'
]
=
26712.
blade
.
params
[
'TIF_FLext'
]
=
1.
# Tech Impr Factor _ flap extreme
blade
.
params
[
'TIF_EDext'
]
=
1.
blade
.
params
[
'blade_root_flap_leq'
]
=
26975.
blade
.
params
[
'blade_root_edge_leq'
]
=
24252.
blade
.
params
[
'TIF_FLfat'
]
=
1.
blade
.
params
[
'sc_frac_flap'
]
=
0.3
# sparcap fraction of chord flap
blade
.
params
[
'sc_frac_edge'
]
=
0.8
# sparcap fraction of thickness edge
blade
.
params
[
'SF_blade'
]
=
1.1
#[factor]
blade
.
params
[
'Slim_ext_blade'
]
=
200.0
blade
.
params
[
'Slim_fat_blade'
]
=
27
blade
.
params
[
'AddWeightFactorBlade'
]
=
1.2
# Additional weight factor for blade shell
blade
.
params
[
'blade_density'
]
=
2100.
# [kg / m^3]
#blade.params['BladeCostPerMass'] = 15.0 #[e/kg]
#blade.params['HubCostPerMass'] = 3.5 #[e/kg]
#blade.params['SpinnerCostPerMass'] = 4.5 #[e/kg]
top
[
'rotor_diameter'
]
=
177.
top
[
'blade_root_flap_max'
]
=
47225.
top
[
'blade_root_edge_max'
]
=
26712.
top
[
'blade_root_flap_leq'
]
=
26975.
top
[
'blade_root_edge_leq'
]
=
24252.
top
[
'lifetime_cycles'
]
=
1e7
top
[
'wohler_exponent_blade_flap'
]
=
10.0
top
[
'PMtarget_blade'
]
=
1.0
top
[
'MaxChordrR'
]
=
0.2
top
[
'TIF_FLext'
]
=
1.
top
[
'TIF_EDext'
]
=
1.
top
[
'TIF_FLfat'
]
=
1.
top
[
'sc_frac_flap'
]
=
0.3
# sparcap fraction of chord flap
top
[
'sc_frac_edge'
]
=
0.8
# sparcap fraction of thickness edge
top
[
'SF_blade'
]
=
1.1
top
[
'Slim_ext_blade'
]
=
200.0
top
[
'Slim_fat_blade'
]
=
27.
top
[
'AddWeightFactorBlade'
]
=
1.2
# Additional weight factor for blade shell
top
[
'blade_density'
]
=
2100.
# [kg / m^3]
return
top
class
TestSEAMBladeStructure
(
unittest
.
TestCase
):
...
...
@@ -54,10 +43,10 @@ class TestSEAMBladeStructure(unittest.TestCase):
top
=
setup_prob
()
top
.
run
()
self
.
assertAlmostEqual
(
blade
.
unknowns
[
'
B
lade
Weight'
],
30876.655915672229
)
self
.
assertAlmostEqual
(
top
[
'
b
lade
_mass'
]
/
33485.1942627
,
1.
,
places
=
6
)
if
__name__
==
"__main__"
:
#
unittest.main()
top
=
setup_prob
()
top
.
run
()
unittest
.
main
()
#
top = setup_prob()
#
top.run()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment