コード例 #1
0
# Copyright (C) 2015-2020 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

from rbnics.problems.stokes.stokes_reduced_problem import StokesReducedProblem
from rbnics.utils.decorators import ReducedProblemFor
from rbnics.problems.stokes.stokes_problem import StokesProblem
from rbnics.problems.base import LinearPODGalerkinReducedProblem, ParametrizedReducedDifferentialProblem
from rbnics.reduction_methods.stokes import StokesPODGalerkinReduction

StokesPODGalerkinReducedProblem_Base = LinearPODGalerkinReducedProblem(
    StokesReducedProblem(ParametrizedReducedDifferentialProblem))


@ReducedProblemFor(StokesProblem, StokesPODGalerkinReduction)
class StokesPODGalerkinReducedProblem(StokesPODGalerkinReducedProblem_Base):
    pass
コード例 #2
0
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with RBniCS. If not, see <http://www.gnu.org/licenses/>.
#

from math import sqrt
from numpy import isclose
from rbnics.problems.stokes.stokes_reduced_problem import StokesReducedProblem
from rbnics.backends import product, sum, transpose
from rbnics.utils.decorators import ReducedProblemFor
from rbnics.problems.stokes.stokes_problem import StokesProblem
from rbnics.problems.base import LinearRBReducedProblem, ParametrizedReducedDifferentialProblem
from rbnics.reduction_methods.stokes import StokesRBReduction

StokesRBReducedProblem_Base = LinearRBReducedProblem(StokesReducedProblem(ParametrizedReducedDifferentialProblem))

@ReducedProblemFor(StokesProblem, StokesRBReduction)
class StokesRBReducedProblem(StokesRBReducedProblem_Base):

    # Default initialization of members.
    def __init__(self, truth_problem, **kwargs):
        # Call to parent
        StokesRBReducedProblem_Base.__init__(self, truth_problem, **kwargs)
        
        # Skip useless Riesz products
        self.riesz_terms = ["a", "b", "bt", "f", "g"]
        self.error_estimation_terms = [("f", "f"), ("g", "g"), ("a", "f"), ("bt", "f"), ("b", "g"), ("a", "a"), ("a", "bt"), ("bt", "bt"), ("b", "b")]
    
    # Return an error bound for the current solution
    def estimate_error(self):