Residue Class Reference

ElementalOperation.h DG++. More...

#include <ElementalOperation.h>

Inheritance diagram for Residue:
BaseResidue DiagonalMassForSW DResidue StressWork

List of all members.

Public Member Functions

 Residue ()
virtual ~Residue ()
 Residue (const Residue &NewEl)
virtual Residueclone () const =0
virtual const std::vector
< size_t > & 
getFields () const =0
 Returns the fields used for the computation of the residue
.
virtual size_t getFieldDof (size_t fieldnumber) const =0
 Returns the number of degrees of freedom per field used for the computation of the residue
.
virtual bool getVal (const MatDouble &argval, MatDouble &funcval) const =0
 Returns the value of the residue given the values of the fields.
virtual const ElementgetElement () const =0
virtual const SimpleMaterialgetMaterial () const =0

Static Public Member Functions

static bool assemble (std::vector< Residue * > &ResArray, const LocalToGlobalMap &L2G, const VecDouble &Dofs, VecDouble &ResVec)
 assemble Residual Vector

Detailed Description

ElementalOperation.h DG++.

Created by Adrian Lew on 10/25/06.

Copyright (c) 2006 Adrian Lew

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Computes a residue on an element A Residue object computes the values of a vector function of some or all the fields in the element, with the distinguishing feature that there is one component of the function per degree of freedom of the participating fields.

A Residue object contains two concepts:
1) A procedure to compute the value of the function
2) A pointer to the element over which to compute it

Each residue acts then as a container of a pointer to an element object, and an operation to perform on that object. In this way the same element can be used for several operation in a single computation (The alternative of adding more layers of inheritance to the element classes makes the last possibility very clumsy).

Additionally, operation that need higher-levels of specialization, such as special classes of elements, can perform type-checking in their own implementation.

The class residue is in fact very similar to a general container, in the sense that the object it points to does not need to be an element but can be any object that permits the computation of the function and can use the (field, dof) notation to label the inputs and outputs.

The precise fields to be utilized in the computation of the operation may vary from element type to element type, hence these will generally be specified.

More precisely, a residual is a function

\[ F^f_a(u^0_0,u^0_1, \ldots, u^0_{n_0-1}, u^0_1, \ldots, u^{K}_{n_{K-1}-1}), \]

where $u^f_a$ is the a-th degree of freedom of the f-th participating field in the function. A total of K of the element fields participate as arguments in the function. The f-th participating field has a total of $n_f$ degrees of freedom. The coefficient of the force "f" runs from 0 to K-1, and "a" ia the degree of freedom index that ranges from 0 to $n_f$.

We need to specify specify which field in the element will represent the f-th participating field in the function F. For instance, the field number 2 in the element can be used as the first argument of F, i.e., as participating field number 0.

Todo:
This class does not accept the input of additional parameters that may be needed for the evaluation of T that may not be solved for.
Todo:
The assembly procedure should probably be changed

Constructor & Destructor Documentation

Residue::Residue (  )  [inline]
virtual Residue::~Residue (  )  [inline, virtual]
Residue::Residue ( const Residue NewEl  )  [inline]

Member Function Documentation

bool Residue::assemble ( std::vector< Residue * > &  ResArray,
const LocalToGlobalMap L2G,
const VecDouble Dofs,
VecDouble ResVec 
) [static]

assemble Residual Vector

Assembles the contributions from an Array of residual objects ResArray into ResVec. The contribution from each ResArray, ResArray[e], is mapped into ResVec with a LocalToGlobalMap.

Parameters:
ResArray Array of residue objects
L2G LocalToGlobalMap
Dofs PetscVector with values of degrees of freedom
ResVec Pointer to a PetscVector where to assemble the residues. ResVec is zeroed in assemble

This is precisely what's done:
1) assemble input gathered as
argval[f][a] = Dofs[L2G(f,a)]
2) Computation of the local residue funcval as ResArray[i]->getVal(argval, funcval)
3) assemble output gathered as
ResVec[L2G(f,a)] += funcval[f][a]

Behavior:
Successful assembly returns true, unsuccessful false

Warning:
: The residue object that computes the contributions of element "e" is required to have position "e" in ResArray as well, so that the LocalToGlobalMap object is used consistently
Todo:
A defect of this implementation is that all fields in the element enter as arguments for Residue and its derivative. It would be good to have the flexibility to extract a subset of the degrees of freedom of the element as the argument to Residue and its derivative. In this way it is possible to act with different elemental operation on different degrees of freedom naturally, i.e., without having to artificially return a Residue that has presumed contributions from all degrees of freedom.
virtual Residue* Residue::clone (  )  const [pure virtual]

Implemented in DiagonalMassForSW, DResidue, and StressWork.

virtual const Element& Residue::getElement (  )  const [pure virtual]

Implemented in BaseResidue.

virtual size_t Residue::getFieldDof ( size_t  fieldnumber  )  const [pure virtual]

Returns the number of degrees of freedom per field used for the computation of the residue
.

getFieldDof(fieldnum) returns the number of deegrees of freedom in the participating fieldo number "fieldnumber". The argument fieldnumber begins from zero.
The number of different values of "a" in $u^{f}_a$ is then computed with field getFieldDof(f)

Implemented in BaseResidue.

virtual const std::vector<size_t>& Residue::getFields (  )  const [pure virtual]

Returns the fields used for the computation of the residue
.

getFields()[i] returns the field number beginning from zero.
The variable $u^f_a$ is then computed with field getFields()[f] in the element.

Implemented in BaseResidue.

virtual const SimpleMaterial& Residue::getMaterial (  )  const [pure virtual]

Implemented in BaseResidue.

virtual bool Residue::getVal ( const MatDouble argval,
MatDouble funcval 
) const [pure virtual]

Returns the value of the residue given the values of the fields.

Parameters:
argval vector of vector<double> containing the values of the degrees of freedom for each field.
argval[f][a] contains the value of degree of freedom "a" for participating field "f".
funcval It returns a vector< vector<double> > with the values of each component of the residual function. We have that $F^f_a$=funcval[f][a]. The vector funcval is resized and zeroed in getVal.

The function returns true if successful, false otherwise.

Implemented in DiagonalMassForSW, and StressWork.


The documentation for this class was generated from the following files:
Generated on Tue Aug 2 11:51:28 2011 for Galois by  doxygen 1.6.3