Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

elasticityJac.C File Reference

#include "petscmat.h"
#include "omg.h"
#include "oda.h"
#include "odaUtils.h"
#include "elasticityJac.h"

Go to the source code of this file.

Defines

#define BUILD_FULL_ELASTICITY_BLOCK
#define BUILD_FULL_ELASTICITY_ELEM_ADD_BLOCK
#define BUILD_FULL_ELASTICITY_ELEM_INSERT_BLOCK
#define ELASTICITY_DIAG_BLOCK
#define ELASTICITY_ELEM_DIAG_BLOCK
#define ELASTICITY_ELEM_MULT_BLOCK
#define ELASTICITY_MULT_BLOCK

Functions

PetscErrorCode ComputeElasticityMat (ot::DAMG damg, Mat J, Mat B)
void computeInvBlockDiagEntriesForElasticityMat (Mat J, double **invBlockDiagEntries)
PetscErrorCode CreateElasticityMat (ot::DAMG damg, Mat *jac)
void DestroyElasticityContexts (ot::DAMG *damg)
PetscErrorCode ElasticityMatDestroy (Mat J)
PetscErrorCode ElasticityMatGetDiagonal (Mat J, Vec diag)
PetscErrorCode ElasticityMatMult (Mat J, Vec in, Vec out)
PetscErrorCode ElasticityShellMatMult (Mat J, Vec in, Vec out)
void getActiveStateAndActiveCommForKSP_Shell_Elas (Mat mat, bool &activeState, MPI_Comm &activeComm)
void getDofAndNodeSizeForElasticityMat (Mat J, unsigned int &dof, unsigned int &nodeSize)
void getPrivateMatricesForKSP_Shell_Elas (Mat mat, Mat *AmatPrivate, Mat *PmatPrivate, MatStructure *pFlag)
void SetElasticityContexts (ot::DAMG *damg)

Variables

double **** GradDivType2Stencil
double **** LaplacianType2Stencil


Detailed Description

Author:
Rahul Sampath, rahul.sampath@gmail.com

Definition in file elasticityJac.C.


Define Documentation

#define BUILD_FULL_ELASTICITY_BLOCK
 

Definition at line 321 of file elasticityJac.C.

Referenced by ComputeElasticityMat().

#define BUILD_FULL_ELASTICITY_ELEM_ADD_BLOCK
 

Definition at line 241 of file elasticityJac.C.

#define BUILD_FULL_ELASTICITY_ELEM_INSERT_BLOCK
 

Value:

{\
  unsigned int idx = da->curr();\
  unsigned int lev = da->getLevel(idx);\
  double h = hFac*(1u << (maxD - lev));\
  double fac = h/2.0;\
  unsigned int indices[8];\
  da->getNodeIndices(indices);\
  unsigned char childNum = da->getChildNumber();\
  unsigned char hnMask = da->getHangingNodeIndex(idx);\
  unsigned char elemType = 0;\
  GET_ETYPE_BLOCK(elemType,hnMask,childNum)\
  for(int k = 0;k < 8;k++) {\
    /*Insert values for Dirichlet Node Rows only.*/\
    if(bdyArr[indices[k]]) {\
      for(int dof = 0; dof < 3; dof++) {\
        ot::MatRecord currRec;\
        currRec.rowIdx = indices[k];\
        currRec.colIdx = indices[k];\
        currRec.rowDim = dof;\
        currRec.colDim = dof;\
        currRec.val = 1.0;\
        records.push_back(currRec);\
      } /*end for dof*/\
    }\
  } /*end for k*/\
  if(records.size() > 1000) {\
    /*records will be cleared inside the function*/\
    da->setValuesInMatrix(B, records, 3, INSERT_VALUES);\
  }\
}

Definition at line 290 of file elasticityJac.C.

#define ELASTICITY_DIAG_BLOCK
 

Value:

{\
  ot::DA* da = damg->da;\
  ElasticityData* data = (static_cast<ElasticityData*>(damg->user));\
  iC(VecZeroEntries(diag));\
  PetscScalar *diagArr = NULL;\
  unsigned char* bdyArr = data->bdyArr;\
  double mu = data->mu;\
  double lambda = data->lambda;\
  unsigned int maxD;\
  double hFac;\
  /*Nodal,Non-Ghosted,Write,3 dof*/\
  da->vecGetBuffer(diag,diagArr,false,false,false,3);\
  if(da->iAmActive()) {\
    maxD = (da->getMaxDepth());\
    hFac = 1.0/((double)(1u << (maxD-1)));\
    /*Loop through All Elements including ghosted*/\
    for(da->init<ot::DA_FLAGS::ALL>();\
        da->curr() < da->end<ot::DA_FLAGS::ALL>();\
        da->next<ot::DA_FLAGS::ALL>()) {\
 ELASTICITY_ELEM_DIAG_BLOCK \
    } /*end i*/\
  } /*end if active*/\
  da->vecRestoreBuffer(diag,diagArr,false,false,false,3);\
  /*2 IOP = 1 FLOP. Loop counters are included too.*/\
  PetscLogFlops(235*(da->getGhostedElementSize()));\
}

Definition at line 75 of file elasticityJac.C.

Referenced by ElasticityMatGetDiagonal().

#define ELASTICITY_ELEM_DIAG_BLOCK
 

Value:

{\
  unsigned int idx = da->curr();\
  unsigned int lev = da->getLevel(idx);\
  double h = hFac*(1u << (maxD - lev));\
  double fac = h/2.0;\
  unsigned int indices[8];\
  da->getNodeIndices(indices);\
  unsigned char childNum = da->getChildNumber();\
  unsigned char hnMask = da->getHangingNodeIndex(idx);\
  unsigned char elemType = 0;\
  GET_ETYPE_BLOCK(elemType,hnMask,childNum)\
  for(int k = 0; k < 8; k++) {\
    if(bdyArr[indices[k]]) {\
      /*Dirichlet Node*/\
      for(int dof = 0; dof < 3; dof++) {\
        diagArr[(3*indices[k])+dof] = 1.0;\
      } /*end dof*/\
    } else { \
      for(int dof = 0; dof < 3; dof++) {\
        diagArr[(3*indices[k])+dof] += (fac*(\
              (mu*LaplacianType2Stencil[childNum][elemType][k][k])\
              + ((mu+lambda)*GradDivType2Stencil[childNum][elemType][(3*k) + dof][(3*k) + dof])));\
      } /*end dof*/\
    }\
  } /*end k*/\
}

Definition at line 48 of file elasticityJac.C.

#define ELASTICITY_ELEM_MULT_BLOCK
 

Definition at line 130 of file elasticityJac.C.

#define ELASTICITY_MULT_BLOCK
 

Definition at line 168 of file elasticityJac.C.

Referenced by ElasticityMatMult().


Function Documentation

PetscErrorCode ComputeElasticityMat ot::DAMG  damg,
Mat  J,
Mat  B
 

Definition at line 360 of file elasticityJac.C.

References BUILD_FULL_ELASTICITY_BLOCK, ot::DAMG, ElasticityData::Jmat_private, and ot::_p_DAMG::user.

Referenced by main().

void computeInvBlockDiagEntriesForElasticityMat Mat  J,
double **  invBlockDiagEntries
 

Definition at line 661 of file elasticityJac.C.

References ElasticityData::bdyArr, ot::DA::createVector(), ot::DA::curr(), ot::DAMG, ot::DA::end(), GET_ETYPE_BLOCK, ot::DA::getChildNumber(), ot::DA::getHangingNodeIndex(), ot::DA::getLevel(), ot::DA::getMaxDepth(), ot::DA::getNodeIndices(), ot::DA::getNodeSize(), GradDivType2Stencil, ot::DA::iAmActive(), ot::DA::init(), ElasticityData::lambda, LaplacianType2Stencil, ElasticityData::mu, ot::DA::next(), ot::DA::vecGetBuffer(), and ot::DA::vecRestoreBuffer().

PetscErrorCode CreateElasticityMat ot::DAMG  damg,
Mat *  jac
 

Definition at line 541 of file elasticityJac.C.

References ot::_p_DAMG::comm, ot::DA::computedLocalToGlobal(), ot::DA::computeLocalToGlobalMappings(), ot::DA::createActiveMatrix(), ot::DA::createMatrix(), ot::_p_DAMG::da, ot::DAMG, ElasticityMatDestroy(), ElasticityMatGetDiagonal(), ElasticityMatMult(), ElasticityShellMatMult(), ot::DA::getComm(), ot::DA::getCommActive(), ot::DA::getNodeSize(), ot::DA::getNpesActive(), ot::DA::getNpesAll(), ot::DA::iAmActive(), ElasticityData::inTmp, ElasticityData::Jmat_private, ot::_p_DAMG::nlevels, ElasticityData::outTmp, ot::_p_DAMG::totalLevels, and ot::_p_DAMG::user.

Referenced by main().

void DestroyElasticityContexts ot::DAMG damg  ) 
 

Definition at line 485 of file elasticityJac.C.

References ElasticityData::bdyArr, ot::DAMG, ElasticityData::inTmp, ElasticityData::Jmat_private, ot::_p_DAMG::nlevels, ElasticityData::outTmp, and ot::_p_DAMG::user.

Referenced by main().

PetscErrorCode ElasticityMatDestroy Mat  J  ) 
 

Definition at line 653 of file elasticityJac.C.

Referenced by CreateElasticityMat().

PetscErrorCode ElasticityMatGetDiagonal Mat  J,
Vec  diag
 

Definition at line 102 of file elasticityJac.C.

References ot::DAMG, ELASTICITY_DIAG_BLOCK, and iC.

Referenced by CreateElasticityMat().

PetscErrorCode ElasticityMatMult Mat  J,
Vec  in,
Vec  out
 

Definition at line 212 of file elasticityJac.C.

References ot::DAMG, ELASTICITY_MULT_BLOCK, and iC.

Referenced by CreateElasticityMat().

PetscErrorCode ElasticityShellMatMult Mat  J,
Vec  in,
Vec  out
 

Definition at line 510 of file elasticityJac.C.

References ot::DAMG, iC, ElasticityData::inTmp, ElasticityData::Jmat_private, and ElasticityData::outTmp.

Referenced by CreateElasticityMat().

void getActiveStateAndActiveCommForKSP_Shell_Elas Mat  mat,
bool &  activeState,
MPI_Comm &  activeComm
 

Definition at line 23 of file elasticityJac.C.

References ot::DAMG, ot::DA::getCommActive(), and ot::DA::iAmActive().

void getDofAndNodeSizeForElasticityMat Mat  J,
unsigned int &  dof,
unsigned int &  nodeSize
 

Definition at line 771 of file elasticityJac.C.

References ot::DAMG, and ot::DA::getNodeSize().

void getPrivateMatricesForKSP_Shell_Elas Mat  mat,
Mat *  AmatPrivate,
Mat *  PmatPrivate,
MatStructure *  pFlag
 

Definition at line 35 of file elasticityJac.C.

References ot::DAMG, and ElasticityData::Jmat_private.

void SetElasticityContexts ot::DAMG damg  ) 
 

Definition at line 396 of file elasticityJac.C.

References ot::assignBoundaryFlags(), ElasticityData::bdyArr, ot::DA::curr(), ot::_p_DAMG::da, ot::_p_DAMG::da_aux, ot::DAMG, ot::DA::end(), ot::DA::getNodeIndices(), ot::DA::iAmActive(), ot::DA::init(), ElasticityData::inTmp, ElasticityData::Jmat_private, ElasticityData::lambda, ElasticityData::mu, ot::DA::next(), ot::_p_DAMG::nlevels, ElasticityData::outTmp, ot::_p_DAMG::suppressedDOF, and ot::_p_DAMG::suppressedDOFaux.

Referenced by main().


Variable Documentation

double**** GradDivType2Stencil
 

Definition at line 71 of file elasticitySolver.C.

Referenced by computeInvBlockDiagEntriesForElasticityMat(), and main().

double**** LaplacianType2Stencil
 

Definition at line 43 of file checkError.C.

Referenced by ComputeDirichletJacobian(), ComputeDirichletLaplacian(), computeInvBlockDiagEntriesForElasticityMat(), CreateAndComputeFullActiveJacobian1(), CreateAndComputeFullJacobian1(), DirichletJacobianMatGetDiagonal(), DirichletJacobianMatMult(), DirichletLaplacianMatGetDiagonal(), DirichletLaplacianMatMult(), Jacobian1MatGetDiagonal(), main(), solve_neumann(), solve_neumann_oct(), TmpDirichletJacobianMatMult(), and TmpDirichletLaplacianMatMult().


Generated on Tue Mar 24 16:14:08 2009 for DENDRO by  doxygen 1.3.9.1