StandardAVI Class Reference

StandardAVI.h DG++. More...

#include <StandardAVI.h>

Inheritance diagram for StandardAVI:
AVI

List of all members.

Public Types

enum  BCImposedType { ZERO, ONE, TWO }
 

type of boundary conditions imposed ZERO means no boundary conditions

More...
typedef double(* BCFunc )(int, int, double)
 function used for obtaining value of boundary conditions

Public Member Functions

 StandardAVI (const LocalToGlobalMap &L2G, const DResidue &MyRes, const VecDouble &MassVec, size_t globalIdx, const MatBool &IFlag, const MatDouble &IVal, const double delta, const double time)
 StandardAVI constructor designed to handle integration of an individual element.
 StandardAVI (const LocalToGlobalMap &L2G, const DResidue &MyRes, const VecDouble &MassVec, size_t globalIdx, const std::vector< std::vector< BCImposedType > > &IType, const std::vector< BCFunc > &bcfunc_vec, const double delta, const double time)
 StandardAVI constructor designed to handle integration of an individual element.
 StandardAVI (const StandardAVI &that)
 Copy constructor.
virtual StandardAVIclone () const
double getTimeStep () const
 returns time step for the Element
double getTimeStamp () const
 returns the last update time for this element
bool setTimeStamp (double timeval)
 set the last update time.
virtual double getNextTimeStamp () const
 Returns the next time at which the force field will be updated.
virtual void incTimeStamp ()
 increment the time stamp
virtual const DResiduegetOperation () const
size_t getFieldDof (size_t fieldnumber) const
 Returns the number of degrees of freedom per field used for the computation
.
const std::vector< size_t > & getFields () const
 Returns the field numbers used whose degrees of freedom participate in the force field computation.
const ElementGeometrygetGeometry () const
 returns the element geometry
const ElementgetElement () const
 returns the element
bool getForceField (const MatDouble &argval, MatDouble &forcefield) const
 Updates the force field through the operation Stresswork class.
size_t getGlobalIndex (void) const
 Returns the global element index for the AVI object.
virtual void computeLocalTvec (MatDouble &tnew) const
 write the updated time vector into the argument provided value filled in is the one obtained from getNextTimeStamp ()
virtual bool vbInit (const MatDouble &q, const MatDouble &v, const MatDouble &vb, const MatDouble &ti, const MatDouble &tnew, MatDouble &qnew, MatDouble &vbinit, MatDouble &forcefield, MatDouble &funcval, MatDouble &deltaV) const
 Initialization routine to set values at the half time step This function is called only once per element and is called after gather and before update and assemble.
virtual bool update (const MatDouble &q, const MatDouble &v, const MatDouble &vb, const MatDouble &ti, const MatDouble &tnew, MatDouble &qnew, MatDouble &vnew, MatDouble &vbnew, MatDouble &forcefield, MatDouble &funcval, MatDouble &deltaV) const
 update of the given forcefield.
bool gather (const LocalToGlobalMap &L2G, const VecDouble &Qval, const VecDouble &Vval, const VecDouble &Vbval, const VecDouble &Tval, MatDouble &q, MatDouble &v, MatDouble &vb, MatDouble &ti) const
 Gathers the values needed from the global arrays to perform the force field computation.
bool assemble (const LocalToGlobalMap &L2G, const MatDouble &qnew, const MatDouble &vnew, const MatDouble &vbnew, const MatDouble &tnew, VecDouble &Qval, VecDouble &Vval, VecDouble &Vbval, VecDouble &Tval, VecDouble &LUpdate) const
 Assembles the updated values in the global array, including the latest time of update of the degrees of freedom in the object.

Protected Member Functions

virtual void setTimeStep (double epsilon=1.0)
 Sets the time step for the element based upon the element geometry and sound speed.
virtual void computeDeltaV (const MatDouble &funcval, MatDouble &DeltaV) const
 Solves the system of equations with the mass matrix for $\Delta v_b$.
virtual bool getImposedValues (const GlobalElementIndex &ElementIndex, const LocalToGlobalMap &L2G, size_t field, size_t dof, double &qvalue, double &vvalue) const
 Imposed values of the degrees of freedom and its time derivative.
void roundTimeStep (double min_ts)
 Option to round the time step in order to address round-off error.

Private Member Functions

StandardAVIoperator= (const StandardAVI &that)
void init (const LocalToGlobalMap &L2G, const VecDouble &MassVec)
void setDiagVals (const VecDouble &MassVec, const LocalToGlobalMap &L2G, const GlobalElementIndex &elem_index)
 This function sets the Mass Matrix diagonal values for the element after they have been computed using DiagonalMassForSW and place into the petsc vector MassVec.
void setBCs (const MatBool &IFlag, const MatDouble &IVal)
 set the boundary conditions on the local element

Private Attributes

const DResidueoperation
MatDouble MMdiag
size_t globalIdx
std::vector< BCFuncavi_bc_func
std::vector< std::vector
< BCImposedType > > 
imposedTypes
MatBool imposedFlags
MatDouble imposedValues
size_t nfields
double delta
double timeStamp
double timeStep

Detailed Description

StandardAVI.h DG++.

Created by Adrian Lew on 9/23/08.

Copyright (c) 2008 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. StandardAVI class implementation of AVI base class


Member Typedef Documentation

typedef double(* StandardAVI::BCFunc)(int, int, double)

function used for obtaining value of boundary conditions


Member Enumeration Documentation

type of boundary conditions imposed ZERO means no boundary conditions

Enumerator:
ZERO 
ONE 
TWO 

Constructor & Destructor Documentation

StandardAVI::StandardAVI ( const LocalToGlobalMap L2G,
const DResidue MyRes,
const VecDouble MassVec,
size_t  globalIdx,
const MatBool IFlag,
const MatDouble IVal,
const double  delta,
const double  time 
) [inline]

StandardAVI constructor designed to handle integration of an individual element.

Parameters:
L2G local to global map for access to Petsc vectors
MyRes ref to a Stresswork for this element
MassVec ref to the assembled mass vector for the mesh
globalIdx is the Element's unique global index
IFlag is a ref to the Boundary values indicator
IVal is a ref to the actual values of boundary conditions, if IFlag is not false
delta is a double that is used as a safety factor in computing the times step for an element
time allows the AVI object's time to be set to some value
StandardAVI::StandardAVI ( const LocalToGlobalMap L2G,
const DResidue MyRes,
const VecDouble MassVec,
size_t  globalIdx,
const std::vector< std::vector< BCImposedType > > &  IType,
const std::vector< BCFunc > &  bcfunc_vec,
const double  delta,
const double  time 
) [inline]

StandardAVI constructor designed to handle integration of an individual element.

Parameters:
MyRes ref to a Stresswork for this element
MassVec ref to the assembled mass vector for the mesh
L2G local to global map for access to Petsc vectors
globalIdx is the Element's unique global index
IType is a vector containing types of imposed boundary conditons
See also:
StandardAVI::BCImposedType
Parameters:
bcfunc_vec is a vector of function pointers used to obtain the value of boundary conditions
delta is a double that is used as a safety factor in computing the times step for an element
time allows the AVI object's time to be set to some value
StandardAVI::StandardAVI ( const StandardAVI that  )  [inline]

Copy constructor.


Member Function Documentation

bool StandardAVI::assemble ( const LocalToGlobalMap L2G,
const MatDouble qnew,
const MatDouble vnew,
const MatDouble vbnew,
const MatDouble tnew,
VecDouble Qval,
VecDouble Vval,
VecDouble Vbval,
VecDouble Tval,
VecDouble LUpdate 
) const [virtual]

Assembles the updated values in the global array, including the latest time of update of the degrees of freedom in the object.

identify its global degrees of freedom. This information is not embedded in the object.

Parameters:
L2G Local to Global map used to find the values in the Global arrays
qnew local vector with the updated values of the degrees of freedom, $q_a^{i}$ in the notation above.
vnew Upon exit, local vector with the updated values of the time derivatives of the degrees of freedom, $v_a^{i}$ in the notation above.
vbnew Upon exit, local vector with the updated values of the time derivatives at the middle of a time step of the degrees of freedom, $v_a^{i+1/2}$ in the notation above.
tnew updated values of time vector
Qval Global array where to assemble the updated values of the degrees of freedom.
Vval Global array where to assemble the time derivatives of the degrees of freedom.
Vbval Global array where to assemble the time derivatives of the degrees of freedom at the middle of the time step.
Tval Global array where to assemble the times at which the degrees of freedom were last updated.
LUpdate Global array to keep track of which element updated the Dof last. This is used to keep Dofs from being updated out of order due to messaging delays. contains the global elem index of the last element to update each Dof.

For example, Q[L2G.map(ElementIndex,getFields()[f],b)]=q[f][b]

Implements AVI.

virtual StandardAVI* StandardAVI::clone (  )  const [inline, virtual]

Implements AVI.

void StandardAVI::computeDeltaV ( const MatDouble funcval,
MatDouble DeltaV 
) const [protected, virtual]

Solves the system of equations with the mass matrix for $\Delta v_b$.


This is made a virtual function so that, if the mass matrix happens to be diagonal, it is done efficiently.

Parameters:
funcval values of $\Delta t f_a(q_a^i)$. Notice that the multiplication by $\Delta t$ is already included. funcval[f][b] contains the value of $\Delta t f_a(q_a^i)$ for the degree of freedom indexed with field "f" and degree of freedom number in that field "b".
DeltaV values of $\Delta v_a$ upon exit. DeltaV[f][b] contains the value of $\Delta v_a$ for the degree of freedom indexed with field "f" and degree of freedom number in that field "b".

Implements AVI.

void StandardAVI::computeLocalTvec ( MatDouble tnew  )  const [virtual]

write the updated time vector into the argument provided value filled in is the one obtained from getNextTimeStamp ()

Implements AVI.

bool StandardAVI::gather ( const LocalToGlobalMap L2G,
const VecDouble Qval,
const VecDouble Vval,
const VecDouble Vbval,
const VecDouble Tval,
MatDouble q,
MatDouble v,
MatDouble vb,
MatDouble ti 
) const [virtual]

Gathers the values needed from the global arrays to perform the force field computation.

identify its global degrees of freedom. This information is not embedded in the object.

Parameters:
L2G Local to Global map used to find the values in the Global arrays
Qval Global array with the last updated values of the degrees of freedom.
Vval Global array with the last updated values of the time derivatives of the degrees of freedom.
Vbval Global array with the last updated values of the time derivatives of the degrees of freedom at the middle of the time step.
Tval Global array with the times at which the degrees of freedom were last updated.
q Upon exit, local vector with the last known values of the degrees of freedom, $q_a^{i-1}$ in the notation above.
v Upon exit, local vector with the last known values of the time derivatives of the degrees of freedom, $v_a^{i-1}$ in the notation above.
vb Upon exit, local vector with the last known values of the time derivatives at the middle of a time step of the degrees of freedom, $v_a^{i-1/2}$ in the notation above.
ti Upon exit, local vector with the last update time of a the degrees of freedom, $t_a^{i-1}$ in the notation above.

For example, q[f][b] = Q[L2G.map(ElementIndex,getFields()[f],b)]

This function uses getImposedValues to fill the imposed values arrays.

Implements AVI.

const Element& StandardAVI::getElement (  )  const [inline, virtual]

returns the element

Implements AVI.

size_t StandardAVI::getFieldDof ( size_t  fieldnumber  )  const [inline, virtual]

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

getFieldDof(fieldnum) returns the number of deegrees of freedom in the participating field number "fieldnumber". The argument fieldnumber begins from zero.

Implements AVI.

const std::vector<size_t>& StandardAVI::getFields (  )  const [inline, virtual]

Returns the field numbers used whose degrees of freedom participate in the force field computation.

getFields()[i] returns the field number beginning from zero.
If the degree of freedom $q_a$ is indexed with [f][b] locally, then it corresponds to field getFields()[f] in the Global arrays.

Implements AVI.

bool StandardAVI::getForceField ( const MatDouble argval,
MatDouble forcefield 
) const [inline, virtual]

Updates the force field through the operation Stresswork class.

Implements AVI.

const ElementGeometry& StandardAVI::getGeometry (  )  const [inline, virtual]

returns the element geometry

Implements AVI.

size_t StandardAVI::getGlobalIndex ( void   )  const [inline, virtual]

Returns the global element index for the AVI object.

Implements AVI.

bool StandardAVI::getImposedValues ( const GlobalElementIndex ElementIndex,
const LocalToGlobalMap L2G,
size_t  field,
size_t  dof,
double &  qvalue,
double &  vvalue 
) const [protected, virtual]

Imposed values of the degrees of freedom and its time derivative.

Parameters:
ElementIndex GlobalElementIndex or index of the force field in the AVI object, used to identify its global degrees of freedom. This information is not embedded in the object.
L2G Local to Global map used to find the values in the Global arrays
field field number for which the imposed values are sought, starting from zero.
dof degree of freedom number within field "field" for which the imposed values are sought, starting from zero.
qvalue upon exit, imposed value of the degree of freedom
vvalue upon exit, imposed value of the time derivative of the degree of freedom

The values of ElementIndex and L2G are not always needed, but they are included here to provide a general interface.

Todo:
There has to be a cleaner way to deal with the value of the boundary condition other than providing a general interface to code them in the derived classes.

Implements AVI.

virtual double StandardAVI::getNextTimeStamp (  )  const [inline, virtual]

Returns the next time at which the force field will be updated.

Implements AVI.

virtual const DResidue& StandardAVI::getOperation (  )  const [inline, virtual]

Implements AVI.

double StandardAVI::getTimeStamp (  )  const [inline, virtual]

returns the last update time for this element

Implements AVI.

double StandardAVI::getTimeStep (  )  const [inline, virtual]

returns time step for the Element

Implements AVI.

virtual void StandardAVI::incTimeStamp (  )  [inline, virtual]

increment the time stamp

Implements AVI.

void StandardAVI::init ( const LocalToGlobalMap L2G,
const VecDouble MassVec 
) [inline, private]
StandardAVI& StandardAVI::operator= ( const StandardAVI that  )  [inline, private]
void StandardAVI::roundTimeStep ( double  min_ts  )  [inline, protected]

Option to round the time step in order to address round-off error.

Not currently used

Parameters:
min_ts -- the smallest time step in mesh. Every time step will be rounded to a value 3 significant digits smaller than the min_ts
void StandardAVI::setBCs ( const MatBool IFlag,
const MatDouble IVal 
) [private]

set the boundary conditions on the local element

Parameters:
IFlag is set to true for each bc that is imposed
Todo:
--Modify this to reflect changes to constructor
Parameters:
IVal is set to value for each bc that is imposed
void StandardAVI::setDiagVals ( const VecDouble MassVec,
const LocalToGlobalMap L2G,
const GlobalElementIndex elem_index 
) [private]

This function sets the Mass Matrix diagonal values for the element after they have been computed using DiagonalMassForSW and place into the petsc vector MassVec.

Parameters:
MassVec -- input in the form of petsc vector computed using DiagonalMassForSW
L2G -- localtoglobal map for petsc vectors
elem_index -- needed for proper indexing into the L2G map contains the element index locally
bool StandardAVI::setTimeStamp ( double  timeval  )  [inline, virtual]

set the last update time.

Returns true upon success.

Parameters:
timeval value of the last update time

Implements AVI.

virtual void StandardAVI::setTimeStep ( double  epsilon = 1.0  )  [inline, protected, virtual]

Sets the time step for the element based upon the element geometry and sound speed.

The safety factor, delta, is set during the construction of the AVI object. The optional parameter, epsilon, allows the time step to be adjusted further.

Parameters:
epsilon,: optional parameter which allows the time step to be set to a fraction of its normal value.

Implements AVI.

bool StandardAVI::update ( const MatDouble q,
const MatDouble v,
const MatDouble vb,
const MatDouble ti,
const MatDouble tnew,
MatDouble qnew,
MatDouble vnew,
MatDouble vbnew,
MatDouble forcefield,
MatDouble funcval,
MatDouble deltaV 
) const [virtual]

update of the given forcefield.

It returns the new values for the degrees of freedom and its time derivatives. These need yet to be assembled. Returns true upon success.

The forcefield time is updated. Of course, this does not happen with the last update time of each degree of freedom, which are updated in the assemble part.

In the following vectors, index [f][b] indicates the value for the "b"-th degree of freedom of field "f".

Parameters:
q vector with the last known values of the degrees of freedom, $q_a^{i-1}$ in the notation above.
v vector with the last known values of the time derivatives of the degrees of freedom, $v_a^{i-1}$ in the notation above.
vb vector with the last known values of the time derivatives at the middle of a time step of the degrees of freedom, $v_a^{i-1/2}$ in the notation above.
ti vector with the last update time of a the degrees of freedom, $t_a^{i-1}$ in the notation above.
tnew vector with the updated time of a the degrees of freedom, $t_a^{i}$ in
qnew Upon exit, new values of the degrees of freedom, $q_a^{i}$ in the notation above.
vnew Upon exit, new values of the time derivatives of the degrees of freedom, $v_a^{i}$ in the notation above.
vbnew Upon exit, new values of the time derivatives at the middle of a time step of the degrees of freedom, $v_a^{i+1/2}$ in the notation above.
forcefield temporary intermediate vector
funcval temporary intermediate vector
deltaV temporary intermediate vector

Implements AVI.

bool StandardAVI::vbInit ( const MatDouble q,
const MatDouble v,
const MatDouble vb,
const MatDouble ti,
const MatDouble tnew,
MatDouble qnew,
MatDouble vbinit,
MatDouble forcefield,
MatDouble funcval,
MatDouble deltaV 
) const [virtual]

Initialization routine to set values at the half time step This function is called only once per element and is called after gather and before update and assemble.

Parameters:
q used to calculate the velocity at the half step. local vector with the last known values of the degrees of freedom, $q_a^{i-1}$ in the notation above.
v previous values of the time derivatives of velocity
vb previous values of the time derivatives at the middle of a time step of the degrees of freedom, $v_a^{i-1/2}$ in the notation above.
ti local vector with the last update time of a the degrees of freedom, $t_a^{i-1}$ in the notation above.
tnew updated local time vector
See also:
AVI::computeLocalTvec ()
Parameters:
qnew updated value of q vector
vbinit initialized value of vb vector
forcefield temporary intermediate vector
funcval temporary intermediate vector
deltaV temporary intermediate vector For example, q[f][b] = Q[L2G.map(ElementIndex,getFields()[f],b)]

This function uses getImposedValues to fill the imposed values arrays.

Implements AVI.


Member Data Documentation

std::vector<BCFunc> StandardAVI::avi_bc_func [private]
double StandardAVI::delta [private]
size_t StandardAVI::globalIdx [private]
std::vector<std::vector<BCImposedType> > StandardAVI::imposedTypes [private]
size_t StandardAVI::nfields [private]
const DResidue& StandardAVI::operation [private]
double StandardAVI::timeStamp [private]
double StandardAVI::timeStep [private]

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