Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93775352
LagrangeSweepUnstable.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Dec 1, 09:58
Size
3 KB
Mime Type
text/x-python
Expires
Tue, Dec 3, 09:58 (2 d)
Engine
blob
Format
Raw Data
Handle
22702489
Attached To
R6746 RationalROMPy
LagrangeSweepUnstable.py
View Options
from
copy
import
copy
import
numpy
as
np
from
rrompy.hfengines.scipy
import
HelmholtzSquareBubbleProblemEngine
as
HSBPE
from
rrompy.reduction_methods.lagrange
import
ApproximantLagrangePade
as
Pade
from
rrompy.reduction_methods.lagrange
import
ApproximantLagrangeRB
as
RB
from
rrompy.utilities.parameter_sweeper
import
ParameterSweeper
as
Sweeper
from
rrompy.utilities.parameter_sampling
import
ManualSampler
as
MS
npoints
=
50
solver
=
HSBPE
(
kappa
=
12
**
.
5
,
theta
=
np
.
pi
/
3
,
n
=
30
,
verbosity
=
0
)
mutars
=
np
.
linspace
(
6
**.
5
,
16
**.
5
,
npoints
)
filenamebase
=
'../data/output/HelmholtzBubbleLagrange'
k0
=
np
.
mean
(
mutars
)
rescaling
=
lambda
x
:
np
.
power
(
x
,
2.
)
rescalingInv
=
lambda
x
:
np
.
power
(
x
,
.
5
)
paramsChoices
=
{
'Stable'
:
{
'S'
:
4
,
'POD'
:
True
,
'sampler'
:
MS
([
6
**.
5
,
16
**.
5
],
[[
14
**.
5
],
[
12
**.
5
],
[
9
**.
5
],
[
11
**.
5
]])},
'Unstable'
:
{
'S'
:
4
,
'POD'
:
True
,
'sampler'
:
MS
([
6
**.
5
,
16
**.
5
],
[[
8
**.
5
],
[
10
**.
5
],
[
13
**.
5
],
[
11
**.
5
]])}
}
j
=
0
filenamePade
=
[
None
]
*
len
(
paramsChoices
.
keys
())
filenameRB
=
[
None
]
*
len
(
paramsChoices
.
keys
())
for
typeP
in
paramsChoices
.
keys
():
paramsPade
=
paramsChoices
[
typeP
]
paramsRB
=
copy
(
paramsPade
)
paramsSetsPade
=
[{
'N'
:
3
,
'M'
:
3
}]
paramsSetsRB
=
[{
'R'
:
4
}]
appPade
=
Pade
(
solver
,
mu0
=
k0
,
approxParameters
=
paramsPade
,
verbosity
=
0
)
appRB
=
RB
(
solver
,
mu0
=
k0
,
approxParameters
=
paramsRB
,
verbosity
=
0
)
sweeper
=
Sweeper
(
mutars
=
mutars
,
mostExpensive
=
'Approx'
)
sweeper
.
ROMEngine
=
appPade
sweeper
.
params
=
paramsSetsPade
filenamePade
[
j
]
=
sweeper
.
sweep
(
filenamebase
+
'Pade{}.dat'
.
format
(
typeP
),
verbose
=
0
)
sweeper
.
ROMEngine
=
appRB
sweeper
.
params
=
paramsSetsRB
filenameRB
[
j
]
=
sweeper
.
sweep
(
filenamebase
+
'RB{}.dat'
.
format
(
typeP
),
verbose
=
0
)
j
+=
1
print
(
"Pade'"
)
sweeper
.
plotCompare
(
filenamePade
,
[
'muRe'
],
[
'normHF'
,
'normApp'
],
[
'S'
],
onePlot
=
True
,
save
=
filenamebase
+
'PadeNorm'
,
saveFormat
=
"png"
,
labels
=
list
(
paramsChoices
.
keys
()))
sweeper
.
plotCompare
(
filenamePade
,
[
'muRe'
],
[
'normResRel'
],
[
'S'
],
save
=
filenamebase
+
'PadeRes'
,
saveFormat
=
"png"
,
labels
=
list
(
paramsChoices
.
keys
()))
sweeper
.
plotCompare
(
filenamePade
,
[
'muRe'
],
[
'normErrRel'
],
[
'S'
],
save
=
filenamebase
+
'PadeErr'
,
saveFormat
=
"png"
,
labels
=
list
(
paramsChoices
.
keys
()))
print
(
"RB"
)
sweeper
.
plotCompare
(
filenameRB
,
[
'muRe'
],
[
'normHF'
,
'normApp'
],
[
'S'
],
onePlot
=
True
,
save
=
filenamebase
+
'RBNorm'
,
saveFormat
=
"png"
,
labels
=
list
(
paramsChoices
.
keys
()))
sweeper
.
plotCompare
(
filenameRB
,
[
'muRe'
],
[
'normResRel'
],
[
'S'
],
save
=
filenamebase
+
'RBRes'
,
saveFormat
=
"png"
,
labels
=
list
(
paramsChoices
.
keys
()))
sweeper
.
plotCompare
(
filenameRB
,
[
'muRe'
],
[
'normErrRel'
],
[
'S'
],
save
=
filenamebase
+
'RBErr'
,
saveFormat
=
"png"
,
labels
=
list
(
paramsChoices
.
keys
()))
Event Timeline
Log In to Comment