50 #pragma GCC diagnostic ignored "-Wunused-variable" 51 #pragma GCC diagnostic ignored "-Wunused-parameter" 53 #include <Epetra_ConfigDefs.h> 56 #include <Epetra_MpiComm.h> 58 #include <Epetra_SerialComm.h> 62 #pragma GCC diagnostic warning "-Wunused-variable" 63 #pragma GCC diagnostic warning "-Wunused-parameter" 66 #include <lifev/electrophysiology/solver/ElectroETAMonodomainSolver.hpp> 69 #include <lifev/electrophysiology/solver/IonicModels/IonicMinimalModel.hpp> 72 #include <lifev/core/LifeV.hpp> 75 #include <lifev/electrophysiology/util/HeartUtility.hpp> 80 using namespace LifeV;
83 #define solutionNorm 48.66815714672445381
90 MPI_Init (&argc, &argv);
91 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
92 if ( Comm->MyPID() == 0 )
94 std::cout <<
"% using MPI" << std::endl;
101 std::string problemFolder = commandLine
.follow ( "Output", 2
, "-o", "--output" );
103 if ( problemFolder.compare (
"./") )
105 problemFolder +=
"/";
107 if ( Comm->MyPID() == 0 )
109 mkdir ( problemFolder.c_str(), 0777 );
117 typedef RegionMesh<LinearTetra> mesh_Type;
119 typedef IonicMinimalModel ionicModel_Type;
121 typedef ElectroETAMonodomainSolver< mesh_Type, ionicModel_Type > monodomainSolver_Type;
123 typedef std::shared_ptr< monodomainSolver_Type > monodomainSolverPtr_Type;
127 typedef std::shared_ptr<vector_Type> vectorPtr_Type;
135 if ( Comm->MyPID() == 0 )
137 std::cout <<
"Importing parameters list...";
139 Teuchos::ParameterList monodomainList = * ( Teuchos::getParametersFromXmlFile (
"MonodomainSolverParamList.xml" ) );
140 if ( Comm->MyPID() == 0 )
142 std::cout <<
" Done!" << std::endl;
151 if ( Comm->MyPID() == 0 )
153 std::cout <<
"Building Constructor for Minimal Model with parameters ... ";
155 std::shared_ptr<ionicModel_Type> model (
new ionicModel_Type() );
156 if ( Comm->MyPID() == 0 )
158 std::cout <<
" Done!" << std::endl;
167 std::string meshName = monodomainList.get (
"mesh_name",
"idealized.mesh");
168 std::string meshPath = monodomainList.get (
"mesh_path",
"./");
180 if ( Comm->MyPID() == 0 )
182 std::cout <<
"Building Monodomain Solvers... ";
185 monodomainSolverPtr_Type monodomain (
new monodomainSolver_Type ( meshName, meshPath, dataFile, model ) );
186 if ( Comm->MyPID() == 0 )
188 std::cout <<
" Splitting solver done... ";
194 monodomain -> setInitialConditions();
195 ElectrophysiologyUtility::setValueOnBoundary ( * (monodomain -> potentialPtr() ), monodomain -> fullMeshPtr(), 1.0, 5 );
201 monodomain -> setParameters ( monodomainList );
206 if ( Comm->MyPID() == 0 )
208 std::cout <<
"\nSetting fibers: " ;
216 monodomain -> setupFibers();
217 std::string fiberFile (monodomainList.get (
"solid_fiber_file",
"") );
218 std::string fiberField (monodomainList.get (
"solid_fiber_field",
"") );
219 ElectrophysiologyUtility::importVectorField (monodomain -> fiberPtr(), fiberFile, fiberField, monodomain -> localMeshPtr() );
221 if ( Comm->MyPID() == 0 )
223 std::cout <<
"Done! \n" ;
229 monodomain -> exportFiberDirection (problemFolder);
234 if ( Comm->MyPID() == 0 )
236 std::cout <<
"\nSetup operators: " ;
238 monodomain -> setupLumpedMassMatrix();
239 monodomain -> setupStiffnessMatrix();
240 monodomain -> setupGlobalMatrix();
241 if ( Comm->MyPID() == 0 )
243 std::cout <<
"Done! \n" ;
249 ExporterHDF5< RegionMesh <LinearTetra> > exporter;
250 monodomain -> setupExporter ( exporter, monodomainList.get (
"OutputFile",
"Solution"), problemFolder );
251 monodomain -> exportSolution ( exporter, 0);
256 if ( Comm->MyPID() == 0 )
258 std::cout <<
"\nstart solving: " ;
261 Real dt = monodomain -> timeStep();
263 Real TF = monodomainList.get (
"endTime", 48.0);
264 Int iter = monodomainList.get (
"saveStep", 1.0) / dt;
270 for (
Real t = monodomain -> initialTime(); t < TF;)
283 monodomain -> solveOneStepGatingVariablesFE();
284 monodomain -> solveOneSVIStep();
289 if (loop % iter == 0 )
291 if ( Comm->MyPID() == 0 )
293 std::cout <<
"\ntime = " << t;
295 exporter.postProcess (t);
303 exporter.closeFile();
309 Real newSolutionNorm = monodomain -> potentialPtr() -> norm2();
312 MPI_Barrier (MPI_COMM_WORLD);
319 std::cout << std::setprecision (20) <<
"\nTest Failed: " << err <<
"\n" <<
"\nSolution Norm: " << newSolutionNorm <<
"\n";
VectorEpetra - The Epetra Vector format Wrapper.
GetPot(const int argc_, char **argv_, const char *FieldSeparator=0x0)
int32_type Int
Generic integer data.
double Real
Generic real data.
int main(int argc, char **argv)
const std::string follow(const char *Default, unsigned No, const char *Option,...)