Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63049999
funnel_output.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
Fri, May 17, 10:53
Size
1 KB
Mime Type
text/x-python
Expires
Sun, May 19, 10:53 (2 d)
Engine
blob
Format
Raw Data
Handle
17725835
Attached To
R6746 RationalROMPy
funnel_output.py
View Options
import
numpy
as
np
from
funnel_output_engine
import
FunnelOutputEngine
as
engine
from
rrompy.reduction_methods.standard
import
RationalInterpolant
as
RI
from
rrompy.reduction_methods.greedy
import
RationalInterpolantGreedy
as
RIG
from
rrompy.parameter.parameter_sampling
import
QuadratureSampler
as
QS
ks
=
[
5.
,
10.
]
k0
,
n
=
np
.
mean
(
ks
),
50
solver
=
engine
(
k0
,
n
)
k
=
6.5
for
method
in
[
"RI"
,
"RI_OUTPUT"
,
"RI_GREEDY"
,
"RI_GREEDY_OUTPUT"
]:
print
(
"Testing {} method"
.
format
(
method
))
if
"GREEDY"
not
in
method
:
params
=
{
'N'
:
19
,
'M'
:
19
,
'S'
:
20
,
'POD'
:
True
,
'polybasis'
:
"CHEBYSHEV"
,
'sampler'
:
QS
(
ks
,
"CHEBYSHEV"
)}
algo
=
RI
if
"GREEDY"
in
method
:
params
=
{
'S'
:
2
,
'POD'
:
True
,
'polybasis'
:
"LEGENDRE"
,
'greedyTol'
:
1e-1
,
'maxIter'
:
25
,
'sampler'
:
QS
(
ks
,
"UNIFORM"
),
'errorEstimatorKind'
:
"LOOK_AHEAD_OUTPUT"
}
algo
=
RIG
approx
=
algo
(
solver
,
mu0
=
k0
,
approx_state
=
method
[
-
7
:]
!=
"_OUTPUT"
,
approxParameters
=
params
,
verbosity
=
5
)
if
"GREEDY"
not
in
method
:
approx
.
setupApprox
()
else
:
approx
.
setupApprox
(
"LAST"
)
approx
.
plotApprox
(
k
,
name
=
'u_app'
)
approx
.
plotHF
(
k
,
name
=
'u_HF'
)
approx
.
plotErr
(
k
,
name
=
'err'
)
normErr
=
approx
.
normErr
(
k
)[
0
]
normSol
=
approx
.
normHF
(
k
)[
0
]
print
(
"SolNorm:
\t
{:.5e}
\n
Err:
\t
{:.5e}
\n
ErrRel:
\t
{:.5e}"
.
format
(
normSol
,
normErr
,
normErr
/
normSol
))
print
(
"Poles:
\n
{}"
.
format
(
approx
.
getPoles
()))
print
(
"
\n
"
)
Event Timeline
Log In to Comment