36 #ifndef ABSTRACTFESURFACENTEGRALASSEMBLER_HPP_
37 #define ABSTRACTFESURFACENTEGRALASSEMBLER_HPP_
39 #include "AbstractFeAssemblerCommon.hpp"
40 #include "GaussianQuadratureRule.hpp"
41 #include "BoundaryConditionsContainer.hpp"
42 #include "PetscVecTools.hpp"
43 #include "PetscMatTools.hpp"
60 template<
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
91 c_vector<double, ELEMENT_DIM>& rPhi,
97 return zero_vector<double>(ELEMENT_DIM*PROBLEM_DIM);
110 c_vector<double, PROBLEM_DIM*ELEMENT_DIM>& rBSurfElem);
140 assert(pBoundaryConditions);
146 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
152 mpBoundaryConditions(pBoundaryConditions)
155 assert(pBoundaryConditions);
162 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
165 delete mpSurfaceQuadRule;
169 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
172 assert(this->mAssembleVector);
177 if (mpBoundaryConditions->AnyNonZeroNeumannConditions())
180 neumann_iterator = mpBoundaryConditions->BeginNeumann();
182 c_vector<double, PROBLEM_DIM*ELEMENT_DIM> b_surf_elem;
185 while (neumann_iterator != mpBoundaryConditions->
EndNeumann())
187 const BoundaryElement<ELEMENT_DIM-1,SPACE_DIM>& r_surf_element = *(neumann_iterator->first);
188 AssembleOnSurfaceElement(r_surf_element, b_surf_elem);
190 const size_t STENCIL_SIZE=PROBLEM_DIM*ELEMENT_DIM;
191 unsigned p_indices[STENCIL_SIZE];
193 PetscVecTools::AddMultipleValues<STENCIL_SIZE>(this->mVectorToAssemble, p_indices, b_surf_elem);
202 template <
unsigned ELEMENT_DIM,
unsigned SPACE_DIM,
unsigned PROBLEM_DIM>
205 c_vector<double, PROBLEM_DIM*ELEMENT_DIM>& rBSurfElem)
207 c_vector<double, SPACE_DIM> weighted_direction;
208 double jacobian_determinant;
209 mpMesh->GetWeightedDirectionForBoundaryElement(rSurfaceElement.
GetIndex(), weighted_direction, jacobian_determinant);
214 c_vector<double, ELEMENT_DIM> phi;
217 for (
unsigned quad_index=0; quad_index<mpSurfaceQuadRule->GetNumQuadPoints(); quad_index++)
219 const ChastePoint<ELEMENT_DIM-1>& quad_point = mpSurfaceQuadRule->rGetQuadPoint(quad_index);
221 SurfaceBasisFunction::ComputeBasisFunctions(quad_point, phi);
230 this->ResetInterpolatedQuantities();
231 for (
unsigned i=0; i<rSurfaceElement.
GetNumNodes(); i++)
233 const c_vector<double, SPACE_DIM> node_loc = rSurfaceElement.
GetNode(i)->rGetLocation();
237 this->IncrementInterpolatedQuantities(phi(i), rSurfaceElement.
GetNode(i));
245 double wJ = jacobian_determinant * mpSurfaceQuadRule->GetWeight(quad_index);
247 noalias(rBSurfElem) += ComputeVectorSurfaceTerm(rSurfaceElement, phi, x) * wJ;
251 #endif // ABSTRACTFESURFACENTEGRALASSEMBLER_HPP_
virtual void AssembleOnSurfaceElement(const BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > &rSurfaceElement, c_vector< double, PROBLEM_DIM *ELEMENT_DIM > &rBSurfElem)
c_vector< double, DIM > & rGetLocation()
static void BeginEvent(unsigned event)
AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > * mpMesh
std::map< const BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > *, const AbstractBoundaryCondition< SPACE_DIM > * >::const_iterator NeumannMapIterator
Node< SPACE_DIM > * GetNode(unsigned localIndex) const
BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > * mpBoundaryConditions
GaussianQuadratureRule< ELEMENT_DIM-1 > * mpSurfaceQuadRule
LinearBasisFunction< ELEMENT_DIM-1 > SurfaceBasisFunction
unsigned GetNumNodes() const
void GetStiffnessMatrixGlobalIndices(unsigned problemDim, unsigned *pIndices) const
AbstractFeSurfaceIntegralAssembler(AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh, BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > *pBoundaryConditions)
void ResetBoundaryConditionsContainer(BoundaryConditionsContainer< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > *pBoundaryConditions)
unsigned GetIndex() const
virtual ~AbstractFeSurfaceIntegralAssembler()
NeumannMapIterator EndNeumann()
static void EndEvent(unsigned event)
virtual c_vector< double, PROBLEM_DIM *ELEMENT_DIM > ComputeVectorSurfaceTerm(const BoundaryElement< ELEMENT_DIM-1, SPACE_DIM > &rSurfaceElement, c_vector< double, ELEMENT_DIM > &rPhi, ChastePoint< SPACE_DIM > &rX)