Documentation ¶
Index ¶
- Constants
- func CalculateElementLocalGeometry(EToV utils.Matrix, VX, VY, R, S utils.Vector) (X, Y utils.Matrix)
- func Connect2D(K, NFaces, Nv int, EToV utils.Matrix) (EToE, EToF utils.Matrix)
- func ExtendGeomToRT(N int, rInt, sInt utils.Vector) (r, s utils.Vector)
- func GetEdgeCoordinates(en types.EdgeKey, rev bool, VX, VY utils.Vector) (x1, x2 [2]float64)
- func Nodes2D(N int) (x, y utils.Vector)
- func NodesEpsilon(N int) (R, S utils.Vector)
- func RStoAB(R, S utils.Vector) (a, b utils.Vector)
- func Warpfactor(N int, rout utils.Vector) (warpF []float64)
- func XYtoRS(x, y utils.Vector) (r, s utils.Vector)
- type Basis2D
- type Cubature
- type DFR2D
- func (dfr *DFR2D) CalculateFaceNorms()
- func (dfr *DFR2D) CalculateJacobian()
- func (dfr *DFR2D) CalculateRTBasedDerivativeMetrics()
- func (dfr *DFR2D) ConvertScalarToOutputMesh(f utils.Matrix) (fI []float32)
- func (dfr *DFR2D) GetJacobian(k int) (J, Jinv []float64, Jdet float64)
- func (dfr *DFR2D) OutputMesh() (gm *graphics2D.TriMesh)
- func (dfr *DFR2D) ProjectFluxOntoRTSpace(Fx, Fy utils.Matrix) (Fp utils.Matrix)
- type DerivativeDirection
- type Direction
- type Edge
- type InternalEdgeDirection
- type InternalEdgeNumber
- type JacobiBasis2D
- func (jb2d *JacobiBasis2D) GetInterpMatrix(R, S utils.Vector) (Interp utils.Matrix)
- func (jb2d *JacobiBasis2D) GradSimplex2DP(R, S utils.Vector, id, jd int) (ddr, dds []float64)
- func (jb2d *JacobiBasis2D) GradVandermonde2D(N int, R, S utils.Vector) (V2Dr, V2Ds utils.Matrix)
- func (jb2d *JacobiBasis2D) PolynomialTerm(r, s float64, i, j int) (P float64)
- func (jb2d *JacobiBasis2D) PolynomialTermDr(r, s float64, i, j int) (dr float64)
- func (jb2d *JacobiBasis2D) PolynomialTermDs(r, s float64, i, j int) (ds float64)
- func (jb2d *JacobiBasis2D) Simplex2DP(R, S utils.Vector, i, j int) (P []float64)
- func (jb2d *JacobiBasis2D) Vandermonde2D(N int, R, S utils.Vector) (V2D utils.Matrix)
- type LagrangeBasis1D
- type LagrangeBasis2D
- func (lb2d *LagrangeBasis2D) BasisPolynomial(R, S utils.Vector, i, j int) (P []float64)
- func (lb2d *LagrangeBasis2D) GetGradInterpMatrices(R, S utils.Vector) (InterpDR, InterpDS utils.Matrix)
- func (lb2d *LagrangeBasis2D) GetInterpMatrix(R, S utils.Vector) (Interp utils.Matrix)
- func (lb2d *LagrangeBasis2D) GradBasisPolynomial(R, S utils.Vector, i, j int) (DrTerms, DsTerms []float64)
- func (lb2d *LagrangeBasis2D) PolynomialTerm(r, s float64, i, j int) (p float64)
- func (lb2d *LagrangeBasis2D) PolynomialTermDr(r, s float64, i, j int) (dr float64)
- func (lb2d *LagrangeBasis2D) PolynomialTermDs(r, s float64, i, j int) (ds float64)
- type LagrangeElement2D
- type MeshFileType
- type NDG2D
- type NodeType
- type RTBasis2DSimplex
- func (rtb *RTBasis2DSimplex) CalculateBasis()
- func (rtb *RTBasis2DSimplex) EvaluateBasisAtLocation(r, s float64, derivO ...DerivativeDirection) (p0, p1 []float64)
- func (rtb *RTBasis2DSimplex) ExtendGeomToRT(Rint, Sint utils.Vector) (R, S utils.Vector)
- func (rtb *RTBasis2DSimplex) GetEdgeLocations(F []float64) (Fedge []float64)
- func (rtb *RTBasis2DSimplex) GetInternalLocations(F []float64) (Finternal []float64)
- func (rtb *RTBasis2DSimplex) Lagrange1DPoly(r float64, R []float64, j int, dir Direction, derivO ...DerivativeDirection) (p float64)
- func (rtb *RTBasis2DSimplex) LinearPoly(r, s float64, j int, derivO ...DerivativeDirection) (p float64)
- type RTElement
- func (rt *RTElement) CalculateBasis()
- func (rt *RTElement) EvaluateRTBasis(b1 Basis2D, r, s float64, derivO ...DerivativeDirection) (p0, p1 []float64)
- func (rt *RTElement) GetEdgeLocations(F []float64) (Fedge []float64)
- func (rt *RTElement) GetInternalLocations(F []float64) (Finternal []float64)
- func (rt *RTElement) ProjectFunctionOntoBasis(s1, s2 []float64) (sp []float64)
- type RTPointType
- type TermType
- type Triangulation
Constants ¶
View Source
const ( Epsilon = "Epsilon" Hesthaven = "Hesthaven" )
Variables ¶
This section is empty.
Functions ¶
func GetEdgeCoordinates ¶
func NodesEpsilon ¶
Types ¶
type DFR2D ¶
type DFR2D struct { N int SolutionElement *LagrangeElement2D //FluxElement *RTElement FluxElement *RTBasis2DSimplex FluxInterp utils.Matrix // Interpolates from the interior (solution) points to all of the flux points FluxEdgeInterp utils.Matrix // Interpolates only from interior to the edge points in the flux element FluxDr, FluxDs utils.Matrix // Derivatives from the interior (solution) points to all of the flux points DXMetric, DYMetric utils.Matrix // X and Y derivative metrics, multiply by scalar field values to create DOF for RT // Mesh Parameters K int // Number of elements (triangles) in mesh VX, VY utils.Vector // X,Y vertex points in mesh (vertices) BCEdges types.BCMAP FluxX, FluxY utils.Matrix // Flux Element local coordinates SolutionX, SolutionY utils.Matrix // Solution Element local coordinates Tris *Triangulation // Triangle mesh and edge/face structures J, Jinv, Jdet utils.Matrix // Mesh Transform Jacobian, Kx[4], each K element has a 2x2 matrix, det is |J| FaceNorm [2]utils.Matrix // Face normal (normalized), Kx3 IInII utils.Matrix // Mag face normal divided by unit triangle face norm mag, Kx3 dimension EdgeNumber []types.EdgeKey // Edge number for each edge, used to index into edge structures, Kx3 dimension SolutionBasis Basis2D }
func (*DFR2D) CalculateFaceNorms ¶
func (dfr *DFR2D) CalculateFaceNorms()
func (*DFR2D) CalculateJacobian ¶
func (dfr *DFR2D) CalculateJacobian()
func (*DFR2D) CalculateRTBasedDerivativeMetrics ¶
func (dfr *DFR2D) CalculateRTBasedDerivativeMetrics()
func (*DFR2D) ConvertScalarToOutputMesh ¶
func (*DFR2D) OutputMesh ¶
func (dfr *DFR2D) OutputMesh() (gm *graphics2D.TriMesh)
type DerivativeDirection ¶
type DerivativeDirection uint8
const ( None DerivativeDirection = iota Dr Ds )
type Edge ¶
type Edge struct { // Total Storage: 32 bytes (14 bytes, 64-bit aligned to 16, plus 2x8 bytes for ||n||) NumConnectedTris uint8 // Either 1 or 2 ConnectedTris [2]uint32 // Index numbers of triangles connected to this edge ConnectedTriDirection [2]InternalEdgeDirection // If false(default), the edge runs from smaller to larger within the connected tri ConnectedTriEdgeNumber [2]InternalEdgeNumber // For the connected triangles, what is the edge number (one of 0, 1 or 2) BCType types.BCFLAG // If not connected to two tris, this field will be used IInII [2]float64 // ||n|| scale factor to pre-multiply normal values prior to transforming into unit tri }
Note that we do not use a slice for any of the fields inside of an edge - why?
- each slice ([]type) has an overhead of pointer plus length and capacity ints, total of 24 bytes for an empty slice
- adding to a slice using append() is expensive -> by using fixed allocations with the max of 2 ([2]type), we use less memory (total of 14 bytes) and compute
func (*Edge) AddTri ¶
func (e *Edge) AddTri(en types.EdgeKey, k, conn int, intEdgeNumber InternalEdgeNumber, direction InternalEdgeDirection, VX, VY utils.Vector)
func (*Edge) GetEdgeLength ¶
func (*Edge) GetEdgeNormal ¶
type InternalEdgeDirection ¶
type InternalEdgeDirection bool
const ( SmallestToLargest InternalEdgeDirection = false // Edge runs smallest vertex index to largest within triangle Reversed InternalEdgeDirection = true )
type InternalEdgeNumber ¶
type InternalEdgeNumber uint8
const ( First InternalEdgeNumber = iota Second Third )
func (InternalEdgeNumber) Index ¶
func (ien InternalEdgeNumber) Index() int
func (InternalEdgeNumber) String ¶
func (ien InternalEdgeNumber) String() string
type JacobiBasis2D ¶
func NewJacobiBasis2D ¶
func NewJacobiBasis2D(P int, R, S utils.Vector) (jb2d *JacobiBasis2D)
func (*JacobiBasis2D) GetInterpMatrix ¶
func (jb2d *JacobiBasis2D) GetInterpMatrix(R, S utils.Vector) (Interp utils.Matrix)
func (*JacobiBasis2D) GradSimplex2DP ¶
func (jb2d *JacobiBasis2D) GradSimplex2DP(R, S utils.Vector, id, jd int) (ddr, dds []float64)
func (*JacobiBasis2D) GradVandermonde2D ¶
func (*JacobiBasis2D) PolynomialTerm ¶
func (jb2d *JacobiBasis2D) PolynomialTerm(r, s float64, i, j int) (P float64)
func (*JacobiBasis2D) PolynomialTermDr ¶
func (jb2d *JacobiBasis2D) PolynomialTermDr(r, s float64, i, j int) (dr float64)
func (*JacobiBasis2D) PolynomialTermDs ¶
func (jb2d *JacobiBasis2D) PolynomialTermDs(r, s float64, i, j int) (ds float64)
func (*JacobiBasis2D) Simplex2DP ¶
func (jb2d *JacobiBasis2D) Simplex2DP(R, S utils.Vector, i, j int) (P []float64)
func (*JacobiBasis2D) Vandermonde2D ¶
type LagrangeBasis1D ¶
type LagrangeBasis1D struct { P int // Order Np int // Dimension of basis = N+1 Weights []float64 // Barycentric weights, one per basis polynomial Nodes []float64 // Nodes at which basis is defined }
func NewLagrangeBasis1D ¶
func NewLagrangeBasis1D(R []float64) (lb *LagrangeBasis1D)
func (*LagrangeBasis1D) BasisPolynomial ¶
func (lb *LagrangeBasis1D) BasisPolynomial(R []float64, j int) (f []float64)
func (*LagrangeBasis1D) GetInterpolationMatrix ¶
func (lb *LagrangeBasis1D) GetInterpolationMatrix(R []float64) (im utils.Matrix)
func (*LagrangeBasis1D) Interpolate ¶
func (lb *LagrangeBasis1D) Interpolate(R []float64, F []float64) (f []float64)
type LagrangeBasis2D ¶
type LagrangeBasis2D struct {
P, Np int // Order
RNodes, SNodes []float64 // Nodes at which basis is defined
JB2D *JacobiBasis2D
}
func NewLagrangeBasis2D ¶
func NewLagrangeBasis2D(P int, R, S utils.Vector) (lb2d *LagrangeBasis2D)
func (*LagrangeBasis2D) BasisPolynomial ¶
func (lb2d *LagrangeBasis2D) BasisPolynomial(R, S utils.Vector, i, j int) (P []float64)
func (*LagrangeBasis2D) GetGradInterpMatrices ¶
func (lb2d *LagrangeBasis2D) GetGradInterpMatrices(R, S utils.Vector) (InterpDR, InterpDS utils.Matrix)
func (*LagrangeBasis2D) GetInterpMatrix ¶
func (lb2d *LagrangeBasis2D) GetInterpMatrix(R, S utils.Vector) (Interp utils.Matrix)
func (*LagrangeBasis2D) GradBasisPolynomial ¶
func (lb2d *LagrangeBasis2D) GradBasisPolynomial(R, S utils.Vector, i, j int) (DrTerms, DsTerms []float64)
func (*LagrangeBasis2D) PolynomialTerm ¶
func (lb2d *LagrangeBasis2D) PolynomialTerm(r, s float64, i, j int) (p float64)
func (*LagrangeBasis2D) PolynomialTermDr ¶
func (lb2d *LagrangeBasis2D) PolynomialTermDr(r, s float64, i, j int) (dr float64)
func (*LagrangeBasis2D) PolynomialTermDs ¶
func (lb2d *LagrangeBasis2D) PolynomialTermDs(r, s float64, i, j int) (ds float64)
type LagrangeElement2D ¶
type LagrangeElement2D struct {
N, Nfp, Np, NFaces int
R, S utils.Vector
Dr, Ds utils.Matrix
MassMatrix utils.Matrix
Cub *Cubature
JB2D *JacobiBasis2D
}
func NewLagrangeElement2D ¶
func NewLagrangeElement2D(N int, nodeType NodeType) (el *LagrangeElement2D)
func (*LagrangeElement2D) GetDerivativeMatrices ¶
func (el *LagrangeElement2D) GetDerivativeMatrices(R, S utils.Vector) (Dr, Ds utils.Matrix)
func (*LagrangeElement2D) NewCube2D ¶
func (el *LagrangeElement2D) NewCube2D(COrder int)
type NDG2D ¶
type NDG2D struct { Element *LagrangeElement2D K int NODETOL float64 VX, VY, VZ utils.Vector FMask, Fx, Fy utils.Matrix EToV, EToE, EToF utils.Matrix BCType utils.Matrix BCEdges types.BCMAP X, Y, FScale, LIFT utils.Matrix Rx, Ry, Sx, Sy utils.Matrix NX, NY utils.Matrix J utils.Matrix VmapM, VmapP, VmapB, VmapI, VmapO utils.Index MapB, MapI, MapO utils.Index FMaskI utils.Index // contains filtered or unexported fields }
func (*NDG2D) BuildMaps2D ¶
func (ndg *NDG2D) BuildMaps2D()
func (*NDG2D) GeometricFactors2D ¶
func (ndg *NDG2D) GeometricFactors2D()
type RTBasis2DSimplex ¶
type RTBasis2DSimplex struct { P int // Polynomial Order Np int // Number of terms and nodes in basis NpInt, NpEdge int // Number of nodes in interior and on each edge, Np = 2*NpInt + 3*NpEdge R, S utils.Vector // Node locations within [-1,1] reference triangle Scalar2DBasis Basis2D // Basis used for part of the RT basis construction V [2]utils.Matrix Div, DivInt utils.Matrix }
func NewRTBasis2DSimplex ¶
func NewRTBasis2DSimplex(P int, useLagrangeBasis bool) (rtb *RTBasis2DSimplex)
This is a second Raviart-Thomas element basis implementation within this project.
This implementation is based on the paper "Computational Bases for RTk and BDMk on Triangles" by V. J. Ervin
In this approach, edges are specifically addressed with 1D Lagrange polynomials multiplied by edge specific basis functions, while the interior points are composed of a supplied 2D scalar polynomial multiplied by a barycentric basis for the triangle.
func (*RTBasis2DSimplex) CalculateBasis ¶
func (rtb *RTBasis2DSimplex) CalculateBasis()
func (*RTBasis2DSimplex) EvaluateBasisAtLocation ¶
func (rtb *RTBasis2DSimplex) EvaluateBasisAtLocation(r, s float64, derivO ...DerivativeDirection) (p0, p1 []float64)
func (*RTBasis2DSimplex) ExtendGeomToRT ¶
func (rtb *RTBasis2DSimplex) ExtendGeomToRT(Rint, Sint utils.Vector) (R, S utils.Vector)
func (*RTBasis2DSimplex) GetEdgeLocations ¶
func (rtb *RTBasis2DSimplex) GetEdgeLocations(F []float64) (Fedge []float64)
func (*RTBasis2DSimplex) GetInternalLocations ¶
func (rtb *RTBasis2DSimplex) GetInternalLocations(F []float64) (Finternal []float64)
func (*RTBasis2DSimplex) Lagrange1DPoly ¶
func (rtb *RTBasis2DSimplex) Lagrange1DPoly(r float64, R []float64, j int, dir Direction, derivO ...DerivativeDirection) (p float64)
func (*RTBasis2DSimplex) LinearPoly ¶
func (rtb *RTBasis2DSimplex) LinearPoly(r, s float64, j int, derivO ...DerivativeDirection) (p float64)
type RTElement ¶
type RTElement struct { N int // Order of element Np int // Number of points in element NpEdge, NpInt int // Number of Edge and Interior points A utils.Matrix // Polynomial coefficient matrix, NpxNp V [2]utils.Matrix // Vandermonde matrix for each direction r and s, [2]xNpxNp Div, DivInt utils.Matrix // Divergence matrix, NpxNp for all, NintxNp Interior Points R, S utils.Vector // Point locations defining element in [-1,1] Triangle, NpxNp RTPolyBasis Basis2D }
func NewRTElement ¶
func (*RTElement) CalculateBasis ¶
func (rt *RTElement) CalculateBasis()
func (*RTElement) EvaluateRTBasis ¶
func (rt *RTElement) EvaluateRTBasis(b1 Basis2D, r, s float64, derivO ...DerivativeDirection) (p0, p1 []float64)
func (*RTElement) GetEdgeLocations ¶
func (*RTElement) GetInternalLocations ¶
func (*RTElement) ProjectFunctionOntoBasis ¶
type RTPointType ¶
type RTPointType uint8
const ( All RTPointType = iota InteriorR // R component of vector field InteriorS // S component of vector field Edge1 // Edge from vertex 0-1, Normal is [0,-1] Edge2 // Edge from vertex 1-2, Normal is [1./sqrt(2),1./sqrt(2)] Edge3 // Edge from vertex 2-0, Normal is [-1,0] )
type Triangulation ¶
type Triangulation struct { EToV utils.Matrix // K x 3 matrix mapping vertices to triangles Edges map[types.EdgeKey]*Edge // map of edges, key is the edge number, an int packed with the two vertices of each edge EtoE [][3]int // For each element in [k], the connected element for each of the three edges [0,1,2] }
func NewTriangulation ¶
func (*Triangulation) GetTriVerts ¶
func (tmesh *Triangulation) GetTriVerts(k uint32) (verts [3]int)
func (*Triangulation) NewEdge ¶
func (tmesh *Triangulation) NewEdge(VX, VY utils.Vector, verts [2]int, connectedElementNumber int, intEdgeNumber InternalEdgeNumber) (e *Edge)
Click to show internal directories.
Click to hide internal directories.