36 #ifndef CONTINUUMMECHANICSNEUMANNBCSASSEMBLER_HPP_ 37 #define CONTINUUMMECHANICSNEUMANNBCSASSEMBLER_HPP_ 39 #include "AbstractFeAssemblerInterface.hpp" 40 #include "AbstractTetrahedralMesh.hpp" 41 #include "QuadraticMesh.hpp" 42 #include "DistributedQuadraticMesh.hpp" 43 #include "LinearBasisFunction.hpp" 44 #include "QuadraticBasisFunction.hpp" 45 #include "ReplicatableVector.hpp" 46 #include "DistributedVector.hpp" 48 #include "PetscVecTools.hpp" 49 #include "PetscMatTools.hpp" 50 #include "GaussianQuadratureRule.hpp" 51 #include "ContinuumMechanicsProblemDefinition.hpp" 69 template<
unsigned DIM>
114 c_vector<double, STENCIL_SIZE>& rBElem,
115 unsigned boundaryConditionIndex);
126 mpProblemDefinition(pProblemDefinition)
129 assert(pProblemDefinition);
135 if ((p_quad_mesh == NULL) && (p_distributed_quad_mesh == NULL))
137 EXCEPTION(
"Continuum mechanics solvers require a quadratic mesh");
154 template<
unsigned DIM>
159 EXCEPTION(
"Vector to be assembled has not been set");
176 c_vector<double, STENCIL_SIZE> b_elem = zero_vector<double>(
STENCIL_SIZE);
178 for (
unsigned bc_index=0; bc_index<
mpProblemDefinition->rGetTractionBoundaryElements().size(); bc_index++)
186 for (
unsigned j=0; j<DIM; j++)
188 p_indices[DIM*i+j] = (DIM+1)*r_boundary_element.GetNodeGlobalIndex(i) + j;
193 for (
unsigned i=0; i<DIM ; i++)
195 p_indices[DIM*NUM_NODES_PER_ELEMENT + i] = (DIM+1)*r_boundary_element.GetNodeGlobalIndex(i)+DIM;
198 PetscVecTools::AddMultipleValues<STENCIL_SIZE>(this->
mVectorToAssemble, p_indices, b_elem);
203 template<
unsigned DIM>
205 c_vector<double,STENCIL_SIZE>& rBelem,
206 unsigned boundaryConditionIndex)
210 c_vector<double, DIM> weighted_direction;
211 double jacobian_determinant;
214 c_vector<double,NUM_NODES_PER_ELEMENT> phi;
222 c_vector<double,DIM> traction = zero_vector<double>(DIM);
225 case ELEMENTWISE_TRACTION:
237 unsigned spatial_dim = index%DIM;
238 unsigned node_index = (index-spatial_dim)/DIM;
242 rBelem(index) += traction(spatial_dim) * phi(node_index) * wJ;
248 #endif // CONTINUUMMECHANICSNEUMANNBCSASSEMBLER_HPP_ void AssembleOnBoundaryElement(BoundaryElement< DIM-1, DIM > &rElement, c_vector< double, STENCIL_SIZE > &rBElem, unsigned boundaryConditionIndex)
bool mZeroVectorBeforeAssembly
static const unsigned PRESSURE_BLOCK_SIZE_ELEMENTAL
GaussianQuadratureRule< DIM-1 > * mpQuadRule
#define EXCEPTION(message)
virtual unsigned GetNumNodes() const
unsigned GetNumQuadPoints() const
AbstractTetrahedralMesh< DIM, DIM > * mpMesh
static const unsigned STENCIL_SIZE
virtual void GetWeightedDirectionForBoundaryElement(unsigned elementIndex, c_vector< double, SPACE_DIM > &rWeightedDirection, double &rJacobianDeterminant) const
static void ComputeBasisFunctions(const ChastePoint< ELEMENT_DIM > &rPoint, c_vector< double,(ELEMENT_DIM+1)*(ELEMENT_DIM+2)/2 > &rReturnValue)
virtual ~ContinuumMechanicsNeumannBcsAssembler()
static const unsigned NUM_VERTICES_PER_ELEMENT
ContinuumMechanicsNeumannBcsAssembler(AbstractTetrahedralMesh< DIM, DIM > *pMesh, ContinuumMechanicsProblemDefinition< DIM > *pProblemDefinition)
unsigned GetIndex() const
double GetWeight(unsigned index) const
static const unsigned NUM_NODES_PER_ELEMENT
ContinuumMechanicsProblemDefinition< DIM > * mpProblemDefinition
const ChastePoint< ELEMENT_DIM > & rGetQuadPoint(unsigned index) const
static const unsigned SPATIAL_BLOCK_SIZE_ELEMENTAL