Chaste Release::3.1
AdaptiveBidomainProblem Class Reference

#include <AdaptiveBidomainProblem.hpp>

Inheritance diagram for AdaptiveBidomainProblem:
Collaboration diagram for AdaptiveBidomainProblem:

List of all members.

Public Member Functions

 AdaptiveBidomainProblem (AbstractCardiacCellFactory< 3 > *pCellFactory, bool hasBath=false)
 ~AdaptiveBidomainProblem ()
void DoNotAdaptMesh ()
void AddCurrentSolutionToAdaptiveMesh (Vec solution)
void InitializeSolutionOnAdaptedMesh (VtkMeshReader< 3, 3 > *reader)
void AdaptMesh ()
double GetTargetError ()
double GetSigma ()
double GetMaxEdgeLength ()
double GetMinEdgeLength ()
double GetGradation ()
unsigned GetMaxMeshNodes ()
unsigned GetNumAdaptSweeps ()
void UseNeumannBoundaryCondition (unsigned index=0)
void SetNeumannStimulusMagnitudeAndDuration (double magnitude, double duration, double period=DBL_MAX)
void SetupNeumannBoundaryConditionOnMesh ()
void LoadSimulationFromVtuFile ()
void Solve ()

Private Attributes

BidomainSolver< 3, 3 > * mpSolver
AdaptiveTetrahedralMeshmpAdaptiveMesh
bool mIsMeshAdapting
bool mInitializeFromVtu
bool mUseNeumannBoundaryConditions
double mNeumannStimulusIndex
double mNeumannStimulusLowerValue
double mNeumannStimulusUpperValue
double mNeumannStimulusMagnitude
double mNeumannStimulusDuration
double mNeumannStimulusPeriod
AbstractStimulusFunctionmpNeumannStimulus
StimulusBoundaryCondition< 3 > * mpNeumannStimulusBoundaryCondition
std::string mOutputDirectory
std::string mOutputFilenamePrefix

Friends

class TestAdaptiveBidomainProblem
class TestAdaptiveBidomainProblemNightly

Detailed Description

Class which specifies and solves a bidomain problem using adaptivity.

The solution vector is of the form: (V_1, phi_1, V_2, phi_2, ......, V_N, phi_N), where V_j is the voltage at node j and phi_j is the extracellular potential at node j

Adaptivity occurs at each printing time step (to avoid having to add a variable to the XML schema at this stage): this will need tidying up at some point in the future

Definition at line 94 of file AdaptiveBidomainProblem.hpp.


Constructor & Destructor Documentation

AdaptiveBidomainProblem::AdaptiveBidomainProblem ( AbstractCardiacCellFactory< 3 > *  pCellFactory,
bool  hasBath = false 
)

Constructor

Parameters:
pCellFactoryUser defined cell factory which shows how the tissue should create cells.
hasBathWhether the simulation has a bath (if this is true, all elements with attribute = 1 will be set to be bath elements (the rest should have attribute = 0)).

Definition at line 61 of file AdaptiveBidomainProblem.cpp.

References BidomainProblem< 3 >::mFixedExtracellularPotentialNodes, and mpAdaptiveMesh.

AdaptiveBidomainProblem::~AdaptiveBidomainProblem ( )

Destructor

Definition at line 80 of file AdaptiveBidomainProblem.cpp.

References mpAdaptiveMesh.


Member Function Documentation

void AdaptiveBidomainProblem::AddCurrentSolutionToAdaptiveMesh ( Vec  solution)

Add the values of all state variables into the adaptive mesh (as VTK node point data) so that they can (a) be used to drive mesh adaption; and/or (b) be interpolated onto the new mesh nodes.

Parameters:
solutionThe current solution vector

Definition at line 96 of file AdaptiveBidomainProblem.cpp.

References AdaptiveTetrahedralMesh::AddPointData(), GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), AbstractCardiacTissue< ELEMENT_DIM, SPACE_DIM >::GetCardiacCell(), AbstractCardiacCellInterface::GetVoltageIndex(), mpAdaptiveMesh, BidomainProblem< 3 >::mpBidomainTissue, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, and AbstractCardiacCellInterface::rGetStateVariableNames().

Referenced by Solve().

void AdaptiveBidomainProblem::DoNotAdaptMesh ( )

Method to stop any further adapts taking place

Definition at line 85 of file AdaptiveBidomainProblem.cpp.

References mIsMeshAdapting.

double AdaptiveBidomainProblem::GetGradation ( )

Return value of mGradation

Definition at line 301 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetGradationForAdaptivity(), and HeartConfig::Instance().

double AdaptiveBidomainProblem::GetMaxEdgeLength ( )

Return value of mMaxEdgeLength

Definition at line 291 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetMaxEdgeLengthForAdaptivity(), and HeartConfig::Instance().

unsigned AdaptiveBidomainProblem::GetMaxMeshNodes ( )

Return value of mMaxMeshNodes

Definition at line 306 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetMaxNodesForAdaptivity(), and HeartConfig::Instance().

double AdaptiveBidomainProblem::GetMinEdgeLength ( )

Return value of mMinEdgeLength

Definition at line 296 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetMinEdgeLengthForAdaptivity(), and HeartConfig::Instance().

unsigned AdaptiveBidomainProblem::GetNumAdaptSweeps ( )

Return value of mNumAdaptSweeps

Definition at line 311 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetNumberOfAdaptiveSweeps(), and HeartConfig::Instance().

double AdaptiveBidomainProblem::GetSigma ( )

Return value of mSigma

Definition at line 286 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetSigmaForAdaptivity(), and HeartConfig::Instance().

double AdaptiveBidomainProblem::GetTargetError ( )

Return value of mError

Definition at line 281 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::GetTargetErrorForAdaptivity(), and HeartConfig::Instance().

void AdaptiveBidomainProblem::LoadSimulationFromVtuFile ( )

Restore a simulation previously saved as a .vtu file. Generates mesh and initial conditions (on V, phi and ODE state variables).

Location of .vtu file is assumed to have been set by HeartConfig::SetMesh(). The alternative (constructing its own mesh) doesn't make much sense since the .vtu file must contain a mesh in order to store the variable values at each point of it.

Definition at line 352 of file AdaptiveBidomainProblem.cpp.

References AbstractCardiacProblem< DIM, DIM, 2 >::Initialise(), and mInitializeFromVtu.

void AdaptiveBidomainProblem::SetNeumannStimulusMagnitudeAndDuration ( double  magnitude,
double  duration,
double  period = DBL_MAX 
)

Initialize magnitude and duration of a Neumann stimulus (must have called UseNeumannBoundaryConditions() or UseNeumannBoundaryConditions( true ) for this to have any effect)

Parameters:
magnitudeValue of mNeumannStimulusMagnitude
durationValue of mNeumannStimulusDuration
periodOptional parameter used to specify after how long a regular stimulus is repeated

Definition at line 268 of file AdaptiveBidomainProblem.cpp.

References HeartConfig::Instance(), mNeumannStimulusDuration, mNeumannStimulusMagnitude, and mNeumannStimulusPeriod.

void AdaptiveBidomainProblem::SetupNeumannBoundaryConditionOnMesh ( )

Create a new boundary conditions container to handle the specified Neumann boundary conditions on the mesh. Needs to be called every time a new mesh is constructed (i.e. after every successful adapt)

Todo:
remove magic number? (#1884)

Definition at line 316 of file AdaptiveBidomainProblem.cpp.

References mNeumannStimulusIndex, mNeumannStimulusLowerValue, mNeumannStimulusUpperValue, AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, mpNeumannStimulus, and mpNeumannStimulusBoundaryCondition.

Referenced by AdaptMesh(), and Solve().

void AdaptiveBidomainProblem::Solve ( )

Performs some checks by calling the PreSolveChecks method, creates a solver to which it passes the boundary conditions specified by the user (otherwise it passes the defauls bcc), then at each printing step calls the AdaptMesh method and the Solve method in the solver class to solve the system up until the next printing time step (for the moment, printing time steps and adapt time steps are synonymous)

Also outputs VTK files that record the solution (and the mesh) at each printing time step

Reimplemented from AbstractCardiacProblem< DIM, DIM, 2 >.

Definition at line 358 of file AdaptiveBidomainProblem.cpp.

References AdaptMesh(), AddCurrentSolutionToAdaptiveMesh(), TimeStepper::AdvanceOneTimeStep(), GenericEventHandler< 16, HeartEventHandler >::BeginEvent(), AdaptiveTetrahedralMesh::CalculateSENListAndSids(), AbstractCardiacProblem< DIM, DIM, 2 >::CloseFilesAndPostProcess(), AdaptiveTetrahedralMesh::ConstructFromMesh(), AdaptiveTetrahedralMesh::ConstructFromVtuFile(), BidomainProblem< 3 >::CreateInitialCondition(), PetscTools::Destroy(), GenericEventHandler< 16, HeartEventHandler >::EndEvent(), TimeStepper::GetNextTime(), OutputFileHandler::GetOutputDirectoryFullPath(), HeartConfig::GetOutputFilenamePrefix(), TimeStepper::GetTime(), InitializeSolutionOnAdaptedMesh(), HeartConfig::Instance(), TimeStepper::IsTimeAtEnd(), mInitializeFromVtu, mIsMeshAdapting, mNeumannStimulusDuration, mNeumannStimulusIndex, mNeumannStimulusLowerValue, mNeumannStimulusMagnitude, mNeumannStimulusPeriod, mNeumannStimulusUpperValue, mOutputDirectory, mOutputFilenamePrefix, mpAdaptiveMesh, BidomainProblem< 3 >::mpBidomainTissue, AbstractCardiacProblem< DIM, DIM, 2 >::mpBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpDefaultBoundaryConditionsContainer, AbstractCardiacProblem< DIM, DIM, 2 >::mpMesh, mpNeumannStimulus, AbstractCardiacProblem< DIM, DIM, 2 >::mPrintOutput, mpSolver, AbstractCardiacProblem< DIM, DIM, 2 >::mSolution, mUseNeumannBoundaryConditions, AbstractCardiacProblem< DIM, DIM, 2 >::mWriteInfo, BidomainProblem< 3 >::OnEndOfTimestep(), BidomainProblem< 3 >::PreSolveChecks(), ProgressReporter::PrintFinalising(), PetscTools::ReplicateException(), GenericEventHandler< 16, HeartEventHandler >::Reset(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetInitialCondition(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimes(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimeStep(), SetupNeumannBoundaryConditionOnMesh(), AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::Solve(), ProgressReporter::Update(), BidomainProblem< 3 >::WriteInfo(), and AdaptiveTetrahedralMesh::WriteMeshToFile().

void AdaptiveBidomainProblem::UseNeumannBoundaryCondition ( unsigned  index = 0)

Specify that Neumann boundary conditions will be used. Use with caution: not all Neumann boundary conditions lead to a well-posed problem. Best used only on cuboid geometries, when a stimulus is applied to the face x_i=a and the face x_i=b is grounded.

Parameters:
indexThe value i when applying the Neumann BCs to x_i=a and x_i=b (a<b) (default = 0)

Definition at line 275 of file AdaptiveBidomainProblem.cpp.

References mNeumannStimulusIndex, and mUseNeumannBoundaryConditions.


Member Data Documentation

Whether or not we are initializing from a .vtu file

Definition at line 112 of file AdaptiveBidomainProblem.hpp.

Referenced by LoadSimulationFromVtuFile(), and Solve().

Whether the mesh is to be adapted or not

Definition at line 110 of file AdaptiveBidomainProblem.hpp.

Referenced by DoNotAdaptMesh(), and Solve().

Duration of any Neumann stimulus

Definition at line 125 of file AdaptiveBidomainProblem.hpp.

Referenced by SetNeumannStimulusMagnitudeAndDuration(), and Solve().

The value i when applying Neumann boundary conditions to x_i=a and x_i=b (a<b)

Definition at line 117 of file AdaptiveBidomainProblem.hpp.

Referenced by SetupNeumannBoundaryConditionOnMesh(), Solve(), and UseNeumannBoundaryCondition().

The value a when applying Neumann boundary conditions to x_i=a and x_i=b (a<b)

Definition at line 119 of file AdaptiveBidomainProblem.hpp.

Referenced by SetupNeumannBoundaryConditionOnMesh(), and Solve().

Magnitude of any Neumann stimulus

Definition at line 123 of file AdaptiveBidomainProblem.hpp.

Referenced by SetNeumannStimulusMagnitudeAndDuration(), and Solve().

Period of any repeating Neumannn stimulus

Definition at line 127 of file AdaptiveBidomainProblem.hpp.

Referenced by SetNeumannStimulusMagnitudeAndDuration(), and Solve().

The value b when applying Neumann boundary conditions to x_i=a and x_i=b (a<b)

Definition at line 121 of file AdaptiveBidomainProblem.hpp.

Referenced by SetupNeumannBoundaryConditionOnMesh(), and Solve().

Determine whether or not an edge of the mesh is of sufficient quality. Edge is "good" if the error metric associated with it is in the range [ 1 - mGoodEdgeRange , 1 + mGoodEdgeRange ] Proportion of edges that must be deemed "bad" (i.e. not good) before an adapt takes place Directory in which output files should be saved.

Definition at line 143 of file AdaptiveBidomainProblem.hpp.

Referenced by Solve().

Filename prefix for output files

Definition at line 146 of file AdaptiveBidomainProblem.hpp.

Referenced by Solve().

Adaptive tetrahedral mesh: used to interface with adaptivity library

Definition at line 108 of file AdaptiveBidomainProblem.hpp.

Referenced by AdaptiveBidomainProblem(), AdaptMesh(), AddCurrentSolutionToAdaptiveMesh(), Solve(), and ~AdaptiveBidomainProblem().

We need to save the solver that is being used to switch off the electrodes (by adding default boundary conditions to the solver)

Reimplemented from BidomainProblem< 3 >.

Definition at line 105 of file AdaptiveBidomainProblem.hpp.

Referenced by AdaptMesh(), and Solve().

Whether we are applying Neumann bounadry conditions or not (default = false)

Definition at line 115 of file AdaptiveBidomainProblem.hpp.

Referenced by AdaptMesh(), Solve(), and UseNeumannBoundaryCondition().


The documentation for this class was generated from the following files: