NAME
FieldsFEatItgPt - derivatives of finite element fields at optimal
points
INCLUDE
include "FieldsFEatItgPt.h"
SYNTAX
class FieldsFEatItgPt : public HandleId
{
Handle(ArrayGen(NUMT)) itg_pt_values;
Handle(FiniteElement) fe;
Handle(ElmItgRules) rules;
Handle(GridFE) mesh;
NumItgPoints itg_pt_tp;
int relative_order;
int nel;
int max_no_itg_pts;
int nfields;
Handle(ArrayGen(real)) coor; // optional
VecSort(int) no_itg_pt_in_elm; // used if heterogeneous mesh
bool redim (int nel, int max_no_itg_pts, int nfields, int nsd_coor = 0);
public:
FieldsFEatItgPt (const char* fieldname = NULL);
void gradient
(
const FieldFE& field,
NumItgPoints pt_tp = GAUSS_POINTS,
int relative_order = -1,
Field* k = NULL, // result: c*k*grad(field)
real c = 1.0,
real t = DUMMY, // time when evaluating k
bool store_coor = false
);
void derivedQuantitiesAtItgPt
(
FEM& fesolver,
GridFE& grid_,
int nfields,
NumItgPoints pt_tp = GAUSS_POINTS,
int relative_order = -1,
bool store_coor = false
);
void operator = (const FieldsFEatItgPt& f);
GridFE& grid ();
const GridFE& grid () const;
// indices: values()(element, itg_pt_no, field_no)
ArrayGen(NUMT) values () { return *itg_pt_values; }
const ArrayGen(NUMT)& values () const { return *itg_pt_values; }
bool hasCoor () const { return coor.ok(); }
// indices: getCoor()(element, itg_pt_no, coord_no)
inline ArrayGen(real)& getCoor ();
inline const ArrayGen(real)& getCoor () const;
inline NUMT& valueItgPt (int element, int itg_pt_no, int field_no) ;
inline NUMT valueItgPt (int element, int itg_pt_no, int field_no) const;
Ptv(real) getItgPt (int element, int itg_pt_no) const;
int getRelativeOrder () const { return relative_order; }
NumItgPoints getPointType () const { return itg_pt_tp; }
int getNoFields () const { return nfields; }
int getNoElms () const { return nel; }
int getNoItgPtsInElm (int e=1) const;
void detach ();
};
KEYWORDS
FieldsFEatItgPt, scattered points, derivatives of finite element
fields, optimal sampling points
DESCRIPTION
The class offers representation of derivatives of finite element
fields, computed at optimal (or nodal) locations in each element.
The locations are dictated by an ElmItgRules object, which means
that the points must coincide with those of a supported integra
tion rule. Usually, the class is used to sample derivatives of
finite element fields at the reduced Gauss points, which implies
NumItgPoint equal to GAUSS_POINTS and relative_order equal to -1.
The class is integrated with class FEM for computing smooth
fields based on the scattered point values in each element.
We strongly recommend that codes which use class FieldsFEatItgPt
are compiled in nopt mode and tested. Especially if the grid con
tains different element types, some of the internal data struc
tures contain dummy values, and in nopt mode several functions
offer safety checks to ensure that the user does not access ille
gal sampling (integration) points.
CONSTRUCTORS AND INITIALIZATION
Initialization is performed by calling gradient or derivedQuanti
tiesAtItgPt. These routines allocate memory (if necesssary) and
compute the values at the sampling points.
MEMBER FUNCTIONS
gradient - computes the gradient of a finite element field at
(reduced) integration points in all elements in a grid. One can
specify the integration points by the point type pt_tp (usually
equal to GAUSS_POINTS) and the relative order relative_order
(usually equal to -1). See class ElmItgRules for more information
about the point type and the relative order. For flux computa
tions, flux=-c*k*grad(u), the routine offers the possibility to
multiply the gradient by a field k at each sampling point and the
whole set of values by a scalar c. This is useful for computing,
e.g., heat fluxes (or Darcy velocities), where k is the heat con
duction coefficient from Fouriers law (or the permeability of a
porous medium) and c is -1. Usually, k is a field in the solver
class that can be fed directly into the gradient routine (that is
why we allow the c parameter; k has physical significance in
other parts of a simulator, and the flux needs the quantity -k).
When the boolean variable store_coor is true, the coordinates of
the integration points are stored in an internal array for easy
access (can be reached via getCoor or getItgPt).
derivedQuantitiesAtItgPt - this routine sets up a loop over all
elements and the specified integration points (according to pt_tp
and relative_order, see documentation of the gradient function)
and calls an associated finite element solver, represented in
terms of the fesolver argument, for computation of a derived
quantity. Such derived quantities are, e.g., stresses and
strains, which require derivatives of finite element fields com
bined with physical data, like elasticity parameters etc. The
programmer must implement a function
derivedQuantitiesAtItgPt (VecSimple(NUMT)&, const FiniteElement&)
in the simulator (this function plays the same role in the pre
sent setting as integrands in the assembly process). When the
boolean variable store_coor is true, the coordinates of the inte
gration points are stored in an internal array for easy access
(can be reached via getCoor or getItgPt).
valueItgPt - returns the value of the derivative, or another
derived quantity, like stress or strain, at a specified (reduced)
integration point in an element.
getItgPt - returns the coordinates of an integration point in an
element.
The rest of the functions should be self-explanatory.
SEE ALSO
class FEM.
DEVELOPED BY
University of Oslo, Dept. of Mathematics, Norway
AUTHOR
Hans Petter Langtangen, UiO