SPHinXsys  alpha version
electro_physiology.h
Go to the documentation of this file.
1 /* -------------------------------------------------------------------------*
2  * SPHinXsys *
3  * --------------------------------------------------------------------------*
4  * SPHinXsys (pronunciation: s'finksis) is an acronym from Smoothed Particle *
5  * Hydrodynamics for industrial compleX systems. It provides C++ APIs for *
6  * physical accurate simulation and aims to model coupled industrial dynamic *
7  * systems including fluid, solid, multi-body dynamics and beyond with SPH *
8  * (smoothed particle hydrodynamics), a meshless computational method using *
9  * particle discretization. *
10  * *
11  * SPHinXsys is partially funded by German Research Foundation *
12  * (Deutsche Forschungsgemeinschaft) DFG HU1527/6-1, HU1527/10-1 *
13  * and HU1527/12-1. *
14  * *
15  * Portions copyright (c) 2017-2020 Technical University of Munich and *
16  * the authors' affiliations. *
17  * *
18  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
19  * not use this file except in compliance with the License. You may obtain a *
20  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
21  * *
22  * --------------------------------------------------------------------------*/
30 #ifndef ELECTRO_PHYSIOLOGY_H
31 #define ELECTRO_PHYSIOLOGY_H
32 
34 #include "solid_particles.h"
35 
36 namespace SPH
37 {
39  {
40  protected:
41  Real k_a_;
42  size_t voltage_;
43  size_t gate_variable_;
44  size_t active_contraction_stress_;
45 
46  virtual Real getProductionRateIonicCurrent(StdVec<StdLargeVec<Real>> &species, size_t particle_i) = 0;
47  virtual Real getLossRateIonicCurrent(StdVec<StdLargeVec<Real>> &species, size_t particle_i) = 0;
48  virtual Real getProductionRateGateVariable(StdVec<StdLargeVec<Real>> &species, size_t particle_i) = 0;
49  virtual Real getLossRateGateVariable(StdVec<StdLargeVec<Real>> &species, size_t particle_i) = 0;
50  virtual Real getProductionActiveContractionStress(StdVec<StdLargeVec<Real>> &species, size_t particle_i);
51  virtual Real getLossRateActiveContractionStress(StdVec<StdLargeVec<Real>> &species, size_t particle_i);
52 
53  public:
54  explicit ElectroPhysiologyReaction(Real k_a)
55  : BaseReactionModel({"Voltage", "GateVariable", "ActiveContractionStress"}),
56  k_a_(k_a), voltage_(species_indexes_map_["Voltage"]),
57  gate_variable_(species_indexes_map_["GateVariable"]),
58  active_contraction_stress_(species_indexes_map_["ActiveContractionStress"])
59  {
60  reaction_model_ = "ElectroPhysiologyReaction";
61  initializeElectroPhysiologyReaction();
62  };
63  virtual ~ElectroPhysiologyReaction(){};
64 
65  void initializeElectroPhysiologyReaction();
66  };
67 
75  {
76  protected:
78  Real k_, a_, b_, mu_1_, mu_2_, epsilon_, c_m_;
79 
80  virtual Real getProductionRateIonicCurrent(StdVec<StdLargeVec<Real>> &species, size_t particle_i) override;
81  virtual Real getLossRateIonicCurrent(StdVec<StdLargeVec<Real>> &species, size_t particle_i) override;
82  virtual Real getProductionRateGateVariable(StdVec<StdLargeVec<Real>> &species, size_t particle_i) override;
83  virtual Real getLossRateGateVariable(StdVec<StdLargeVec<Real>> &species, size_t particle_i) override;
84 
85  public:
86  explicit AlievPanfilowModel(Real k_a, Real c_m, Real k, Real a, Real b, Real mu_1, Real mu_2, Real epsilon)
87  : ElectroPhysiologyReaction(k_a), k_(k), a_(a), b_(b), mu_1_(mu_1), mu_2_(mu_2),
88  epsilon_(epsilon), c_m_(c_m)
89  {
90  reaction_model_ = "AlievPanfilowModel";
91  };
92  virtual ~AlievPanfilowModel(){};
93  };
94 
100  {
101  public:
102  explicit MonoFieldElectroPhysiology(ElectroPhysiologyReaction &electro_physiology_reaction,
103  Real diff_cf, Real bias_diff_cf, Vecd bias_direction);
104  virtual ~MonoFieldElectroPhysiology(){};
105  };
106 
112  {
113  public:
114  explicit LocalMonoFieldElectroPhysiology(ElectroPhysiologyReaction &electro_physiology_reaction,
115  Real diff_cf, Real bias_diff_cf, Vecd bias_direction);
116  virtual ~LocalMonoFieldElectroPhysiology(){};
117 
118  virtual void readFromXmlForLocalParameters(const std::string &filefullpath) override;
119  };
120 
126  : public DiffusionReactionParticles<SolidParticles>
127  {
128  public:
129  ElectroPhysiologyParticles(SPHBody &sph_body, DiffusionReaction<Solid> *diffusion_reaction_material);
130  virtual ~ElectroPhysiologyParticles(){};
131  virtual ElectroPhysiologyParticles *ThisObjectPtr() override { return this; };
132  };
138  : public DiffusionReactionParticles<SolidParticles>
139  {
140  public:
142  ElectroPhysiologyReducedParticles(SPHBody &sph_body, DiffusionReaction<Solid> *diffusion_reaction_material);
145  virtual ElectroPhysiologyReducedParticles *ThisObjectPtr() override { return this; };
146 
147  virtual Vecd getKernelGradient(size_t particle_index_i, size_t particle_index_j, Real dW_ij, Vecd &e_ij) override
148  {
149  return dW_ij * e_ij;
150  };
151  };
152 
153  namespace electro_physiology
154  {
155  typedef DiffusionReactionSimpleData<RealBody, SolidParticles, Solid> ElectroPhysiologyDataDelegateSimple;
156  typedef DiffusionReactionInnerData<RealBody, SolidParticles, Solid> ElectroPhysiologyDataDelegateInner;
164  {
165  public:
166  explicit ElectroPhysiologyInitialCondition(RealBody &real_body);
168 
169  protected:
170  StdLargeVec<Vecd> &pos_;
171  StdVec<StdLargeVec<Real>> &species_n_;
172  };
178  : public GetDiffusionTimeStepSize<RealBody, SolidParticles, Solid>
179  {
180  public:
181  explicit GetElectroPhysiologyTimeStepSize(RealBody &real_body)
184  };
191  RelaxationOfAllDiffusionSpeciesInner<RealBody, SolidParticles, Solid>>
192  {
193  public:
195  : RelaxationOfAllDiffusionSpeciesRK2(inner_relation){};
197  };
204  RelaxationOfAllDiffusionSpeciesComplex<RealBody, SolidParticles, Solid, RealBody, SolidParticles, Solid>>
205  {
206  public:
208  : RelaxationOfAllDiffusionSpeciesRK2(complex_relation){};
210  };
217  : public RelaxationOfAllReactionsForward<RealBody, SolidParticles, Solid>
218  {
219  public:
223  };
230  : public RelaxationOfAllReactionsBackward<RealBody, SolidParticles, Solid>
231  {
232  public:
236  };
244  {
245  public:
246  explicit ApplyStimulusCurrents(RealBody &real_body)
247  : ParticleDynamicsSimple(real_body),
249  virtual ~ApplyStimulusCurrents(){};
250  };
251  }
252 }
253 #endif // ELECTRO_PHYSIOLOGY_H
set initial condition for a muscle body This is a abstract class to be override for case specific ini...
Definition: electro_physiology.h:162
Simple particle dynamics without considering particle interaction.
Definition: particle_dynamics_algorithms.h:48
Complex material for diffusion or/and reactions.
Definition: diffusion_reaction.h:195
The simplest Electrophysiology Reaction model, which reduces the complex of array of ion currents to ...
Definition: electro_physiology.h:74
Compute the diffusion relaxation process of all species with second order Runge-Kutta time stepping...
Definition: particle_dynamics_diffusion_reaction.h:204
material class for electro_physiology.
Definition: electro_physiology.h:99
Compute the reaction process of all species by forward splitting.
Definition: particle_dynamics_diffusion_reaction.h:239
material class for electro_physiology with locally oriented fibers.
Definition: electro_physiology.h:111
A group of particles with electrophysiology particle data.
Definition: electro_physiology.h:125
Definition: electro_physiology.h:38
Compute the diffusion relaxation process.
Definition: electro_physiology.h:202
Computing the time step size based on diffusion coefficient and particle smoothing length...
Definition: particle_dynamics_diffusion_reaction.h:83
Computing the time step size from diffusion criteria.
Definition: electro_physiology.h:177
A group of reduced particles with electrophysiology particle data.
Definition: electro_physiology.h:137
virtual ~ElectroPhysiologyReducedParticles()
Definition: electro_physiology.h:144
Base class for all reaction models.
Definition: diffusion_reaction.h:163
Solve the reaction ODE equation of trans-membrane potential using forward sweeping.
Definition: electro_physiology.h:216
ElectroPhysiologyReducedParticles(SPHBody &sph_body, DiffusionReaction< Solid > *diffusion_reaction_material)
Definition: electro_physiology.cpp:99
Compute the diffusion relaxation process.
Definition: electro_physiology.h:189
Compute the reaction process of all species by backward splitting.
Definition: particle_dynamics_diffusion_reaction.h:260
The relation combined an inner and a contact body relation. The interaction is in a inner-boundary-co...
Definition: complex_body_relation.h:42
A group of particles with diffusion or/and reactions particle data.
Definition: diffusion_reaction_particles.h:45
SPHBody is a base body with basic data and functions. Its derived class can be a real fluid body...
Definition: base_body.h:61
virtual Vecd getKernelGradient(size_t particle_index_i, size_t particle_index_j, Real dW_ij, Vecd &e_ij) override
Definition: electro_physiology.h:147
This is the derived class of base particles.
The abstract relation within a SPH body.
Definition: base_body_relation.h:117
Apply specific stimulus currents This is a abstract class to be override for case specific implementa...
Definition: electro_physiology.h:242
prepare data for simple particle dynamics.
Definition: base_particle_dynamics.h:185
Derived body with inner particle configuration or inner interactions. After construction, the particle and material must be specified.
Definition: base_body.h:182
This is the particle dynamics applicable for all type bodies TODO: there is an issue on applying corr...
Definition: solid_body_supplementary.cpp:9
Real k_
Definition: electro_physiology.h:78