Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61292697
LagrangePoles.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, May 5, 18:18
Size
1 KB
Mime Type
text/x-python
Expires
Tue, May 7, 18:18 (2 d)
Engine
blob
Format
Raw Data
Handle
17491579
Attached To
R6746 RationalROMPy
LagrangePoles.py
View Options
from
matplotlib
import
pyplot
as
plt
import
numpy
as
np
from
rrompy.hfengines.linear_problem
import
\
HelmholtzSquareBubbleProblemEngine
as
HSBPE
from
rrompy.reduction_methods.lagrange
import
ApproximantLagrangePade
as
Pade
from
rrompy.utilities.parameter_sampling
import
QuadratureSampler
as
QS
from
rrompy.utilities.base
import
squareResonances
verb
=
0
ks
=
[
1
,
46
**
.
5
]
solver
=
HSBPE
(
kappa
=
12
**
.
5
,
theta
=
np
.
pi
/
3
,
n
=
20
,
verbosity
=
verb
)
k0
=
np
.
mean
(
np
.
power
(
ks
,
2.
))
**
.
5
k0
=
3.46104724
solver
.
omega
=
np
.
real
(
k0
)
rescaling
=
lambda
x
:
np
.
power
(
x
,
2.
)
rescalingInv
=
lambda
x
:
np
.
power
(
x
,
.
5
)
sampler
=
QS
(
ks
,
"UNIFORM"
,
rescaling
,
rescalingInv
)
nsets
=
15
paramsPade
=
{
'S'
:
2
,
'POD'
:
True
,
'basis'
:
"LEGENDRE"
,
'sampler'
:
sampler
}
approx
=
Pade
(
solver
,
mu0
=
k0
,
approxParameters
=
paramsPade
,
verbosity
=
verb
)
poles
=
[
None
]
*
(
nsets
-
1
)
polesexact
=
np
.
unique
(
np
.
power
(
squareResonances
(
ks
[
0
]
**
2.
,
ks
[
1
]
**
2.
,
False
),
.
5
))
for
i
in
range
(
1
,
nsets
):
print
(
"N = {}"
.
format
(
4
*
i
))
approx
.
approxParameters
=
{
'N'
:
4
*
i
,
'M'
:
4
*
i
,
'S'
:
4
*
i
+
1
}
approx
.
setupApprox
()
poles
[
i
-
1
]
=
approx
.
getPoles
()
for
i
in
range
(
1
,
nsets
):
plt
.
figure
()
plt
.
plot
(
np
.
real
(
poles
[
i
-
1
]),
np
.
imag
(
poles
[
i
-
1
]),
'kx'
)
plt
.
plot
(
polesexact
,
np
.
zeros_like
(
polesexact
),
'm.'
)
plt
.
plot
(
k0
,
0
,
'r*'
)
plt
.
xlim
(
ks
)
plt
.
ylim
((
ks
[
0
]
-
ks
[
1
])
/
2.
,
(
ks
[
1
]
-
ks
[
0
])
/
2.
)
plt
.
title
(
"N = {}, Neff = {}"
.
format
(
4
*
i
,
len
(
poles
[
i
-
1
])))
plt
.
grid
()
plt
.
show
()
plt
.
close
()
Event Timeline
Log In to Comment