Mesh Oriented datABase  (version 5.4.1)
Array-based unstructured mesh datastructure
moab::Element::SphericalQuad Class Reference

Shape function space for bilinear quadrilateral on sphere, obtained from the canonical linear (affine) functions. It is mapped using gnomonic projection to a plane tangent at the first vertex It works well for edges that are great circle arcs; RLL meshes do not have this property, but HOMME or MPAS meshes do have it. More...

#include <ElemUtil.hpp>

+ Inheritance diagram for moab::Element::SphericalQuad:
+ Collaboration diagram for moab::Element::SphericalQuad:

Public Member Functions

 SphericalQuad (const std::vector< CartVect > &vertices)
virtual ~SphericalQuad ()
virtual bool inside_box (const CartVect &pos, double &tol) const
CartVect ievaluate (const CartVect &x, double tol=1e-6, const CartVect &x0=CartVect(0.0)) const
 Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance)

Protected Attributes

CartVect v1
Matrix3 transf

Detailed Description

Shape function space for bilinear quadrilateral on sphere, obtained from the canonical linear (affine) functions. It is mapped using gnomonic projection to a plane tangent at the first vertex It works well for edges that are great circle arcs; RLL meshes do not have this property, but HOMME or MPAS meshes do have it.

Definition at line 312 of file ElemUtil.hpp.


Constructor & Destructor Documentation

moab::Element::SphericalQuad::SphericalQuad ( const std::vector< CartVect > &  vertices)

Definition at line 447 of file ElemUtil.cpp.

References moab::CartVect::length(), transf, and v1.

                                                                        : LinearQuad( vertices )
    {
        // project the vertices to the plane tangent at first vertex
        v1          = vertex[0];  // member data
        double v1v1 = v1 % v1;    // this is 1, in general, for unit sphere meshes
        for( int j = 1; j < 4; j++ )
        {
            // first, bring all vertices in the gnomonic plane
            //  the new vertex will intersect the plane at vnew
            //   so that (vnew-v1)%v1 is 0 ( vnew is in the tangent plane, i.e. normal to v1 )
            // pos is the old position of the vertex, and it is in general on the sphere
            // vnew = alfa*pos;  (alfa*pos-v1)%v1 = 0  <=> alfa*(pos%v1)=v1%v1 <=> alfa =
            // v1v1/(pos%v1)
            //  <=> vnew = ( v1v1/(pos%v1) )*pos
            CartVect vnew = v1v1 / ( vertex[j] % v1 ) * vertex[j];
            vertex[j]     = vnew;
        }
        // will compute a transf matrix, such that a new point will be transformed with
        // newpos =  transf * (vnew-v1), and it will be a point in the 2d plane
        // the transformation matrix will be oriented in such a way that orientation will be
        // positive
        CartVect vx = vertex[1] - v1;  // this will become Ox axis
        // z axis will be along v1, in such a way that orientation of the quad is positive
        // look at the first 2 edges
        CartVect vz = vx * ( vertex[2] - vertex[1] );
        vz          = vz / vz.length();

        vx = vx / vx.length();

        CartVect vy = vz * vx;
        transf      = Matrix3( vx[0], vx[1], vx[2], vy[0], vy[1], vy[2], vz[0], vz[1], vz[2] );
        vertex[0]   = CartVect( 0. );
        for( int j = 1; j < 4; j++ )
            vertex[j] = transf * ( vertex[j] - v1 );
    }
virtual moab::Element::SphericalQuad::~SphericalQuad ( ) [inline, virtual]

Definition at line 316 of file ElemUtil.hpp.

{};

Member Function Documentation

CartVect moab::Element::SphericalQuad::ievaluate ( const CartVect x,
double  tol = 1e-6,
const CartVect x0 = CartVect( 0.0 ) 
) const [virtual]

Evaluate the inverse map (calculate \(\vec \xi = F^-1($\vec x)\) to given tolerance)

Reimplemented from moab::Element::Map.

Definition at line 483 of file ElemUtil.cpp.

References transf, and v1.

Referenced by moab::Coupler::nat_param(), and test_spherical_quad().

    {
        // project to the plane tangent at first vertex (gnomonic projection)
        double v1v1   = v1 % v1;
        CartVect vnew = v1v1 / ( x % v1 ) * x;  // so that (vnew-v1)%v1 is 0
        vnew          = transf * ( vnew - v1 );
        // det will be positive now
        return Map::ievaluate( vnew, tol, x0 );
    }
bool moab::Element::SphericalQuad::inside_box ( const CartVect pos,
double &  tol 
) const [virtual]

Reimplemented from moab::Element::Map.

Definition at line 493 of file ElemUtil.cpp.

References transf, and v1.

Referenced by test_spherical_quad().

    {
        // project to the plane tangent at first vertex
        // CartVect v1=vertex[0];
        double v1v1   = v1 % v1;
        CartVect vnew = v1v1 / ( pos % v1 ) * pos;  // so that (x-v1)%v1 is 0
        vnew          = transf * ( vnew - v1 );
        return Map::inside_box( vnew, tol );
    }

Member Data Documentation

Definition at line 322 of file ElemUtil.hpp.

Referenced by ievaluate(), inside_box(), and SphericalQuad().

Definition at line 321 of file ElemUtil.hpp.

Referenced by ievaluate(), inside_box(), and SphericalQuad().

List of all members.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines