AdaptiveBidomainProblem Class Reference

#include <AdaptiveBidomainProblem.hpp>

Inherits BidomainProblem< 3 >.

Collaboration diagram for AdaptiveBidomainProblem:
Collaboration graph
[legend]

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 87 of file AdaptiveBidomainProblem.hpp.


Constructor & Destructor Documentation

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

Constructor

Parameters:
pCellFactory User defined cell factory which shows how the tissue should create cells.
hasBath Whether 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 54 of file AdaptiveBidomainProblem.cpp.

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

AdaptiveBidomainProblem::~AdaptiveBidomainProblem (  ) 

Destructor

Definition at line 73 of file AdaptiveBidomainProblem.cpp.

References mpAdaptiveMesh.


Member Function Documentation

void AdaptiveBidomainProblem::AdaptMesh (  ) 
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:
solution The current solution vector

Definition at line 89 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 AbstractUntemplatedParameterisedSystem::rGetStateVariableNames().

Referenced by Solve().

void AdaptiveBidomainProblem::DoNotAdaptMesh (  ) 

Method to stop any further adapts taking place

Definition at line 78 of file AdaptiveBidomainProblem.cpp.

References mIsMeshAdapting.

double AdaptiveBidomainProblem::GetGradation (  ) 

Return value of mGradation

Definition at line 294 of file AdaptiveBidomainProblem.cpp.

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

double AdaptiveBidomainProblem::GetMaxEdgeLength (  ) 

Return value of mMaxEdgeLength

Definition at line 284 of file AdaptiveBidomainProblem.cpp.

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

unsigned AdaptiveBidomainProblem::GetMaxMeshNodes (  ) 

Return value of mMaxMeshNodes

Definition at line 299 of file AdaptiveBidomainProblem.cpp.

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

double AdaptiveBidomainProblem::GetMinEdgeLength (  ) 

Return value of mMinEdgeLength

Definition at line 289 of file AdaptiveBidomainProblem.cpp.

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

unsigned AdaptiveBidomainProblem::GetNumAdaptSweeps (  ) 

Return value of mNumAdaptSweeps

Definition at line 304 of file AdaptiveBidomainProblem.cpp.

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

double AdaptiveBidomainProblem::GetSigma (  ) 

Return value of mSigma

Definition at line 279 of file AdaptiveBidomainProblem.cpp.

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

double AdaptiveBidomainProblem::GetTargetError (  ) 

Return value of mError

Definition at line 274 of file AdaptiveBidomainProblem.cpp.

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

void AdaptiveBidomainProblem::InitializeSolutionOnAdaptedMesh ( VtkMeshReader< 3, 3 > *  reader  ) 
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 345 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:
magnitude Value of mNeumannStimulusMagnitude
duration Value of mNeumannStimulusDuration
period Optional parameter used to specify after how long a regular stimulus is repeated

Definition at line 261 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 309 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 351 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(), 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:
index The value i when applying the Neumann BCs to x_i=a and x_i=b (a<b) (default = 0)

Definition at line 268 of file AdaptiveBidomainProblem.cpp.

References mNeumannStimulusIndex, and mUseNeumannBoundaryConditions.


Member Data Documentation

Whether or not we are initializing from a .vtu file

Definition at line 105 of file AdaptiveBidomainProblem.hpp.

Referenced by LoadSimulationFromVtuFile(), and Solve().

Whether the mesh is to be adapted or not

Definition at line 103 of file AdaptiveBidomainProblem.hpp.

Referenced by DoNotAdaptMesh(), and Solve().

Duration of any Neumann stimulus

Definition at line 118 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 110 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 112 of file AdaptiveBidomainProblem.hpp.

Referenced by SetupNeumannBoundaryConditionOnMesh(), and Solve().

Magnitude of any Neumann stimulus

Definition at line 116 of file AdaptiveBidomainProblem.hpp.

Referenced by SetNeumannStimulusMagnitudeAndDuration(), and Solve().

Period of any repeating Neumannn stimulus

Definition at line 120 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 114 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 136 of file AdaptiveBidomainProblem.hpp.

Referenced by Solve().

Filename prefix for output files

Definition at line 139 of file AdaptiveBidomainProblem.hpp.

Referenced by Solve().

Adaptive tetrahedral mesh: used to interface with adaptivity library

Definition at line 101 of file AdaptiveBidomainProblem.hpp.

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

Neumann stimulus function

Definition at line 122 of file AdaptiveBidomainProblem.hpp.

Referenced by SetupNeumannBoundaryConditionOnMesh(), and Solve().

Neumann boundary condition

Definition at line 124 of file AdaptiveBidomainProblem.hpp.

Referenced by SetupNeumannBoundaryConditionOnMesh().

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 98 of file AdaptiveBidomainProblem.hpp.

Referenced by AdaptMesh(), and Solve().

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

Definition at line 108 of file AdaptiveBidomainProblem.hpp.

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


The documentation for this class was generated from the following files:
Generated on Thu Dec 22 13:01:47 2011 for Chaste by  doxygen 1.6.3