|
PISM, A Parallel Ice Sheet Model stable 0.4.1779
|
The mapping from global to local degrees of freedom. More...
#include <FETools.hh>
Public Member Functions | |
| FEDOFMap () | |
| virtual | ~FEDOFMap () |
| virtual void | extractLocalDOFs (PetscInt i, PetscInt j, PetscReal const *const *xg, PetscReal *x) const |
| Extract local degrees of freedom for element (i,j) from global vector xg to local vector x (scalar-valued DOF version). | |
| virtual void | extractLocalDOFs (PetscInt i, PetscInt j, PISMVector2 const *const *xg, PISMVector2 *x) const |
| Extract local degrees of freedom for element (i,j) from global vector xg to local vector x (vector-valued DOF version). | |
| virtual void | extractLocalDOFs (PetscReal const *const *xg, PetscReal *x) const |
| Extract scalar degrees of freedom for the element specified previously with FEDOFMap::reset. | |
| virtual void | extractLocalDOFs (PISMVector2 const *const *xg, PISMVector2 *x) const |
| Extract vector degrees of freedom for the element specified previously with FEDOFMap::reset. | |
| virtual void | reset (PetscInt i, PetscInt j, const IceGrid &g) |
| Initialize the FEDOFMap to element (i, j) for the purposes of inserting into global residual and Jacobian arrays. | |
| virtual void | markRowInvalid (PetscInt k) |
| Mark that the row corresponding to local degree of freedom k should not be updated when inserting into the global residual or Jacobian arrays. | |
| virtual void | markColInvalid (PetscInt k) |
| Mark that the column corresponding to local degree of freedom k should not be updated when inserting into the global Jacobian arrays. | |
| void | localToGlobal (PetscInt k, PetscInt *i, PetscInt *j) |
| Convert a local degree of freedom index k to a global degree of freedom index (i,j). | |
| virtual void | addLocalResidualBlock (const PISMVector2 *y, PISMVector2 **yg) |
| Add the values of element-local residual contributions y to the global residual vector yg. | |
| virtual void | addLocalResidualBlock (const PetscScalar *y, PetscScalar **yg) |
| virtual PetscErrorCode | addLocalJacobianBlock (const PetscReal *K, Mat J) |
| Add the contributions of an element-local Jacobian to the global Jacobian vector. | |
| virtual PetscErrorCode | setJacobianDiag (PetscInt i, PetscInt j, const PetscReal *K, Mat J) |
| Set a diagonal entry for global degree of freedom (i ,j ) in a Jacobian matrix. | |
Static Public Attributes | |
| static const PetscInt | Nk = 4 |
Protected Attributes | |
| PetscInt | m_i |
| Indices of the current element (for updating residual/Jacobian). | |
| PetscInt | m_j |
| MatStencil | m_row [Nk] |
| Stencils for updating entries of the Jacobian matrix. | |
| MatStencil | m_col [Nk] |
Static Protected Attributes | |
| static const PetscInt | kDofInvalid = PETSC_MIN_INT / 8 |
| Constant for marking invalid row/columns. | |
| static const PetscInt | kIOffset [Nk] = {0,1,1,0} |
| static const PetscInt | kJOffset [Nk] = {0,0,1,1} |
The mapping from global to local degrees of freedom.
Computations of residual and Jacobian entries in the finite element method are done by iterating of the elements and adding the various contributions from each element. To do this, degrees of freedom from the global vector of unknowns must be remapped to element-local degrees of freedom for the purposes of local computation, (and the results added back again to the global residual and Jacobian arrays).
An FEDOFMap mediates the transfer between element-local and global degrees of freedom. In this very concrete implementation, the global degrees of freedom are either scalars (PetscReal's) or vectors (PISMVector2's), one per node in the IceGrid, and the local degrees of freedom on the element are FEDOFMap::Nk (i.e. four) scalars or vectors, one for each vertex of the element.
The FEDOFMap is also (perhaps awkwardly) overloaded to also mediate transfering locally computed contributions to residual and Jacobian matricies to their global counterparts.
See also: FiniteElement/IceGrid background material.
Definition at line 246 of file FETools.hh.
| FEDOFMap | ( | ) | [inline] |
Definition at line 249 of file FETools.hh.
| virtual ~FEDOFMap | ( | ) | [inline, virtual] |
Definition at line 251 of file FETools.hh.
| PetscErrorCode addLocalJacobianBlock | ( | const PetscReal * | K, |
| Mat | J | ||
| ) | [virtual] |
Add the contributions of an element-local Jacobian to the global Jacobian vector.
The element-local Jacobian should be givnen as a row-major array of Nk*Nk values in the scalar case or (2Nk)*(2Nk) values in the vector valued case.
Definition at line 179 of file FETools.cc.
References m_col, m_row, and Nk.
Referenced by SSAFEM_Forward::assemble_DomainNorm_matrix(), and SSAFEM::compute_local_jacobian().
| void addLocalResidualBlock | ( | const PISMVector2 * | y, |
| PISMVector2 ** | yg | ||
| ) | [virtual] |
Add the values of element-local residual contributions y to the global residual vector yg.
The element-local residual should be an array of Nk values.
Definition at line 160 of file FETools.cc.
References kDofInvalid, m_row, and Nk.
Referenced by SSAFEM_Forward::assemble_T_rhs(), SSAFEM_Forward::assemble_TStarA_rhs(), SSAFEM_Forward::assemble_TStarB_rhs(), and SSAFEM::compute_local_function().
| void addLocalResidualBlock | ( | const PetscScalar * | y, |
| PetscScalar ** | yg | ||
| ) | [virtual] |
Definition at line 168 of file FETools.cc.
References kDofInvalid, m_row, and Nk.
| void extractLocalDOFs | ( | PetscInt | i, |
| PetscInt | j, | ||
| PISMVector2 const *const * | xg, | ||
| PISMVector2 * | x | ||
| ) | const [virtual] |
Extract local degrees of freedom for element (i,j) from global vector xg to local vector x (vector-valued DOF version).
Definition at line 93 of file FETools.cc.
| void extractLocalDOFs | ( | PISMVector2 const *const * | xg, |
| PISMVector2 * | x | ||
| ) | const [virtual] |
Extract vector degrees of freedom for the element specified previously with FEDOFMap::reset.
Definition at line 106 of file FETools.cc.
References extractLocalDOFs(), m_i, and m_j.
| void extractLocalDOFs | ( | PetscInt | i, |
| PetscInt | j, | ||
| PetscReal const *const * | xg, | ||
| PetscReal * | x | ||
| ) | const [virtual] |
Extract local degrees of freedom for element (i,j) from global vector xg to local vector x (scalar-valued DOF version).
Definition at line 85 of file FETools.cc.
Referenced by SSAFEM_Forward::assemble_T_rhs(), SSAFEM_Forward::assemble_TStarA_rhs(), SSAFEM_Forward::assemble_TStarB_rhs(), SSAFEM::compute_local_function(), SSAFEM::compute_local_jacobian(), FEQuadrature::computeTrialFunctionValues(), extractLocalDOFs(), and SSAFEM_Forward::rangeIP_core().
Extract scalar degrees of freedom for the element specified previously with FEDOFMap::reset.
Definition at line 100 of file FETools.cc.
References extractLocalDOFs(), m_i, and m_j.
| void localToGlobal | ( | PetscInt | k, |
| PetscInt * | i, | ||
| PetscInt * | j | ||
| ) |
Convert a local degree of freedom index k to a global degree of freedom index (i,j).
Definition at line 112 of file FETools.cc.
References kIOffset, kJOffset, m_i, and m_j.
Referenced by SSAFEM::FixDirichletValues().
| void markColInvalid | ( | PetscInt | k | ) | [virtual] |
Mark that the column corresponding to local degree of freedom k should not be updated when inserting into the global Jacobian arrays.
Definition at line 152 of file FETools.cc.
References kDofInvalid, and m_col.
Referenced by SSAFEM_Forward::assemble_T_rhs(), SSAFEM_Forward::assemble_TStarA_rhs(), and SSAFEM::FixDirichletValues().
| void markRowInvalid | ( | PetscInt | k | ) | [virtual] |
Mark that the row corresponding to local degree of freedom k should not be updated when inserting into the global residual or Jacobian arrays.
Definition at line 145 of file FETools.cc.
References kDofInvalid, and m_row.
Referenced by SSAFEM_Forward::assemble_T_rhs(), SSAFEM_Forward::assemble_TStarA_rhs(), SSAFEM::FixDirichletValues(), and reset().
| void reset | ( | PetscInt | i, |
| PetscInt | j, | ||
| const IceGrid & | g | ||
| ) | [virtual] |
Initialize the FEDOFMap to element (i, j) for the purposes of inserting into global residual and Jacobian arrays.
Definition at line 120 of file FETools.cc.
References m_col, m_i, m_j, m_row, markRowInvalid(), and Nk.
Referenced by SSAFEM_Forward::assemble_DomainNorm_matrix(), SSAFEM_Forward::assemble_T_rhs(), SSAFEM_Forward::assemble_TStarA_rhs(), SSAFEM_Forward::assemble_TStarB_rhs(), SSAFEM::compute_local_function(), and SSAFEM::compute_local_jacobian().
| PetscErrorCode setJacobianDiag | ( | PetscInt | i, |
| PetscInt | j, | ||
| const PetscReal * | K, | ||
| Mat | J | ||
| ) | [virtual] |
Set a diagonal entry for global degree of freedom (i ,j ) in a Jacobian matrix.
This is an unhappy hack for supporting Dirichlet constrained degrees of freedom. In the scalar valued case, K should point to a single value, and in the vector case, it should point to 4 (=2x2) values for the (2x2) block correspoinding to to u-u, u-v, v-u, and v-v interactions at grid point (i, j). Sheesh.
Definition at line 190 of file FETools.cc.
const PetscInt kDofInvalid = PETSC_MIN_INT / 8 [static, protected] |
Constant for marking invalid row/columns.
Definition at line 275 of file FETools.hh.
Referenced by addLocalResidualBlock(), markColInvalid(), and markRowInvalid().
const PetscInt kIOffset = {0,1,1,0} [static, protected] |
Definition at line 276 of file FETools.hh.
Referenced by localToGlobal().
const PetscInt kJOffset = {0,0,1,1} [static, protected] |
Definition at line 277 of file FETools.hh.
Referenced by localToGlobal().
Definition at line 283 of file FETools.hh.
Referenced by addLocalJacobianBlock(), markColInvalid(), and reset().
PetscInt m_i [protected] |
Indices of the current element (for updating residual/Jacobian).
Definition at line 280 of file FETools.hh.
Referenced by extractLocalDOFs(), localToGlobal(), and reset().
PetscInt m_j [protected] |
Definition at line 280 of file FETools.hh.
Referenced by extractLocalDOFs(), localToGlobal(), and reset().
Stencils for updating entries of the Jacobian matrix.
Definition at line 283 of file FETools.hh.
Referenced by addLocalJacobianBlock(), addLocalResidualBlock(), markRowInvalid(), and reset().
const PetscInt Nk = 4 [static] |
Definition at line 272 of file FETools.hh.
Referenced by addLocalJacobianBlock(), addLocalResidualBlock(), and reset().
1.7.3