Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90759207
LagrangeSweep.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
Mon, Nov 4, 12:18
Size
2 KB
Mime Type
text/x-python
Expires
Wed, Nov 6, 12:18 (2 d)
Engine
blob
Format
Raw Data
Handle
22130440
Attached To
R6746 RationalROMPy
LagrangeSweep.py
View Options
from
copy
import
copy
import
numpy
as
np
from
rrompy.hfengines.fenics
import
HelmholtzSquareBubbleProblemEngine
as
HSBPE
from
rrompy.hfengines.fenics
import
HelmholtzBoxScatteringProblemEngine
as
HBSPE
from
rrompy.hsengines.fenics
import
HSEngine
as
HS
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.sampling
import
QuadratureSampler
as
QS
testNo
=
2
npoints
=
31
if
testNo
==
1
:
ks
=
[
4
+
.
5j
,
14
+
.
5j
]
solver
=
HSBPE
(
kappa
=
12
**
.
5
,
theta
=
np
.
pi
/
3
,
n
=
10
)
solver
.
omega
=
np
.
real
(
np
.
mean
(
ks
))
mutars
=
np
.
linspace
(
0
,
21
,
npoints
)
filenamebase
=
'../data/output/HelmholtzBubbleLagrange'
elif
testNo
==
2
:
ks
=
[
10
+
.
25j
,
14
+
.
25j
]
solver
=
HBSPE
(
R
=
5
,
kappa
=
3
,
theta
=
-
np
.
pi
*
75
/
180
,
n
=
10
)
solver
.
omega
=
np
.
real
(
np
.
mean
(
ks
))
mutars
=
np
.
linspace
(
9
,
14
,
npoints
)
filenamebase
=
'../data/output/HelmholtzBoxLagrange'
plotter
=
HS
(
solver
.
V
)
k0
=
np
.
mean
(
ks
)
shift
=
12
nsets
=
5
stride
=
3
Smax
=
stride
*
(
nsets
-
1
)
+
shift
+
2
paramsPade
=
{
'S'
:
Smax
,
'POD'
:
True
,
'sampler'
:
QS
(
ks
,
"CHEBYSHEV"
)}
paramsRB
=
copy
(
paramsPade
)
paramsSetsPade
=
[
None
]
*
nsets
paramsSetsRB
=
[
None
]
*
nsets
for
i
in
range
(
nsets
):
paramsSetsPade
[
i
]
=
{
'N'
:
stride
*
i
+
shift
+
1
,
'M'
:
stride
*
i
+
shift
,
'S'
:
stride
*
i
+
shift
+
2
}
paramsSetsRB
[
i
]
=
{
'R'
:
stride
*
i
+
shift
+
1
,
'S'
:
stride
*
i
+
shift
+
2
}
appPade
=
Pade
(
solver
,
plotter
,
mu0
=
k0
,
approxParameters
=
paramsPade
)
appRB
=
RB
(
solver
,
plotter
,
mu0
=
k0
,
approxParameters
=
paramsRB
)
sweeper
=
Sweeper
(
mutars
=
mutars
,
mostExpensive
=
'Approx'
)
sweeper
.
ROMEngine
=
appPade
sweeper
.
params
=
paramsSetsPade
filenamePade
=
sweeper
.
sweep
(
filenamebase
+
'PadeFE.dat'
,
outputs
=
'ALL'
)
sweeper
.
ROMEngine
=
appRB
sweeper
.
params
=
paramsSetsRB
filenameRB
=
sweeper
.
sweep
(
filenamebase
+
'RBFE.dat'
,
outputs
=
'ALL'
)
sweeper
.
plot
(
filenamePade
,
[
'muRe'
],
[
'HFNorm'
,
'AppNorm'
],
[
'S'
],
onePlot
=
True
)
sweeper
.
plot
(
filenameRB
,
[
'muRe'
],
[
'HFNorm'
,
'AppNorm'
],
[
'S'
],
onePlot
=
True
)
sweeper
.
plot
(
filenamePade
,
[
'muRe'
],
[
'ErrNorm'
],
[
'S'
])
sweeper
.
plot
(
filenameRB
,
[
'muRe'
],
[
'ErrNorm'
],
[
'S'
])
Event Timeline
Log In to Comment