How to use the proteus.Comm.globalMax 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
def choose_dt(self):
        maxCFL = 1.0e-6
        maxCFL = max(maxCFL, globalMax(self.cfl.max()))
        self.dt = old_div(self.runCFL, maxCFL)
        if self.dtLast is None:
            self.dtLast = self.dt
        self.t = self.tLast + self.dt
        self.substeps = [self.t for i in range(self.nStages)]  # Manuel is ignoring different time step levels for now
github erdc / proteus / proteus / mprans / NCLS3P.py View on Github external
def updateShockCapturingHistory(self):
        self.nSteps += 1
        if self.lag:
            for ci in range(self.nc):
                self.numDiff_last[ci][:] = self.numDiff[ci]
        if self.lag == False and self.nStepsToDelay is not None and self.nSteps > self.nStepsToDelay:
            log("NCLS3P.ShockCapturing: switched to lagged shock capturing")
            self.lag = True
            self.numDiff_last = []
            for ci in range(self.nc):
                self.numDiff_last.append(self.numDiff[ci].copy())
        log("NCLS3P: max numDiff %e" %
            (globalMax(self.numDiff_last[0].max()),))
github erdc / proteus / proteus / mprans / SW2D.py View on Github external
self.ebqe[('advectiveFlux_bc', 2)],
            self.numericalFlux.ebqe[('u', 1)],
            self.ebqe[('diffusiveFlux_bc', 1, 1)],
            self.ebqe[('penalty')],
            self.numericalFlux.ebqe[('u', 2)],
            self.ebqe[('diffusiveFlux_bc', 2, 2)],
            self.q[('velocity', 0)],
            self.ebqe[('velocity', 0)],
            self.ebq_global[('totalFlux', 0)],
            self.elementResidual[0])
        if self.forceStrongConditions:
            for cj in range(len(self.dirichletConditionsForceDOF)):
                for dofN, g in list(self.dirichletConditionsForceDOF[cj].DOFBoundaryConditionsDict.items()):
                    r[self.offset[cj] + self.stride[cj] * dofN] = 0

        cflMax = globalMax(self.q[('cfl', 0)].max()) * self.timeIntegration.dt
        logEvent("Maximum CFL = " + str(cflMax), level=2)

        if self.stabilization:
            self.stabilization.accumulateSubgridMassHistory(self.q)
        logEvent("Global residual", level=9, data=r)
        # mwf decide if this is reasonable for keeping solver statistics
        self.nonlinear_function_evaluations += 1
github erdc / proteus / proteus / mprans / Kappa.py View on Github external
def updateShockCapturingHistory(self):
        self.nSteps += 1
        if self.lag:
            for ci in range(self.nc):
                self.numDiff_last[ci][:] = self.numDiff[ci]
        if self.lag == False and self.nStepsToDelay is not None and self.nSteps > self.nStepsToDelay:
            prof.logEvent("Kappa.ShockCapturing: switched to lagged shock capturing")
            self.lag = True
            self.numDiff_last = []
            for ci in range(self.nc):
                self.numDiff_last.append(self.numDiff[ci].copy())
        prof.logEvent("Kappa: max numDiff %e" % (proteus.Comm.globalMax(self.numDiff_last[0].max()),))
github erdc / proteus / proteus / mprans / CLSVOF.py View on Github external
# END OF FREEZING INTERFACE #
        else: # RELATED CLSVOF MODEL #
            # Quantities to compute normalization factor
            from proteus.Comm import globalSum, globalMax
            self.min_distance = -globalMax(-min_distance[0])
            self.max_distance = globalMax(max_distance[0])
            self.mean_distance = globalSum(mean_distance[0])
            self.volume_domain = globalSum(volume_domain[0])
            self.mean_distance /= self.volume_domain

            if self.forceStrongConditions:#
                for dofN,g in self.dirichletConditionsForceDOF.DOFBoundaryConditionsDict.iteritems():
                    r[dofN] = 0

            if self.displayCFL:
                cell_based_cflMax=globalMax(self.q[('cfl',0)].max())*self.timeIntegration.dt
                logEvent("...   Maximum Cell Based CFL = " + str(cell_based_cflMax),level=2)

            if self.stabilization:
                self.stabilization.accumulateSubgridMassHistory(self.q)
            logEvent("Global residual",level=9,data=r)

            self.nonlinear_function_evaluations += 1
            if self.globalResidualDummy is None:
                self.globalResidualDummy = numpy.zeros(r.shape,'d')
github erdc / proteus / proteus / mprans / RANS2P.py View on Github external
if self.lag:
            if self.nSteps > self.nStepsToDelay:
                #numDiff_last is a different object
                #update the values of numDiff_last based on numDiff, 
                for ci in range(1, 4):
                    self.numDiff_last[ci][:] = self.numDiff[ci]
            elif self.nSteps == self.nStepsToDelay:
                logEvent("RANS2P.ShockCapturing: switched to lagged shock capturing")
                #if lagging, then create a separate object identical to numDiff 
                for ci in range(1, 4):
                    self.numDiff_last[ci] = self.numDiff[ci].copy()
            else:
                pass
            self.nSteps += 1

            logEvent("RANS2P: max numDiff_1 %e numDiff_2 %e numDiff_3 %e" % (globalMax(self.numDiff_last[1].max()),
                                                                         globalMax(self.numDiff_last[2].max()),
                                                                         globalMax(self.numDiff_last[3].max())))
github erdc / proteus / proteus / mprans / VOF3P.py View on Github external
argsDict["STABILIZATION_TYPE"] = self.coefficients.STABILIZATION_TYPE
        argsDict["ENTROPY_TYPE"] = self.coefficients.ENTROPY_TYPE
        argsDict["uLow"] = self.uLow
        argsDict["dLow"] = self.dLow
        argsDict["dt_times_dH_minus_dL"] = self.dt_times_dC_minus_dL
        argsDict["min_u_bc"] = self.min_u_bc
        argsDict["max_u_bc"] = self.max_u_bc
        argsDict["quantDOFs"] = self.quantDOFs
        self.calculateResidual(argsDict)

        if self.forceStrongConditions:
            for dofN, g in list(self.dirichletConditionsForceDOF.DOFBoundaryConditionsDict.items()):
                r[dofN] = 0

        if (self.auxiliaryCallCalculateResidual == False):
            edge_based_cflMax = globalMax(self.edge_based_cfl.max()) * self.timeIntegration.dt
            cell_based_cflMax = globalMax(self.q[('cfl', 0)].max()) * self.timeIntegration.dt
            logEvent("...   Current dt = " + str(self.timeIntegration.dt), level=4)
            logEvent("...   Maximum Cell Based CFL = " + str(cell_based_cflMax), level=2)
            logEvent("...   Maximum Edge Based CFL = " + str(edge_based_cflMax), level=2)

        if self.stabilization:
            self.stabilization.accumulateSubgridMassHistory(self.q)
        logEvent("Global residual", level=9, data=r)
        self.nonlinear_function_evaluations += 1
        if self.globalResidualDummy is None:
            self.globalResidualDummy = np.zeros(r.shape, 'd')
github erdc / proteus / proteus / mprans / VOF.py View on Github external
def choose_dt(self):
        maxCFL = 1.0e-6
        maxCFL = max(maxCFL, globalMax(self.cfl.max()))
        self.dt = old_div(self.runCFL, maxCFL)
        if self.dtLast is None:
            self.dtLast = self.dt
        self.t = self.tLast + self.dt
        self.substeps = [self.t for i in range(self.nStages)]  # Manuel is ignoring different time step levels for now
github erdc / proteus / proteus / mprans / VOF.py View on Github external
# FLUX CORRECTED TRANSPORT
            self.uLow,
            self.dLow,
            self.dt_times_dC_minus_dL,
            self.min_u_bc,
            self.max_u_bc,
            # AUX QUANTITIES OF INTEREST
            self.quantDOFs)

        if self.forceStrongConditions:
            for dofN, g in list(self.dirichletConditionsForceDOF.DOFBoundaryConditionsDict.items()):
                r[dofN] = 0

        if (self.auxiliaryCallCalculateResidual == False):
            edge_based_cflMax = globalMax(self.edge_based_cfl.max()) * self.timeIntegration.dt
            cell_based_cflMax = globalMax(self.q[('cfl', 0)].max()) * self.timeIntegration.dt
            logEvent("...   Current dt = " + str(self.timeIntegration.dt), level=4)
            logEvent("...   Maximum Cell Based CFL = " + str(cell_based_cflMax), level=2)
            logEvent("...   Maximum Edge Based CFL = " + str(edge_based_cflMax), level=2)

        if self.stabilization:
            self.stabilization.accumulateSubgridMassHistory(self.q)
        logEvent("Global residual", level=9, data=r)
        self.nonlinear_function_evaluations += 1
        if self.globalResidualDummy is None:
            self.globalResidualDummy = np.zeros(r.shape, 'd')
github erdc / proteus / proteus / mprans / CLSVOF.py View on Github external
##############################
        self.vofDOFs = numpy.zeros(self.u[0].dof.shape,'d')
        self.par_vofDOFs = None
        self.lumped_mass_matrix = None
        # Aux quantity at DOFs
        self.quantDOFs = numpy.zeros(self.u[0].dof.shape,'d')

        #############################
        # L2 PROJECTION OF SOLUTION #
        #############################
        self.rhs_l2_proj = numpy.zeros(self.u[0].dof.shape,'d')
        self.projected_disc_ICs = numpy.zeros(self.u[0].dof.shape,'d')
        self.par_projected_disc_ICs = None

        from proteus.Comm import globalMax
        self.he_for_disc_ICs = 0.5*(-globalMax(-self.mesh.elementDiametersArray.min()) +
                                    globalMax(self.mesh.elementDiametersArray.max()))
        ###################################
        # PROJECTED NORMAL RECONSTRUCTION #
        ###################################
        self.consistentNormalReconstruction=False # for now it will always be False
        self.degree_polynomial=1
        try:
            self.degree_polynomial = self.u[0].femSpace.order
        except:
            pass
        #if self.degree_polynomial>1:
        #    self.consistentNormalReconstruction=True
        # For (lambda) normalization factor
        self.min_distance = 0.
        self.max_distance = 0.
        self.mean_distance = 0.