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/core/util/LifeChrono.hpp> 59 #include <lifev/electrophysiology/solver/IonicModels/IonicFitzHughNagumo.hpp> 60 #include <lifev/core/LifeV.hpp> 63 using namespace LifeV;
70 #define SolutionTestNorm 456913.59773800277617
76 MPI_Init (&argc, &argv);
77 std::shared_ptr<Epetra_Comm> Comm (
new Epetra_MpiComm (MPI_COMM_WORLD) );
78 if ( Comm->MyPID() == 0 )
80 std::cout <<
"% using MPI" << std::endl;
89 std::cout <<
"Importing parameters list...";
90 Teuchos::ParameterList FHNParameterList = * ( Teuchos::getParametersFromXmlFile (
"FitzHughNagumoParameters.xml" ) );
91 std::cout <<
" Done!" << std::endl;
100 std::cout <<
"Building Constructor for Fitz-Hugh Nagumo Model with parameters ... ";
102 std::cout <<
" Done!" << std::endl;
116 Real TF ( FHNParameterList.get (
"TF", 300.0) );
117 Real dt ( FHNParameterList.get (
"dt", 0.01) );
119 std::cout <<
"Time parameters : " << std::endl;
120 std::cout <<
"TF = " << TF << std::endl;
121 std::cout <<
"dt = " << dt << std::endl;
123 std::string filename =
"test_expeuler.txt";
126 std::ofstream output (filename.c_str() );
131 std::cout <<
"Time loop starts...\n\n\n";
138 valueToTest = EulerExplicit (dt, TF, model, FHNParameterList.get (
"Iapp", 2000.0), output);
142 std::cout <<
"\n...Time loop ends.\n";
143 std::cout <<
"\nElapsed time : " << chrono.diff() << std::endl;
144 std::cout <<
"Solution written on file: " << filename <<
"\n";
155 std::cout << std::setprecision (20) <<
"\nError: " << err <<
"\nSolution norm: " << valueToTest <<
"\n";
158 returnValue = EXIT_FAILURE;
162 returnValue = EXIT_SUCCESS;
164 return ( returnValue );
169 std::vector<Real> unknowns ( model.Size(), 0.0);
170 unknowns.at (0) = 1e-8;
171 unknowns.at (1) = 0.3;
173 std::vector<Real> rhs ( model.Size(), 0.0);
176 std::cout <<
"Computing using Explicit Euler" << std::endl;
182 Real SolutionNorm = unknowns[0];
184 for (
Real t = 0; t < TF; )
191 if ( t > 2.0 && t < 2.1 )
199 model.setAppliedCurrent (Iapp);
200 std::cout <<
"\r " << t <<
" ms. " << std::flush;
205 model.computeRhs ( unknowns, rhs);
206 model.addAppliedCurrent (rhs);
212 unknowns.at (0) = unknowns.at (0) + dt * rhs.at (0);
213 unknowns.at (1) = unknowns.at (1) + dt * rhs.at (1);
219 output << t <<
" " << unknowns.at (0) <<
" " << unknowns.at (1) <<
"\n";
230 SolutionNorm += unknowns[0];
237 #undef SolutionTestNorm
void start()
Start the timer.
int32_type Int
Generic integer data.
void updateInverseJacobian(const UInt &iQuadPt)
Real EulerExplicit(Real &dt, const Real &TF, IonicFitzHughNagumo model, const Real &I, std::ofstream &output)
void showMe()
Display information about the model.
int main(int argc, char **argv)
double Real
Generic real data.
void stop()
Stop the timer.