How to use the proteus.ShockCapturing.ShockCapturing_base function in proteus

To help you get started, we’ve selected a few proteus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github erdc / proteus / proteus / mprans / VOF3P.py View on Github external
from . import cArgumentsDict

class SubgridError(SGE_base):
    def __init__(self, coefficients, nd):
        proteus.SubgridError.SGE_base.__init__(self, coefficients, nd, lag=False)

    def initializeElementQuadrature(self, mesh, t, cq):
        pass

    def updateSubgridErrorHistory(self, initializationPhase=False):
        pass

    def calculateSubgridError(self, q):
        pass

class ShockCapturing(ShockCapturing_base):
    def __init__(self,
                 coefficients,
                 nd,
                 shockCapturingFactor=0.25,
                 lag=True,
                 nStepsToDelay=None):
        proteus.ShockCapturing.ShockCapturing_base.__init__(self,
                                                            coefficients,
                                                            nd,
                                                            shockCapturingFactor,
                                                            lag)
        self.nStepsToDelay = nStepsToDelay
        self.nSteps = 0
        if self.lag:
            logEvent("VOF3P.ShockCapturing: lagging requested but must lag the first step; switching lagging off and delaying")
            self.nStepsToDelay = 1
github erdc / proteus / proteus / mprans / NCLS.py View on Github external
import proteus
from proteus.mprans.cNCLS import *

class SubgridError(proteus.SubgridError.SGE_base):
    def __init__(self,coefficients,nd):
        proteus.SubgridError.SGE_base.__init__(self,coefficients,nd,False)
    def initializeElementQuadrature(self,mesh,t,cq):
        for ci in range(self.nc):
            cq[('dH_sge',ci,ci)]=cq[('dH',ci,ci)]
    def calculateSubgridError(self,q):
        pass
    def updateSubgridErrorHistory(self,initializationPhase=False):
        pass

class ShockCapturing(proteus.ShockCapturing.ShockCapturing_base):
    def __init__(self,coefficients,nd,shockCapturingFactor=0.25,lag=True,nStepsToDelay=None):
        proteus.ShockCapturing.ShockCapturing_base.__init__(self,coefficients,nd,shockCapturingFactor,lag)
        self.nStepsToDelay = nStepsToDelay
        self.nSteps=0
        if self.lag:
            log("NCLS.ShockCapturing: lagging requested but must lag the first step; switching lagging off and delaying")
            self.nStepsToDelay=1
            self.lag=False
    def initializeElementQuadrature(self,mesh,t,cq):
        self.mesh=mesh
        self.numDiff=[]
        self.numDiff_last=[]
        for ci in range(self.nc):
            self.numDiff.append(cq[('numDiff',ci,ci)])
            self.numDiff_last.append(cq[('numDiff',ci,ci)])
    def updateShockCapturingHistory(self):
github erdc / proteus / proteus / ShockCapturing.py View on Github external
self.numDiff[ci])
class JaffreGradU_SC(ShockCapturing_base):
    def __init__(self,coefficients,nd,shockCapturingFlag='1',shockCapturingFactor=0.5,lag=True,betaPower=0.1):
        self.shockCapturingFlag=shockCapturingFlag=shockCapturingFlag
        self.beta=betaPower
        ShockCapturing_base.__init__(self,coefficients,nd,shockCapturingFactor,lag)
    def calculateNumericalDiffusion(self,q):
        for ci in range(self.nc):
            cshockCapturing.calculateNumericalDiffusionJaffre(self.shockCapturingFactor,
                                                              self.beta,
                                                              self.mesh.elementDiametersArray,
                                                              q[('pdeResidual',ci)],
                                                              q[('grad(u)',ci)],
                                                              self.numDiff[ci])

class ResGradJuanes_SC(ShockCapturing_base):
    def __init__(self,coefficients,nd,shockCapturingFactor=0.25,uSC=1.0,lag=True):
        ShockCapturing_base.__init__(self,coefficients,nd,shockCapturingFactor,lag)
        self.uSC = uSC
    def calculateNumericalDiffusion(self,q):
        for ci in range(self.nc):
            cshockCapturing.calculateNumericalDiffusionResGradJuanes(self.shockCapturingFactor,
                                                                     self.uSC,
                                                                     self.mesh.elementDiametersArray,
                                                                     q[('pdeResidual',ci)],
                                                                     q[('grad(u)',ci)],
                                                                     self.numDiff[ci])

#examples of shock capturing with lagging allowed after certain number of steps
class ResGradDelayLag_SC(ResGrad_SC):
    def __init__(self,coefficients,nd,shockCapturingFactor=0.25,lag=True,nStepsToDelay=None):
        ResGrad_SC.__init__(self,coefficients,nd,shockCapturingFactor,lag)
github erdc / proteus / proteus / mprans / Dissipation.py View on Github external
class SubgridError(proteus.SubgridError.SGE_base):
    def __init__(self, coefficients, nd):
        proteus.SubgridError.SGE_base.__init__(self, coefficients, nd, lag=False)

    def initializeElementQuadrature(self, mesh, t, cq):
        pass

    def updateSubgridErrorHistory(self, initializationPhase=False):
        pass

    def calculateSubgridError(self, q):
        pass


class ShockCapturing(proteus.ShockCapturing.ShockCapturing_base):
    def __init__(self, coefficients, nd, shockCapturingFactor=0.25, lag=True, nStepsToDelay=None):
        proteus.ShockCapturing.ShockCapturing_base.__init__(self, coefficients, nd, shockCapturingFactor, lag)
        self.nStepsToDelay = nStepsToDelay
        self.nSteps = 0
        if self.lag:
            prof.logEvent("Kappa.ShockCapturing: lagging requested but must lag the first step; switching lagging off and delaying")
            self.nStepsToDelay = 1
            self.lag = False

    def initializeElementQuadrature(self, mesh, t, cq):
        self.mesh = mesh
        self.numDiff = []
        self.numDiff_last = []
        for ci in range(self.nc):
            self.numDiff.append(cq[('numDiff', ci, ci)])
            self.numDiff_last.append(cq[('numDiff', ci, ci)])
github erdc / proteus / proteus / mprans / Kappa.py View on Github external
class SubgridError(proteus.SubgridError.SGE_base):
    def __init__(self, coefficients, nd):
        proteus.SubgridError.SGE_base.__init__(self, coefficients, nd, lag=False)

    def initializeElementQuadrature(self, mesh, t, cq):
        pass

    def updateSubgridErrorHistory(self, initializationPhase=False):
        pass

    def calculateSubgridError(self, q):
        pass


class ShockCapturing(proteus.ShockCapturing.ShockCapturing_base):
    def __init__(self, coefficients, nd, shockCapturingFactor=0.25, lag=True, nStepsToDelay=None):
        proteus.ShockCapturing.ShockCapturing_base.__init__(self, coefficients, nd, shockCapturingFactor, lag)
        self.nStepsToDelay = nStepsToDelay
        self.nSteps = 0
        if self.lag:
            prof.logEvent("Kappa.ShockCapturing: lagging requested but must lag the first step; switching lagging off and delaying")
            self.nStepsToDelay = 1
            self.lag = False

    def initializeElementQuadrature(self, mesh, t, cq):
        self.mesh = mesh
        self.numDiff = []
        self.numDiff_last = []
        for ci in range(self.nc):
            self.numDiff.append(cq[('numDiff', ci, ci)])
            self.numDiff_last.append(cq[('numDiff', ci, ci)])
github erdc / proteus / proteus / ShockCapturing.py View on Github external
cq[('grad(phi)_sge',ck)]=cq[('grad(phi)',ck)]
                for cj in cjDict.keys():
                    if not cq.has_key(('dphi_sge',ck,cj)):
                        cq[('dphi_sge',ck,cj)]=cq[('dphi',ck,cj)]
                    if not cq.has_key(('da_sge',ci,ck,cj)):
                        cq[('da_sge',ci,ck,cj)]=cq[('da',ci,ck,cj)]

    def calculateNumericalDiffusion(self,q):
        for ci in range(self.nc):
            self.numDiff[ci].flat[:] = self.shockCapturingFactor
    def updateShockCapturingHistory(self):
        if self.lag:
            for ci in range(self.nc):
                self.numDiff_last[ci][:] = self.numDiff[ci]

ConstantDiffusion_SC = ShockCapturing_base

class ResGrad_SC(ShockCapturing_base):
    def __init__(self,coefficients,nd,shockCapturingFactor=0.25,lag=True):
        ShockCapturing_base.__init__(self,coefficients,nd,shockCapturingFactor,lag)
    def calculateNumericalDiffusion(self,q):
        for ci in range(self.nc):
            cshockCapturing.calculateNumericalDiffusionResGrad(self.shockCapturingFactor,
                                                               self.mesh.elementDiametersArray,
                                                               q[('pdeResidual',ci)],
                                                               q[('grad(u)',ci)],
                                                               self.numDiff[ci])
class ResGradFFDarcy_SC(ShockCapturing_base):
    def __init__(self,coefficients,nd,shockCapturingFactor=0.25,lag=True):
        ShockCapturing_base.__init__(self,coefficients,nd,shockCapturingFactor,lag)
    def calculateNumericalDiffusion(self,q):
        cshockCapturing.calculateNumericalDiffusionResGrad(self.shockCapturingFactor,