Chaste  Release::2018.1
AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM > Class Template Reference

#include <AbstractDynamicLinearPdeSolver.hpp>

+ Inheritance diagram for AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >:
+ Collaboration diagram for AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >:

Public Member Functions

 AbstractDynamicLinearPdeSolver (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
void SetTimes (double tStart, double tEnd)
 
void SetTimeStep (double dt)
 
void SetInitialCondition (Vec initialCondition)
 
virtual Vec Solve ()
 
void SetMatrixIsNotAssembled ()
 
void SetTimeAdaptivityController (AbstractTimeAdaptivityController *pTimeAdaptivityController)
 
void SetOutputToVtk (bool output)
 
void SetOutputToParallelVtk (bool output)
 
void SetOutputToTxt (bool output)
 
void SetOutputDirectoryAndPrefix (std::string outputDirectory, std::string prefix)
 
void SetPrintingTimestepMultiple (unsigned multiple)
 
- Public Member Functions inherited from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >
 AbstractLinearPdeSolver (AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *pMesh)
 
virtual ~AbstractLinearPdeSolver ()
 
virtual void InitialiseForSolve (Vec initialSolution=nullptr)
 
virtual void PrepareForSetupLinearSystem (Vec currentSolution)
 
virtual void FinaliseLinearSystem (Vec currentSolution)
 
virtual void FollowingSolveLinearSystem (Vec currentSolution)
 
virtual void SetupLinearSystem (Vec currentSolution, bool computeMatrix)=0
 
LinearSystemGetLinearSystem ()
 

Protected Member Functions

void InitialiseHdf5Writer ()
 
void WriteOneStep (double time, Vec solution)
 

Protected Attributes

double mTstart
 
double mTend
 
bool mTimesSet
 
Vec mInitialCondition
 
bool mMatrixIsAssembled
 
bool mMatrixIsConstant
 
double mIdealTimeStep
 
double mLastWorkingTimeStep
 
AbstractTimeAdaptivityControllermpTimeAdaptivityController
 
bool mOutputToVtk
 
bool mOutputToParallelVtk
 
bool mOutputToTxt
 
std::string mOutputDirectory
 
std::string mFilenamePrefix
 
unsigned mPrintingTimestepMultiple
 
Hdf5DataWritermpHdf5Writer
 
std::vector< int > mVariableColumnIds
 
- Protected Attributes inherited from AbstractLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >
LinearSystemmpLinearSystem
 
AbstractTetrahedralMesh
< ELEMENT_DIM, SPACE_DIM > * 
mpMesh
 

Friends

class TestSimpleLinearParabolicSolver
 

Detailed Description

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
class AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >

Abstract class for dynamic linear PDE solves. This class defines the Solve() method. The concrete class should implement the SetupLinearSystem() method (defined in AbstractLinearPdeSolver), based on the PDE being solved and the numerical method.

Definition at line 56 of file AbstractDynamicLinearPdeSolver.hpp.

Constructor & Destructor Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::AbstractDynamicLinearPdeSolver ( AbstractTetrahedralMesh< ELEMENT_DIM, SPACE_DIM > *  pMesh)

Constructor.

Parameters
pMeshthe mesh

Definition at line 262 of file AbstractDynamicLinearPdeSolver.hpp.

Member Function Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::InitialiseHdf5Writer ( )
protected

Create and initialise the HDF5 writer. Called by Solve() if results are to be output.

Note: For now, writing variable names as 'Variable_0' etc; in the future, could allow user to specify units of time and names and units of dependent variables to be passed to the writer using DefineVariable() and DefineUnlimitedDimension()

Definition at line 223 of file AbstractDynamicLinearPdeSolver.hpp.

References EXCEPTION.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetInitialCondition ( Vec  initialCondition)

Set the initial condition.

Note
We do *not* take responsibility for destroying this vector - the caller must do so once the solver is no longer in use.
Parameters
initialConditionthe initial condition

Definition at line 307 of file AbstractDynamicLinearPdeSolver.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetMatrixIsNotAssembled ( )

Tell the solver to assemble the matrix again next timestep.

Definition at line 500 of file AbstractDynamicLinearPdeSolver.hpp.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetOutputDirectoryAndPrefix ( std::string  outputDirectory,
std::string  prefix 
)
Parameters
outputDirectorythe output directory
prefixthe filename prefix

Definition at line 532 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetOutputToParallelVtk ( bool  output)
Parameters
outputwhether to output to parallel VTK (.pvtu) file

Definition at line 520 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetOutputToTxt ( bool  output)
Parameters
outputwhether to output to a .txt format that is readable by Matlab

Definition at line 526 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetOutputToVtk ( bool  output)
Parameters
outputwhether to output to VTK (.vtu) file

Definition at line 514 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetPrintingTimestepMultiple ( unsigned  multiple)
Parameters
multiplethe ratio of the number of actual timesteps to the number of timesteps at which results are output to HDF5 and other files.

Definition at line 539 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimeAdaptivityController ( AbstractTimeAdaptivityController pTimeAdaptivityController)

Set a controller class which alters the dt used.

Parameters
pTimeAdaptivityControllerthe controller

Definition at line 506 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimes ( double  tStart,
double  tEnd 
)

Set the times to solve between.

Parameters
tStartthe start time
tEndthe end time

Definition at line 282 of file AbstractDynamicLinearPdeSolver.hpp.

References EXCEPTION.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::SetTimeStep ( double  dt)

Set (or reset) the timestep to use.

Parameters
dttimestep

Definition at line 296 of file AbstractDynamicLinearPdeSolver.hpp.

References EXCEPTION.

Referenced by CardiacElectroMechanicsProblem< DIM, ELEC_PROB_DIM >::Solve().

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
void AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::WriteOneStep ( double  time,
Vec  solution 
)
protected

Write one timestep of output data to HDF5 file.

Parameters
timethe time
solutionthe solution vector to write

Definition at line 314 of file AbstractDynamicLinearPdeSolver.hpp.

Member Data Documentation

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::string AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mFilenamePrefix
protected

Filename prefix for HDF5 and other files.

Definition at line 116 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
double AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mIdealTimeStep
protected

The timestep to use. This is either the last timestep passed in in SetTimeStep, or the last timestep suggested by the time adaptivity controller.

Definition at line 86 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
Vec AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mInitialCondition
protected

The initial condition vector.

Definition at line 71 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
double AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mLastWorkingTimeStep
protected

The last actual timestep used.

Definition at line 89 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mMatrixIsAssembled
protected

Whether the matrix has been assembled for the current time step.

Definition at line 74 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mMatrixIsConstant
protected

Whether the matrix is constant in time (if so the system need not be assembled at each time step). Defaults to false.

Definition at line 80 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::string AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mOutputDirectory
protected

Output directory (a subfolder of tmp/[USERNAME]/testoutput).

Definition at line 113 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mOutputToParallelVtk
protected

Flag to say if we need to output to VTK parallel (.pvtu). Defaults to false in the constructor.

Definition at line 104 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mOutputToTxt
protected

Flag to say if we need to output to a .txt format that is readable by Matlab. Defaults to false in the constructor.

Definition at line 110 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mOutputToVtk
protected

Flag to say if we need to output to VTK. Defaults to false in the constructor.

Definition at line 98 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
Hdf5DataWriter* AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpHdf5Writer
protected

The object used to write results to HDF5 file.

Definition at line 126 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
unsigned AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mPrintingTimestepMultiple
protected

The ratio of the number of actual timesteps to the number of timesteps at which results are output to HDF5 and other files. Defaults to 1 in the constructor.

Definition at line 123 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
AbstractTimeAdaptivityController* AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mpTimeAdaptivityController
protected

A controller which determines what timestep to use (defaults to NULL).

Definition at line 92 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
double AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mTend
protected

Simulation end time.

Definition at line 65 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
bool AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mTimesSet
protected

Whether SetTimes has been called with suitable parameters.

Definition at line 68 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
double AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mTstart
protected

Simulation start time.

Definition at line 62 of file AbstractDynamicLinearPdeSolver.hpp.

template<unsigned ELEMENT_DIM, unsigned SPACE_DIM, unsigned PROBLEM_DIM>
std::vector<int> AbstractDynamicLinearPdeSolver< ELEMENT_DIM, SPACE_DIM, PROBLEM_DIM >::mVariableColumnIds
protected

List of variable column IDs as written to HDF5 file.

Definition at line 129 of file AbstractDynamicLinearPdeSolver.hpp.


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