Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F64615268
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
Tue, May 28, 04:34
Size
1 KB
Mime Type
text/x-python
Expires
Thu, May 30, 04:34 (2 d)
Engine
blob
Format
Raw Data
Handle
17933164
Attached To
R6746 RationalROMPy
laplaceGaussianCentered.py
View Options
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
RB
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
)[
0
]
solver
.
plotmesh
()
print
(
solver
.
norm
(
uh
))
solver
.
plot
(
uh
)
############
if
testNo
==
2
:
params
=
{
'N'
:
8
,
'M'
:
8
,
'S'
:
9
,
'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
,
[
'S'
,
'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