39 #pragma GCC diagnostic ignored "-Wunused-variable" 40 #pragma GCC diagnostic ignored "-Wunused-parameter" 42 #include <Epetra_ConfigDefs.h> 45 #include <Epetra_MpiComm.h> 47 #include <Epetra_SerialComm.h> 51 #pragma GCC diagnostic warning "-Wunused-variable" 52 #pragma GCC diagnostic warning "-Wunused-parameter" 57 #include <lifev/electrophysiology/solver/IonicModels/IonicLuoRudyI.hpp> 58 #include <lifev/core/LifeV.hpp> 60 #include <Teuchos_RCP.hpp> 61 #include <Teuchos_ParameterList.hpp> 62 #include "Teuchos_XMLParameterListHelpers.hpp" 64 #define SolutionTestNorm -14029.524312899517099
66 using namespace LifeV;
71 MPI_Init (&argc, &argv);
72 Epetra_MpiComm Comm (MPI_COMM_WORLD);
73 if ( Comm.MyPID() == 0 )
75 std::cout <<
"% using MPI" << std::endl;
83 std::cout <<
"Building Constructor for Luo Rudy I Model with parameters ... ";
84 IonicLuoRudyI ionicModel;
85 std::cout <<
" Done!" << std::endl;
98 std::cout <<
"Initializing solution vector...";
99 std::vector<Real> states (ionicModel.restingConditions() );
100 std::cout <<
" Done!" << std::endl;
110 std::cout <<
"Initializing rhs..." ;
111 std::vector<Real> rhs (ionicModel.Size(), 0);
112 std::cout <<
" Done! " << std::endl;
132 int savestep ( 1. / dt );
139 Real SolutionNorm = states[0];
145 std::string filename =
"output.txt";
146 std::ofstream output (
"output.txt");
148 std::cout <<
"Potential: " << states[0] << std::endl;
152 std::cout <<
"Time loop starts...\n";
153 for (
Real t = 0; t < TF; )
160 if ( t > 3 && t < 5 )
168 std::cout <<
"\r " << t <<
" ms. " << std::flush;
173 ionicModel.setAppliedCurrent (Iapp);
174 ionicModel.computeRhs ( states, rhs);
175 ionicModel.addAppliedCurrent (rhs);
182 states[0] = states[0] + dt * rhs[0];
183 ionicModel.computeGatingVariablesWithRushLarsen ( states, dt);
185 int offset = 1 + ionicModel.numberOfGatingVariables();
186 for (
int j (0); j < ( ionicModel.Size() - offset ); j++)
188 states[j + offset] = states[j + offset] + dt * rhs[j + offset];
194 if ( iter % savestep == 0 )
197 for (
int j (0); j < ionicModel.Size() - 1; j++)
199 output << states[j] <<
", ";
201 output << states.at ( ionicModel.Size() - 1 ) <<
"\n";
207 SolutionNorm = SolutionNorm + states[0];
216 std::cout <<
"\n...Time loop ends.\n";
217 std::cout <<
"Solution written on file: " << filename <<
"\n";
228 std::cout << std::setprecision (20) <<
"\nError: " << err <<
"\nSolution norm: " << SolutionNorm <<
"\n";
231 std::cout <<
"\nTest Failed!\n";
232 returnValue = EXIT_FAILURE;
236 returnValue = EXIT_SUCCESS;
238 return ( returnValue );
241 #undef SolutionTestNorm
int32_type Int
Generic integer data.
void updateInverseJacobian(const UInt &iQuadPt)
int main(int argc, char **argv)
double Real
Generic real data.