コード例 #1
0
ファイル: stokes_rb_reduction.py プロジェクト: mfkiwl/RBniCS
# Copyright (C) 2015-2021 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later

from rbnics.backends import GramSchmidt
from rbnics.utils.decorators import ReductionMethodFor
from rbnics.problems.stokes.stokes_problem import StokesProblem
from rbnics.reduction_methods.base import DifferentialProblemReductionMethod, LinearRBReduction
from rbnics.reduction_methods.stokes.stokes_reduction_method import StokesReductionMethod

StokesRBReduction_Base = LinearRBReduction(StokesReductionMethod(DifferentialProblemReductionMethod))


@ReductionMethodFor(StokesProblem, "ReducedBasis")
class StokesRBReduction(StokesRBReduction_Base):

    # Initialize data structures required for the offline phase: overridden version because supremizer GS
    # is different from a standard component
    def _init_offline(self):
        # We cannot use the standard initialization provided by RBReduction because
        # supremizer GS requires a custom initialization. We thus duplicate here part of its code

        # Call parent of parent (!) to initialize inner product and reduced problem
        output = StokesRBReduction_Base._init_offline(self)

        # Declare a new GS for each basis component
        self.GS = dict()
        for component in ("u", "p"):
            inner_product = self.truth_problem.inner_product[component][0]
コード例 #2
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.backends import GramSchmidt
from rbnics.utils.decorators import ReductionMethodFor
from rbnics.problems.stokes.stokes_problem import StokesProblem
from rbnics.reduction_methods.base import DifferentialProblemReductionMethod, LinearRBReduction
from rbnics.reduction_methods.stokes.stokes_reduction_method import StokesReductionMethod

StokesRBReduction_Base = LinearRBReduction(
    StokesReductionMethod(DifferentialProblemReductionMethod))


@ReductionMethodFor(StokesProblem, "ReducedBasis")
class StokesRBReduction(StokesRBReduction_Base):

    # Initialize data structures required for the offline phase: overridden version because supremizer GS
    # is different from a standard component
    def _init_offline(self):
        # We cannot use the standard initialization provided by RBReduction because
        # supremizer GS requires a custom initialization. We thus duplicate here part of its code

        # Call parent of parent (!) to initialize inner product and reduced problem
        output = StokesRBReduction_Base._init_offline(self)

        # Declare a new GS for each basis component
        self.GS = dict()
        for component in ("u", "p"):