Esempio n. 1
0
    def __init__(self,
                 swarm=None,
                 materialIndexField=None,
                 air=None,
                 sediment=None,
                 threshold=None):

        self.materialIndexField = materialIndexField
        self.swarm = swarm
        self.threshold = nd(threshold)

        materialMap = {}
        for material in air:
            materialMap[material.index] = 1.0

        isAirMaterial = fn.branching.map(fn_key=materialIndexField,
                                         mapping=materialMap,
                                         fn_default=0.0)

        belowthreshold = [
            (((isAirMaterial > 0.5) & (fn.input()[1] < nd(threshold))),
             sediment[0].index), (True, materialIndexField)
        ]

        self._fn = fn.branching.conditional(belowthreshold)
Esempio n. 2
0
    def _init_Badlands(self):
        self.mesh = self._Model.mesh
        self.velocityField = self._Model.velocityField
        self.swarm = self._Model.swarm
        self.materialField = self._Model.materialField

        self._BadlandsModel = SPM(self.mesh, self.velocityField, self.swarm,
                                  self.materialField, self.airIndex,
                                  self.sedimentIndex, self.XML,
                                  nd(self.resolution),
                                  nd(self.checkpoint_interval),
                                  nd(self.surfElevation), self.verbose)
        return
Esempio n. 3
0
    def __init__(self, Model, elementRes, minCoord, maxCoord, velocityField):

        self.minCoord = minCoord
        self.maxCoord = maxCoord
        self.elementRes = elementRes
        self.velocityField = velocityField
        
        minCoord = tuple([nd(val) for val in self.minCoord])
        maxCoord = tuple([nd(val) for val in self.maxCoord])
        
        self.mesh = uw.mesh.FeMesh_Cartesian(elementType="Q1/dQ0",
                                             elementRes=self.elementRes,
                                             minCoord=minCoord,
                                             maxCoord=maxCoord)

        boundaryNodes = (Model._left_wall + Model._right_wall +
                         Model._top_wall + Model._bottom_wall)
       
        self.Model = Model
        # Build a KDTree to handle boundaries
        self.boundaries = boundaryNodes.data
        x = Model.mesh.data[self.boundaries,0]
        y = Model.mesh.data[self.boundaries,1]
        self.tree = spatial.KDTree(zip(x.ravel(), y.ravel()))
Esempio n. 4
0
 def temperature(self, pressure, units=None):
     return nd(self.A1) + nd(self.A2) * pressure + nd(
         self.A3) * pressure**2 + nd(self.A4) * pressure**3
Esempio n. 5
0
swarmDict = OrderedDict()  # important to avoid racing conditions
swarmDict["tcoords"] = svar
svar.data[:] = 0
svar.data[fn.coord()[0].evaluate(swarm) > 0.5] = 1
outputDirName = "t3d_960_llr"

outputDir = os.path.join(os.path.abspath("."), outputDirName + "/")
if restartFlag is False:
    checkpoint(mesh, fieldDict, swarm, swarmDict, index=0, prefix=outputDir)

if restartFlag is True:
    checkpoint(mesh,
               fieldDict,
               swarm,
               swarmDict,
               index=0,
               prefix=outputDir,
               load=True)

nd(9.8 * u.metre / u.second**2 * 80 * u.kilogram / u.meter**3)
dm(1.0, u.pascal * u.second)

figM = viz.Figure(rulers=True, figsize=(450, 500))
figM.Mesh(mesh)
figM.Points(swarm, svar, pointSize=10)
figM.show()

svarIsOne = np.where(svar.data[:] == 1)[0]
swarm.data[svarIsOne]