Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F60248139
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
Sun, Apr 28, 15:12
Size
1 KB
Mime Type
text/x-python
Expires
Tue, Apr 30, 15:12 (2 d)
Engine
blob
Format
Raw Data
Handle
17308576
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
,
'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'
,
'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