36 #include "AbstractBoxDomainPdeModifier.hpp"
37 #include "ReplicatableVector.hpp"
38 #include "LinearBasisFunction.hpp"
40 template<
unsigned DIM>
43 bool isNeumannBoundaryCondition,
49 isNeumannBoundaryCondition,
51 mpMeshCuboid(pMeshCuboid),
53 mSetBcsOnBoxBoundary(true)
63 template<
unsigned DIM>
68 template<
unsigned DIM>
74 template<
unsigned DIM>
77 mSetBcsOnBoxBoundary = setBcsOnBoxBoundary;
80 template<
unsigned DIM>
83 return mSetBcsOnBoxBoundary;
86 template<
unsigned DIM>
91 InitialiseCellPdeElementMap(rCellPopulation);
94 template<
unsigned DIM>
105 this->mpFeMesh->ConstructRegularSlabMesh(stepSize, pMeshCuboid->GetWidth(0), pMeshCuboid->GetWidth(1));
108 this->mpFeMesh->ConstructRegularSlabMesh(stepSize, pMeshCuboid->GetWidth(0), pMeshCuboid->GetWidth(1), pMeshCuboid->GetWidth(2));
120 c_vector<double,DIM> centre_of_coarse_mesh = zero_vector<double>(DIM);
121 for (
unsigned i=0; i<this->mpFeMesh->GetNumNodes(); i++)
123 centre_of_coarse_mesh += this->mpFeMesh->GetNode(i)->
rGetLocation();
125 centre_of_coarse_mesh /= this->mpFeMesh->GetNumNodes();
128 this->mpFeMesh->Translate(centre_of_cuboid - centre_of_coarse_mesh);
131 template<
unsigned DIM>
138 cell_iter != rCellPopulation.
End();
142 double solution_at_cell = 0.0;
145 unsigned elem_index = mCellPdeElementMap[*cell_iter];
152 for (
unsigned i=0; i<DIM+1; i++)
155 solution_at_cell += nodal_value * weights(i);
158 cell_iter->GetCellData()->SetItem(this->mDependentVariableName, solution_at_cell);
160 if (this->mOutputGradient)
163 c_vector<double, DIM> solution_gradient = zero_vector<double>(DIM);
166 c_matrix<double, DIM, DIM> jacobian, inverse_jacobian;
168 this->mpFeMesh->GetInverseJacobianForElement(elem_index, jacobian, jacobian_det, inverse_jacobian);
170 c_matrix<double, DIM, DIM+1> grad_phi;
173 for (
unsigned node_index=0; node_index<DIM+1; node_index++)
177 for (
unsigned j=0; j<DIM; j++)
179 solution_gradient(j) += nodal_value* grad_phi(j, node_index);
186 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_x", solution_gradient(0));
189 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_x", solution_gradient(0));
190 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_y", solution_gradient(1));
193 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_x", solution_gradient(0));
194 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_y", solution_gradient(1));
195 cell_iter->GetCellData()->SetItem(this->mDependentVariableName+
"_grad_z", solution_gradient(2));
204 template<
unsigned DIM>
207 mCellPdeElementMap.clear();
211 cell_iter != rCellPopulation.
End();
215 unsigned elem_index = this->mpFeMesh->GetContainingElementIndex(r_position_of_cell);
216 mCellPdeElementMap[*cell_iter] = elem_index;
220 template<
unsigned DIM>
225 cell_iter != rCellPopulation.
End();
229 unsigned elem_index = this->mpFeMesh->GetContainingElementIndexWithInitialGuess(r_position_of_cell, mCellPdeElementMap[*cell_iter]);
230 mCellPdeElementMap[*cell_iter] = elem_index;
234 template<
unsigned DIM>
AbstractBoxDomainPdeModifier(boost::shared_ptr< AbstractLinearPde< DIM, DIM > > pPde=boost::shared_ptr< AbstractLinearPde< DIM, DIM > >(), boost::shared_ptr< AbstractBoundaryCondition< DIM > > pBoundaryCondition=boost::shared_ptr< AbstractBoundaryCondition< DIM > >(), bool isNeumannBoundaryCondition=true, boost::shared_ptr< ChasteCuboid< DIM > > pMeshCuboid=boost::shared_ptr< ChasteCuboid< DIM > >(), double stepSize=1.0, Vec solution=nullptr)
void InitialiseCellPdeElementMap(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
c_vector< double, DIM > & rGetLocation()
boost::shared_ptr< ChasteCuboid< DIM > > mpMeshCuboid
unsigned GetNodeGlobalIndex(unsigned localIndex) const
void UpdateCellPdeElementMap(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
void ConstructRegularSlabMesh(double spaceStep, double width, double height=0, double depth=0)
virtual void SetupSolve(AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory)
virtual ~AbstractBoxDomainPdeModifier()
void OutputSimulationModifierParameters(out_stream &rParamsFile)
static void ComputeTransformedBasisFunctionDerivatives(const ChastePoint< ELEMENT_DIM > &rPoint, const c_matrix< double, ELEMENT_DIM, ELEMENT_DIM > &rInverseJacobian, c_matrix< double, ELEMENT_DIM, ELEMENT_DIM+1 > &rReturnValue)
void OutputSimulationModifierParameters(out_stream &rParamsFile)
virtual c_vector< double, SPACE_DIM > GetLocationOfCellCentre(CellPtr pCell)=0
void SetBcsOnBoxBoundary(bool setBcsOnBoxBoundary)
bool AreBcsSetOnBoxBoundary()
void GenerateFeMesh(boost::shared_ptr< ChasteCuboid< DIM > > pMeshCuboid, double stepSize)
void UpdateCellData(AbstractCellPopulation< DIM, DIM > &rCellPopulation)
c_vector< double, SPACE_DIM+1 > CalculateInterpolationWeights(const ChastePoint< SPACE_DIM > &rTestPoint)
virtual void SetupSolve(AbstractCellPopulation< DIM, DIM > &rCellPopulation, std::string outputDirectory)