ngsPETSc.utils.firedrake.meshes
This module contains all the functions related to wrapping NGSolve meshes to Firedrake We adopt the same docstring conventions as the Firedrake project, since this part of the package will only be used in combination with Firedrake.
Attributes
Classes
dummy class |
|
This class creates a Firedrake mesh from Netgen/NGSolve meshes. |
Functions
|
utility fuction used to parse Netgen flag options |
|
This method is used to refine a mesh based on a marking function |
|
Find all permutations between a list of two sets of points. |
|
This method returns a curved mesh as a Firedrake function. |
|
This method splits a Netgen mesh to quads, using a PETSc transform. |
Module Contents
- ngsPETSc.utils.firedrake.meshes.fd = None
- ngsPETSc.utils.firedrake.meshes.flagsUtils(flags, option, default)
utility fuction used to parse Netgen flag options
- ngsPETSc.utils.firedrake.meshes.refineMarkedElements(self, mark, netgen_flags={})
This method is used to refine a mesh based on a marking function which is a Firedrake DG0 function.
- Parameters:
mark – the marking function which is a Firedrake DG0 function.
netgen_flags – the dictionary of flags to be passed to ngsPETSc.
- It includes the option:
refine_faces, which is a boolean specifyiong if you want to refine faces.
- ngsPETSc.utils.firedrake.meshes.find_permutation(points_a, points_b, tol=1e-05)
Find all permutations between a list of two sets of points.
Given two numpy arrays of shape (ncells, npoints, dim) containing floating point coordinates for each cell, determine each index permutation that takes points_a to points_b. Ie:
` permutation = find_permutation(points_a, points_b) assert np.allclose(points_a[permutation], points_b, rtol=0, atol=tol) `
- ngsPETSc.utils.firedrake.meshes.curveField(self, order, permutation_tol=1e-08, location_tol=0.1, cg_field=False)
This method returns a curved mesh as a Firedrake function.
- Parameters:
order – the order of the curved mesh.
permutation_tol – tolerance used to construct the permutation of the reference element.
location_tol – tolerance used to locate the cell a point belongs to.
cg_field – return a CG function field representing the mesh, rather than the default DG field.
- ngsPETSc.utils.firedrake.meshes.splitToQuads(plex, dim, comm)
This method splits a Netgen mesh to quads, using a PETSc transform. TODO: Improve support quad meshing.
- @pef Get netgen to make a quad-dominant mesh, and then only split the triangles.
Current implementation will make for poor-quality meshes.
- ngsPETSc.utils.firedrake.meshes.splitTypes
- class ngsPETSc.utils.firedrake.meshes.FiredrakeMesh(mesh, netgen_flags, user_comm=fd.COMM_WORLD)
This class creates a Firedrake mesh from Netgen/NGSolve meshes.
- Parameters:
mesh – the mesh object, it can be either a Netgen/NGSolve mesh or a PETSc DMPlex
netgen_flags – The dictionary of flags to be passed to ngsPETSc.
comm – the MPI communicator.
- comm
- createFromTopology(topology, name, comm)
Internal method to construct a mesh from a mesh topology, copied from Firedrake.
- Parameters:
topology – the mesh topology
name – the mesh name