Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61031346
generic_pole_matching_approximant.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
Sat, May 4, 02:37
Size
8 KB
Mime Type
text/x-python
Expires
Mon, May 6, 02:37 (2 d)
Engine
blob
Format
Raw Data
Handle
17455358
Attached To
R6746 RationalROMPy
generic_pole_matching_approximant.py
View Options
# Copyright (C) 2018 by the RROMPy authors
#
# This file is part of RROMPy.
#
# RROMPy is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# RROMPy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with RROMPy. If not, see <http://www.gnu.org/licenses/>.
#
from
numpy
import
inf
from
rrompy.reduction_methods.pivoted.generic_pivoted_approximant
import
(
GenericPivotedApproximant
)
from
rrompy.utilities.base.types
import
ListAny
,
DictAny
,
HFEng
,
paramVal
from
rrompy.utilities.exception_manager
import
RROMPyException
,
RROMPyWarning
__all__
=
[
'GenericPoleMatchingApproximant'
]
class
GenericPoleMatchingApproximant
(
GenericPivotedApproximant
):
"""
ROM pole matching approximant computation for parametric problems
(ABSTRACT).
Args:
HFEngine: HF problem solver.
mu0(optional): Default parameter. Defaults to 0.
directionPivot(optional): Pivot components. Defaults to [0].
approxParameters(optional): Dictionary containing values for main
parameters of approximant. Recognized keys are:
- 'POD': whether to compute POD of snapshots; defaults to True;
- 'matchingWeight': weight for pole matching optimization; defaults
to 1;
- 'cutOffTolerance': tolerance for ignoring parasitic poles;
defaults to np.inf;
- 'cutOffType': rule for tolerance computation for parasitic poles;
defaults to 'MAGNITUDE';
- 'S': total number of pivot samples current approximant relies
upon;
- 'samplerPivot': pivot sample point generator;
- 'SMarginal': total number of marginal samples current approximant
relies upon;
- 'samplerMarginal': marginal sample point generator;
- 'polybasisMarginal': type of polynomial basis for marginal
interpolation; allowed values include 'MONOMIAL', 'CHEBYSHEV'
and 'LEGENDRE'; defaults to 'MONOMIAL';
- 'MMarginal': degree of marginal interpolant; defaults to 0;
- 'radialBasisMarginal': radial basis family for marginal
interpolant; defaults to 0, i.e. no radial basis;
- 'radialBasisWeightsMarginal': radial basis weights for marginal
interpolant; defaults to 0, i.e. identity;
- 'interpRcondMarginal': tolerance for marginal interpolation;
defaults to None.
Defaults to empty dict.
homogeneized(optional): Whether to homogeneize Dirichlet BCs. Defaults
to False.
verbosity(optional): Verbosity level. Defaults to 10.
Attributes:
HFEngine: HF problem solver.
mu0: Default parameter.
directionPivot: Pivot components.
mus: Array of snapshot parameters.
musPivot: Array of pivot snapshot parameters.
musMarginal: Array of marginal snapshot parameters.
homogeneized: Whether to homogeneize Dirichlet BCs.
approxParameters: Dictionary containing values for main parameters of
approximant. Recognized keys are in parameterList.
parameterListSoft: Recognized keys of soft approximant parameters:
- 'POD': whether to compute POD of snapshots;
- 'matchingWeight': weight for pole matching optimization;
- 'cutOffTolerance': tolerance for ignoring parasitic poles;
- 'cutOffType': rule for tolerance computation for parasitic poles;
- 'polybasisMarginal': type of polynomial basis for marginal
interpolation;
- 'MMarginal': degree of marginal interpolant;
- 'radialBasisMarginal': radial basis family for marginal
interpolant;
- 'radialBasisWeightsMarginal': radial basis weights for marginal
interpolant;
- 'interpRcondMarginal': tolerance for marginal interpolation.
parameterListCritical: Recognized keys of critical approximant
parameters:
- 'S': total number of pivot samples current approximant relies
upon;
- 'samplerPivot': pivot sample point generator;
- 'SMarginal': total number of marginal samples current approximant
relies upon;
- 'samplerMarginal': marginal sample point generator.
POD: Whether to compute POD of snapshots.
matchingWeight: Weight for pole matching optimization.
cutOffTolerance: Tolerance for ignoring parasitic poles.
cutOffType: Rule for tolerance computation for parasitic poles.
S: Total number of pivot samples current approximant relies upon.
samplerPivot: Pivot sample point generator.
SMarginal: Total number of marginal samples current approximant relies
upon.
samplerMarginal: Marginal sample point generator.
polybasisMarginal: Type of polynomial basis for marginal interpolation.
MMarginal: Degree of marginal interpolant.
radialBasisMarginal: Radial basis family for marginal interpolant.
radialBasisWeightsMarginal: Radial basis weights for marginal
interpolant.
interpRcondMarginal: Tolerance for marginal interpolation.
muBoundsPivot: list of bounds for pivot parameter values.
muBoundsMarginal: list of bounds for marginal parameter values.
samplingEngine: Sampling engine.
uHF: High fidelity solution(s) with parameter(s) lastSolvedHF as
sampleList.
lastSolvedHF: Parameter(s) corresponding to last computed high fidelity
solution(s) as parameterList.
uApproxReduced: Reduced approximate solution(s) with parameter(s)
lastSolvedApprox as sampleList.
lastSolvedApproxReduced: Parameter(s) corresponding to last computed
reduced approximate solution(s) as parameterList.
uApprox: Approximate solution(s) with parameter(s) lastSolvedApprox as
sampleList.
lastSolvedApprox: Parameter(s) corresponding to last computed
approximate solution(s) as parameterList.
"""
def
__init__
(
self
,
HFEngine
:
HFEng
,
mu0
:
paramVal
=
None
,
directionPivot
:
ListAny
=
[
0
],
approxParameters
:
DictAny
=
{},
homogeneized
:
bool
=
False
,
verbosity
:
int
=
10
,
timestamp
:
bool
=
True
):
self
.
_preInit
()
if
len
(
directionPivot
)
>
1
:
raise
RROMPyException
((
"Exactly 1 pivot parameter allowed in pole "
"matching."
))
self
.
_addParametersToList
([
"matchingWeight"
,
"cutOffTolerance"
,
"cutOffType"
],
[
1
,
inf
,
"MAGNITUDE"
])
super
()
.
__init__
(
HFEngine
=
HFEngine
,
mu0
=
mu0
,
directionPivot
=
directionPivot
,
approxParameters
=
approxParameters
,
homogeneized
=
homogeneized
,
verbosity
=
verbosity
,
timestamp
=
timestamp
)
self
.
_postInit
()
@property
def
matchingWeight
(
self
):
"""Value of matchingWeight."""
return
self
.
_matchingWeight
@matchingWeight.setter
def
matchingWeight
(
self
,
matchingWeight
):
self
.
_matchingWeight
=
matchingWeight
self
.
_approxParameters
[
"matchingWeight"
]
=
self
.
matchingWeight
@property
def
cutOffTolerance
(
self
):
"""Value of cutOffTolerance."""
return
self
.
_cutOffTolerance
@cutOffTolerance.setter
def
cutOffTolerance
(
self
,
cutOffTolerance
):
self
.
_cutOffTolerance
=
cutOffTolerance
self
.
_approxParameters
[
"cutOffTolerance"
]
=
self
.
cutOffTolerance
@property
def
cutOffType
(
self
):
"""Value of cutOffType."""
return
self
.
_cutOffType
@cutOffType.setter
def
cutOffType
(
self
,
cutOffType
):
try
:
cutOffType
=
cutOffType
.
upper
()
.
strip
()
.
replace
(
" "
,
""
)
if
cutOffType
not
in
[
"MAGNITUDE"
,
"POTENTIAL"
]:
raise
RROMPyException
(
"Prescribed cutOffType not recognized."
)
self
.
_cutOffType
=
cutOffType
except
:
RROMPyWarning
((
"Prescribed cutOffType not recognized. Overriding "
"to 'MAGNITUDE'."
))
self
.
_cutOffType
=
"MAGNITUDE"
self
.
_approxParameters
[
"cutOffType"
]
=
self
.
cutOffType
Event Timeline
Log In to Comment