Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90758236
PadeTaylor.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:05
Size
2 KB
Mime Type
text/x-python
Expires
Wed, Nov 6, 12:05 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22130319
Attached To
R6746 RationalROMPy
PadeTaylor.py
View Options
import
numpy
as
np
from
rrompy.hfengines.fenics
import
HelmholtzSquareBubbleProblemEngine
as
HSBPE
from
rrompy.hfengines.fenics
import
HelmholtzSquareTransmissionProblemEngine
as
HSTPE
from
rrompy.hfengines.fenics
import
HelmholtzBoxScatteringProblemEngine
as
HBSPE
from
rrompy.hsengines.fenics
import
HSEngine
as
HS
from
rrompy.reduction_methods.taylor
import
ApproximantTaylorPade
as
Pade
testNo
=
4
if
testNo
==
1
:
params
=
{
'N'
:
4
,
'M'
:
3
,
'E'
:
4
,
'sampleType'
:
'Arnoldi'
,
'POD'
:
True
}
z0
=
12
ztar
=
10.5
solver
=
HSBPE
(
kappa
=
12
**
.
5
,
theta
=
np
.
pi
/
3
,
n
=
40
)
solver
.
omega
=
np
.
real
(
z0
**
.
5
)
plotter
=
HS
(
solver
.
V
)
approx
=
Pade
(
solver
,
plotter
,
mu0
=
z0
,
approxParameters
=
params
)
approx
.
plotApp
(
ztar
,
name
=
'u_Pade'''
)
approx
.
plotHF
(
ztar
,
name
=
'u_HF'
)
approx
.
plotErr
(
ztar
,
name
=
'err'
)
appErr
,
solNorm
=
approx
.
approxError
(
ztar
),
approx
.
HFNorm
(
ztar
)
print
((
'SolNorm:
\t
{}
\n
Err:
\t
{}
\n
ErrRel:
\t
{}'
)
.
format
(
solNorm
,
appErr
,
np
.
divide
(
appErr
,
solNorm
)))
print
(
'
\n
Poles Pade'':'
)
print
(
approx
.
getPoles
())
############
elif
testNo
==
2
:
params
=
{
'N'
:
7
,
'M'
:
6
,
'E'
:
7
,
'sampleType'
:
'Arnoldi'
,
'POD'
:
True
}
z0
=
16
ztar
=
14
solver
=
HSTPE
(
nT
=
2
,
nB
=
1
,
theta
=
np
.
pi
*
45
/
180
,
kappa
=
4.
,
n
=
50
)
solver
.
omega
=
np
.
real
(
z0
**
.
5
)
plotter
=
HS
(
solver
.
V
)
approx
=
Pade
(
solver
,
plotter
,
mu0
=
z0
,
approxParameters
=
params
,
plotDer
=
'ALL'
)
approx
.
plotApp
(
ztar
,
name
=
'u_Pade'''
)
approx
.
plotHF
(
ztar
,
name
=
'u_HF'
)
approx
.
plotErr
(
ztar
,
name
=
'err'
)
appErr
,
solNorm
=
approx
.
approxError
(
ztar
),
approx
.
HFNorm
(
ztar
)
print
((
'SolNorm:
\t
{}
\n
Err:
\t
{}
\n
ErrRel:
\t
{}'
)
.
format
(
solNorm
,
appErr
,
np
.
divide
(
appErr
,
solNorm
)))
print
(
'
\n
Poles Pade'':'
)
print
(
approx
.
getPoles
())
############
elif
testNo
in
[
3
,
4
]:
if
testNo
==
3
:
params
=
{
'N'
:
8
,
'M'
:
7
,
'E'
:
8
,
'sampleType'
:
'Krylov'
,
'POD'
:
True
}
else
:
params
=
{
'N'
:
8
,
'M'
:
7
,
'E'
:
8
,
'sampleType'
:
'Arnoldi'
,
'POD'
:
True
}
k0
=
3
ktar
=
4.25
+.
5j
solver
=
HBSPE
(
R
=
5
,
kappa
=
3
,
theta
=
-
np
.
pi
*
75
/
180
,
n
=
30
)
solver
.
omega
=
np
.
real
(
k0
)
plotter
=
HS
(
solver
.
V
)
approx
=
Pade
(
solver
,
plotter
,
mu0
=
k0
,
approxParameters
=
params
,
plotDer
=
'ALL'
)
approx
.
plotApp
(
ktar
,
name
=
'u_Pade'''
)
approx
.
plotHF
(
ktar
,
name
=
'u_HF'
)
approx
.
plotErr
(
ktar
,
name
=
'err'
)
appErr
,
solNorm
=
approx
.
approxError
(
ktar
),
approx
.
HFNorm
(
ktar
)
print
((
'SolNorm:
\t
{}
\n
Err:
\t
{}
\n
ErrRel:
\t
{}'
)
.
format
(
solNorm
,
appErr
,
np
.
divide
(
appErr
,
solNorm
)))
print
(
'
\n
Poles Pade'':'
)
print
(
approx
.
getPoles
())
Event Timeline
Log In to Comment