Mesh Oriented datABase  (version 5.5.1)
An array-based unstructured mesh library
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) More...
 
- Public Member Functions inherited from moab::Element::LinearQuad
 LinearQuad (const std::vector< CartVect > &vertices)
 
 LinearQuad ()
 
virtual ~LinearQuad ()
 
virtual CartVect evaluate (const CartVect &xi) const
 Evaluate the map on \(x_i\) (calculate \(\vec x = F($\vec \xi)\) ) More...
 
virtual bool inside_nat_space (const CartVect &xi, double &tol) const
 decide if within the natural param space, with a tolerance More...
 
virtual Matrix3 jacobian (const CartVect &xi) const
 Evaluate the map's Jacobi matrix. More...
 
virtual double evaluate_scalar_field (const CartVect &xi, const double *field_vertex_values) const
 Evaluate a scalar field at a point given field values at the vertices. More...
 
virtual double integrate_scalar_field (const double *field_vertex_values) const
 Integrate a scalar field over the element given field values at the vertices. More...
 
- Public Member Functions inherited from moab::Element::Map
 Map (const std::vector< CartVect > &v)
 Construct a Map defined by the given std::vector of vertices. More...
 
 Map (const unsigned int n)
 Construct a Map defined by n vertices. More...
 
virtual ~Map ()
 
virtual Matrix3 ijacobian (const CartVect &xi) const
 Evaluate the inverse of the Jacobi matrix. More...
 
virtual double det_jacobian (const CartVect &xi) const
 Evaluate the determinate of the Jacobi matrix. More...
 
virtual double det_ijacobian (const CartVect &xi) const
 Evaluate the determinate of the inverse Jacobi matrix. More...
 
unsigned int size ()
 Size of the vertices vector. More...
 
const std::vector< CartVect > & get_vertices ()
 Retrieve vertices. More...
 
virtual void set_vertices (const std::vector< CartVect > &v)
 Set vertices.
More...
 

Protected Attributes

CartVect v1
 
Matrix3 transf
 
- Protected Attributes inherited from moab::Element::Map
std::vector< CartVectvertex
 

Additional Inherited Members

- Static Protected Attributes inherited from moab::Element::LinearQuad
static const double corner [4][3] = { { -1, -1, 0 }, { 1, -1, 0 }, { 1, 1, 0 }, { -1, 1, 0 } }
 
static const double gauss [1][2] = { { 2.0, 0.0 } }
 
static const unsigned int corner_count = 4
 
static const unsigned int gauss_count = 1
 

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

◆ SphericalQuad()

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

Definition at line 447 of file ElemUtil.cpp.

447  : LinearQuad( vertices )
448  {
449  // project the vertices to the plane tangent at first vertex
450  v1 = vertex[0]; // member data
451  double v1v1 = v1 % v1; // this is 1, in general, for unit sphere meshes
452  for( int j = 1; j < 4; j++ )
453  {
454  // first, bring all vertices in the gnomonic plane
455  // the new vertex will intersect the plane at vnew
456  // so that (vnew-v1)%v1 is 0 ( vnew is in the tangent plane, i.e. normal to v1 )
457  // pos is the old position of the vertex, and it is in general on the sphere
458  // vnew = alfa*pos; (alfa*pos-v1)%v1 = 0 <=> alfa*(pos%v1)=v1%v1 <=> alfa =
459  // v1v1/(pos%v1)
460  // <=> vnew = ( v1v1/(pos%v1) )*pos
461  CartVect vnew = v1v1 / ( vertex[j] % v1 ) * vertex[j];
462  vertex[j] = vnew;
463  }
464  // will compute a transf matrix, such that a new point will be transformed with
465  // newpos = transf * (vnew-v1), and it will be a point in the 2d plane
466  // the transformation matrix will be oriented in such a way that orientation will be
467  // positive
468  CartVect vx = vertex[1] - v1; // this will become Ox axis
469  // z axis will be along v1, in such a way that orientation of the quad is positive
470  // look at the first 2 edges
471  CartVect vz = vx * ( vertex[2] - vertex[1] );
472  vz = vz / vz.length();
473 
474  vx = vx / vx.length();
475 
476  CartVect vy = vz * vx;
477  transf = Matrix3( vx[0], vx[1], vx[2], vy[0], vy[1], vy[2], vz[0], vz[1], vz[2] );
478  vertex[0] = CartVect( 0. );
479  for( int j = 1; j < 4; j++ )
480  vertex[j] = transf * ( vertex[j] - v1 );
481  }

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

◆ ~SphericalQuad()

virtual moab::Element::SphericalQuad::~SphericalQuad ( )
inlinevirtual

Definition at line 316 of file ElemUtil.hpp.

316 {};

Member Function Documentation

◆ ievaluate()

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.

484  {
485  // project to the plane tangent at first vertex (gnomonic projection)
486  double v1v1 = v1 % v1;
487  CartVect vnew = v1v1 / ( x % v1 ) * x; // so that (vnew-v1)%v1 is 0
488  vnew = transf * ( vnew - v1 );
489  // det will be positive now
490  return Map::ievaluate( vnew, tol, x0 );
491  }

References moab::Element::Map::ievaluate(), transf, and v1.

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

◆ inside_box()

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.

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

References moab::Element::Map::inside_box(), transf, and v1.

Referenced by test_spherical_quad().

Member Data Documentation

◆ transf

Matrix3 moab::Element::SphericalQuad::transf
protected

Definition at line 322 of file ElemUtil.hpp.

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

◆ v1

CartVect moab::Element::SphericalQuad::v1
protected

Definition at line 321 of file ElemUtil.hpp.

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


The documentation for this class was generated from the following files: