Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61347604
parametricDomain.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, May 6, 02:48
Size
1 KB
Mime Type
text/x-python
Expires
Wed, May 8, 02:48 (2 d)
Engine
blob
Format
Raw Data
Handle
17499012
Attached To
R6746 RationalROMPy
parametricDomain.py
View Options
import
numpy
as
np
from
rrompy.hfengines.linear_problem
import
\
HelmholtzSquareBubbleDomainProblemEngine
as
HSBDPE
from
rrompy.reduction_methods.centered
import
RationalPade
as
Pade
from
rrompy.reduction_methods.centered
import
RBCentered
as
RB
from
operator
import
itemgetter
def
subdict
(
d
,
ks
):
return
dict
(
zip
(
ks
,
itemgetter
(
*
ks
)(
d
)))
testNo
=
2
verb
=
0
if
testNo
==
1
:
mu
=
7
**
.
5
solver
=
HSBDPE
(
kappa
=
12
**
.
5
,
theta
=
np
.
pi
/
3
,
n
=
40
,
mu0
=
mu
,
degree_threshold
=
15
,
verbosity
=
verb
)
uh
=
solver
.
solve
(
mu
)
solver
.
plotmesh
()
print
(
solver
.
norm
(
uh
))
solver
.
plot
(
uh
)
############
if
testNo
==
2
:
params
=
{
'N'
:
8
,
'M'
:
8
,
'E'
:
8
,
'sampleType'
:
'Arnoldi'
,
'POD'
:
True
}
# params = {'N':7, 'M':8, 'E':8, 'sampleType':'Krylov', 'POD':True}
mu0
=
7
**
.
5
mutar
=
(
7.
+
.
1j
)
**
.
5
solver
=
HSBDPE
(
kappa
=
12
**
.
5
,
theta
=
np
.
pi
/
3
,
n
=
40
,
mu0
=
mu0
,
degree_threshold
=
15
,
verbosity
=
verb
)
approxP
=
Pade
(
solver
,
mu0
=
mu0
,
approxParameters
=
params
,
verbosity
=
verb
)
paramsRB
=
subdict
(
params
,
[
'E'
,
'sampleType'
,
'POD'
])
approxR
=
RB
(
solver
,
mu0
=
mu0
,
approxParameters
=
paramsRB
,
verbosity
=
verb
)
approxP
.
setupApprox
()
approxR
.
setupApprox
()
# approxP.plotSamples()
approxP
.
plotHF
(
mutar
,
name
=
'u_HF'
)
approxP
.
plotApprox
(
mutar
,
name
=
'u_Pade'''
)
approxR
.
plotApprox
(
mutar
,
name
=
'u_RB'
)
approxP
.
plotErr
(
mutar
,
name
=
'err_Pade'''
)
approxR
.
plotErr
(
mutar
,
name
=
'err_RB'
)
solNorm
=
approxP
.
normHF
(
mutar
)
appPErr
=
approxP
.
normErr
(
mutar
)
appRErr
=
approxR
.
normErr
(
mutar
)
print
((
'SolNorm:
\t
{}
\n
ErrRelP:
\t
{}
\n
ErrRelR:
\t
{}'
)
.
format
(
solNorm
,
appPErr
/
solNorm
,
appRErr
/
solNorm
))
print
(
'
\n
Poles Pade'':'
)
print
(
approxP
.
getPoles
())
Event Timeline
Log In to Comment