Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FitzhughNagumo.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File FitzhughNagumo.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: FitzhughNagumo phenomological cell model.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <iostream>
37 #include <string>
38 
41 
42 namespace Nektar
43 {
44  /**
45  * Registers the class with the Factory.
46  */
49  "FitzHughNagumo",
51  "Phenomological model of squid nerve cell.");
52 
55  const MultiRegions::ExpListSharedPtr& pField)
56  : CellModel(pSession, pField)
57  {
58  pSession->LoadParameter("beta", m_beta, 0.0);
59  pSession->LoadParameter("epsilon", m_epsilon, 1.0);
60 
61  m_uuu = Array<OneD, NekDouble>(m_nq, 0.0);
62 
63  m_nvar = 2;
64  m_concentrations.push_back(1);
65  }
66 
67 
69  const Array<OneD, const Array<OneD, NekDouble> >&inarray,
70  Array<OneD, Array<OneD, NekDouble> >&outarray,
71  const NekDouble time)
72  {
73  NekDouble m_gamma = 0.5;
74 
75  // compute u^2: m_u = u*u
76  Vmath::Vmul(m_nq, &inarray[0][0], 1, &inarray[0][0], 1, &m_uuu[0], 1);
77 
78  // compute u^3: m_u = u*u*u
79  Vmath::Vmul(m_nq, &inarray[0][0], 1, &m_uuu[0], 1, &m_uuu[0], 1);
80 
81  // For u: (1/m_epsilon)*( u*-u*u*u/3 - v )
82  // physfield = u - (1.0/3.0)*u*u*u
83  Vmath::Svtvp(m_nq, (-1.0/3.0), &m_uuu[0], 1, &inarray[0][0], 1, &outarray[0][0], 1);
84 
85  Vmath::Vsub(m_nq, &inarray[1][0], 1, &outarray[0][0], 1, &outarray[0][0], 1);
86  Vmath::Smul(m_nq, -1.0/m_epsilon, &outarray[0][0], 1, &outarray[0][0], 1);
87 
88  // For v: m_epsilon*( u + m_beta - m_gamma*v )
89  Vmath::Svtvp(m_nq, -1.0*m_gamma, &inarray[1][0], 1, &inarray[0][0], 1, &outarray[1][0], 1);
90  Vmath::Sadd(m_nq, m_beta, &outarray[1][0], 1, &outarray[1][0], 1);
91  Vmath::Smul(m_nq, m_epsilon, &outarray[1][0], 1, &outarray[1][0], 1);
92  }
93 
94  /**
95  *
96  */
98  {
99  SolverUtils::AddSummaryItem(s, "Cell model","FitzHugh-Nagumo");
100  SolverUtils::AddSummaryItem(s, "Cell model beta", m_beta);
101  }
102 
103 
104  /**
105  *
106  */
108  {
109  Vmath::Fill(m_nq, 0.0, m_cellSol[0], 1);
110  Vmath::Fill(m_nq, 0.0, m_cellSol[1], 1);
111  }
112 
113 }