Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
PyWake
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
Container Registry
Model registry
Operate
Environments
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
TOPFARM
PyWake
Commits
153fd385
Commit
153fd385
authored
3 years ago
by
Mads M. Pedersen
Browse files
Options
Downloads
Patches
Plain Diff
add analytical test of SqrMaxSum
parent
ae200e20
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
py_wake/deficit_models/__init__.py
+1
-0
1 addition, 0 deletions
py_wake/deficit_models/__init__.py
py_wake/superposition_models.py
+1
-4
1 addition, 4 deletions
py_wake/superposition_models.py
py_wake/tests/test_superposition_models.py
+24
-2
24 additions, 2 deletions
py_wake/tests/test_superposition_models.py
with
26 additions
and
6 deletions
py_wake/deficit_models/__init__.py
+
1
−
0
View file @
153fd385
...
...
@@ -10,3 +10,4 @@ from .gaussian import BastankhahGaussianDeficit, IEA37SimpleBastankhahGaussianDe
NiayifarGaussianDeficit
,
ZongGaussianDeficit
from
.fuga
import
FugaDeficit
,
FugaYawDeficit
from
.gcl
import
GCLDeficit
from
.no_wake
import
NoWakeDeficit
This diff is collapsed.
Click to expand it.
py_wake/superposition_models.py
+
1
−
4
View file @
153fd385
...
...
@@ -46,7 +46,7 @@ class AddedTurbulenceSuperpositionModel():
return
TI_xxx
+
self
(
add_turb_jxxx
)
class
SquaredSum
(
SuperpositionModel
):
class
SquaredSum
(
SuperpositionModel
,
AddedTurbulenceSuperpositionModel
):
def
__call__
(
self
,
value_jxxx
):
return
np
.
sqrt
(
np
.
sum
(
value_jxxx
**
2
,
0
))
...
...
@@ -55,9 +55,6 @@ class LinearSum(SuperpositionModel, AddedTurbulenceSuperpositionModel):
def
__call__
(
self
,
value_jxxx
):
return
np
.
sum
(
value_jxxx
,
0
)
def
calc_effective_TI
(
self
,
TI_xxx
,
add_turb_jxxx
):
return
TI_xxx
+
self
(
add_turb_jxxx
)
class
MaxSum
(
SuperpositionModel
,
AddedTurbulenceSuperpositionModel
):
def
__call__
(
self
,
value_jxxx
):
...
...
This diff is collapsed.
Click to expand it.
py_wake/tests/test_superposition_models.py
+
24
−
2
View file @
153fd385
...
...
@@ -2,16 +2,17 @@ import pytest
import
numpy
as
np
from
py_wake
import
NOJ
from
py_wake.site._site
import
UniformSite
from
py_wake.superposition_models
import
LinearSum
,
SquaredSum
,
MaxSum
from
py_wake.superposition_models
import
LinearSum
,
SquaredSum
,
MaxSum
,
SqrMaxSum
from
py_wake.tests
import
npt
from
py_wake.wind_farm_models.engineering_models
import
PropagateDownwind
,
All2AllIterative
from
py_wake.deficit_models.noj
import
NOJDeficit
from
py_wake.turbulence_models
import
TurbulenceModel
from
py_wake.flow_map
import
HorizontalGrid
from
py_wake.tests.test_deficit_models.test_noj
import
NibeA0
import
xarray
as
xr
from
py_wake.examples.data.hornsrev1
import
V80
from
py_wake.deficit_models.deficit_model
import
BlockageDeficitModel
,
WakeDeficitModel
from
py_wake.deficit_models
.selfsimilarity
import
SelfSimilarityDeficit
from
py_wake.deficit_models
import
SelfSimilarityDeficit
,
NoWakeDeficit
d02
=
8.1
-
5.7
d12
=
8.1
-
4.90473373
...
...
@@ -30,6 +31,27 @@ def test_superposition_models(superpositionModel, res):
npt
.
assert_array_almost_equal
(
WS_eff_ilk
[
-
1
,
0
,
0
],
res
)
@pytest.mark.parametrize
(
'
superpositionModel,res
'
,
[(
LinearSum
(),
0.1
+
(.
6
+
.
2
)),
(
SquaredSum
(),
.
1
+
np
.
hypot
(.
6
,
.
2
)),
(
MaxSum
(),
.
1
+
.
6
),
(
SqrMaxSum
(),
np
.
hypot
(.
1
,
.
6
))])
def
test_superposition_models_TI
(
superpositionModel
,
res
):
site
=
UniformSite
([
1
],
0.1
)
class
MyTurbulenceModel
(
TurbulenceModel
):
args4addturb
=
[
'
dw_ijlk
'
]
def
calc_added_turbulence
(
self
,
dw_ijlk
,
**
_
):
return
1.2
-
dw_ijlk
/
100
wake_model
=
PropagateDownwind
(
site
,
NibeA0
,
NoWakeDeficit
(),
turbulenceModel
=
MyTurbulenceModel
(
superpositionModel
))
x_i
=
[
0
,
0
,
0
]
y_i
=
[
0
,
-
40
,
-
100
]
h_i
=
[
50
,
50
,
50
]
TI_eff_ilk
=
wake_model
.
calc_wt_interaction
(
x_i
,
y_i
,
h_i
,
[
0
,
0
,
1
],
0.0
,
8.1
)[
1
]
npt
.
assert_array_almost_equal
(
TI_eff_ilk
[
-
1
,
0
,
0
],
res
)
@pytest.mark.parametrize
(
'
superpositionModel,sum_func
'
,
[(
LinearSum
(),
np
.
sum
),
(
SquaredSum
(),
lambda
x
:
np
.
hypot
(
*
x
)),
(
MaxSum
(),
np
.
max
)])
...
...
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