Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61690458
laplaceGaussianCentered.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
Wed, May 8, 08:50
Size
1 KB
Mime Type
text/x-python
Expires
Fri, May 10, 08:50 (2 d)
Engine
blob
Format
Raw Data
Handle
17545374
Attached To
R6746 RationalROMPy
laplaceGaussianCentered.py
View Options
import
numpy
as
np
from
rrompy.hfengines.linear_problem
import
LaplaceDiskGaussian
as
LDG
from
rrompy.reduction_methods.centered
import
RationalPade
as
Pade
from
rrompy.reduction_methods.centered
import
RBCentered
as
RBC
from
operator
import
itemgetter
def
subdict
(
d
,
ks
):
return
dict
(
zip
(
ks
,
itemgetter
(
*
ks
)(
d
)))
testNo
=
2
verb
=
0
if
testNo
==
1
:
mu
=
4.
solver
=
LDG
(
n
=
40
,
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
=
0.
solver
=
LDG
(
n
=
20
,
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()
mutar
=
3.25
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
))
Event Timeline
Log In to Comment