예제 #1
0
def test_Linfty():
    domain = setupStepGauss()
    mesh = InterpolatedBathymetryMesh(domain,
                                      triangleOptions="gVApq30Dena%8.8f" %
                                      (0.5**3, ),
                                      atol=1.0e-3,
                                      rtol=1.0e-3,
                                      maxLevels=25,
                                      maxNodes=50000,
                                      bathyType="points",
                                      bathyAssignmentScheme="localAveraging",
                                      errorNormType="Linfty")
    archive = XdmfArchive(dataDir='.',
                          filename="interpolatedBathySimpleTest_Linfty_")
    archive.domain = ElementTree.SubElement(archive.tree.getroot(), "Domain")
    mesh.meshList[-1].writeMeshXdmf(ar=archive, init=True)
    archive.close()
예제 #2
0
def test_L2_interp_grid():
    domain = setupStepGauss()
    mesh = InterpolatedBathymetryMesh(domain,
                                      triangleOptions="gVApq30Dena%8.8f" %
                                      (0.5**3, ),
                                      atol=1.0e-1,
                                      rtol=1.0e-1,
                                      maxLevels=25,
                                      maxNodes=50000,
                                      bathyType="grid",
                                      bathyAssignmentScheme="interpolation",
                                      errorNormType="L2")
    archive = XdmfArchive(
        dataDir='.',
        filename="interpolatedBathySimpleTest_grid_L2_interp_",
        global_sync=False)
    archive.domain = ElementTree.SubElement(archive.tree.getroot(), "Domain")
    mesh.meshList[-1].writeMeshXdmf(ar=archive, init=True)
    archive.sync()
    archive.close()
예제 #3
0
 def test_L1(self):
     domain = self.setupStepGauss()
     mesh = InterpolatedBathymetryMesh(
         domain,
         triangleOptions="gVApq30Dena%8.8f" % (0.5**3, ),
         atol=1.0e-1,
         rtol=1.0e-1,
         maxLevels=25,
         maxNodes=50000,
         bathyType="points",
         bathyAssignmentScheme="localAveraging",
         errorNormType="L1")
     outfile = "interpolatedBathySimpleTest_L1_"
     archive = XdmfArchive(dataDir='.', filename=outfile, global_sync=False)
     archive.domain = ElementTree.SubElement(archive.tree.getroot(),
                                             "Domain")
     mesh.meshList[-1].writeMeshXdmf(ar=archive, init=True)
     archive.sync()
     archive.close()
     self.aux_names.append(outfile)
예제 #4
0
                boundaryTags['left'], boundaryTags['back'],
                boundaryTags['right'], boundaryTags['front']
            ],
            regions=[(0.5 * (xmax + xmin), 0.5 * (ymax + ymin))],
            regionFlags=[1],
            name="frfDomain2D",
            units='m',
            bathy=bathy_points)
        domain2D.writePoly(domain2D.name)

        #now adaptively refine 2D mesh to interpolate bathy to desired accuracy
        mesh2D = InterpolatedBathymetryMesh(
            domain2D,
            triangleOptions="gVApq30Dena%8.8f" % ((1000.0**2) / 2.0, ),
            atol=1.0e-1,
            rtol=1.0e-1,
            maxLevels=25,
            maxNodes=50000,
            bathyType="points",
            bathyAssignmentScheme="interpolation",
            errorNormType="Linfty")
        #
        # Done processing 2D
        #
        fineMesh = mesh2D.meshList[-1]
        newNodes = {}
        verticalEdges = {}
        nN_start = fineMesh.nodeArray.shape[0]
        nN = nN_start
        zTop = max(fineMesh.nodeArray[:, 2].max(),
                   fineMesh.nodeArray[:, 2].min() + depth + 2 * waveheight)
        for nN_bottom, n, f in zip(range(nN_start), fineMesh.nodeArray,