Chaste  Build::
MechanicalStimulusCalculator.cpp
1 /*
2 
3 Copyright (c) 2005-2016, University of Oxford.
4  All rights reserved.
5 
6  University of Oxford means the Chancellor, Masters and Scholars of the
7  University of Oxford, having an administrative office at Wellington
8  Square, Oxford OX1 2JD, UK.
9 
10  This file is part of Chaste.
11 
12  Redistribution and use in source and binary forms, with or without
13  modification, are permitted provided that the following conditions are met:
14  * Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16  * Redistributions in binary form must reproduce the above copyright notice,
17  this list of conditions and the following disclaimer in the documentation
18  and/or other materials provided with the distribution.
19  * Neither the name of the University of Oxford nor the names of its
20  contributors may be used to endorse or promote products derived from this
21  software without specific prior written permission.
22 
23  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
32  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 
34  */
35 
36 #include "Owen11Parameters.hpp"
37 #include "MechanicalStimulusCalculator.hpp"
38 
39 template<unsigned DIM>
41  mTauRef(1.e-6 * unit::pascals),
42  mTauP(0.05 * unit::pascals),
43  mkp(Owen11Parameters::mpSensitivityToIntravascularPressure->GetValue("MechanicalStimulusCalculator"))
44 {
45 
46 }
47 
48 template<unsigned DIM>
50 {
51 
52 }
53 
54 template <unsigned DIM>
55 boost::shared_ptr<MechanicalStimulusCalculator<DIM> > MechanicalStimulusCalculator<DIM>::Create()
56 {
57  MAKE_PTR(MechanicalStimulusCalculator<DIM>, pSelf);
58  return pSelf;
59 }
60 
61 template<unsigned DIM>
62 units::quantity<unit::pressure> MechanicalStimulusCalculator<DIM>::GetTauP()
63 {
64  return mTauP;
65 }
66 
67 template<unsigned DIM>
68 units::quantity<unit::pressure> MechanicalStimulusCalculator<DIM>::GetTauReference()
69 {
70  return mTauRef;
71 }
72 
73 template<unsigned DIM>
74 void MechanicalStimulusCalculator<DIM>::SetTauRef(units::quantity<unit::pressure> TauRef)
75 {
76  mTauRef = TauRef;
77 }
78 
79 template<unsigned DIM>
80 void MechanicalStimulusCalculator<DIM>::SetTauP(units::quantity<unit::pressure> TauP)
81 {
82  mTauP = TauP;
83 }
84 
85 template<unsigned DIM>
87 {
88  std::vector<boost::shared_ptr<VesselSegment<DIM> > > segments = this->mpNetwork->GetVesselSegments();
89 
90  units::quantity<unit::length> cm(0.01*unit::metres);
91  units::quantity<unit::mass> g(1.e-3*unit::kg);
92  units::quantity<unit::force> dyne(g*cm/(unit::seconds*unit::seconds));
93  units::quantity<unit::pressure> dyne_per_centi_metre_squared(dyne/(cm*cm));
94  for (unsigned idx = 0; idx < segments.size(); idx++)
95  {
96  // Get average pressure in a segment
97  units::quantity<unit::pressure> node0_pressure = segments[idx]->GetNode(0)->GetFlowProperties()->GetPressure();
98  units::quantity<unit::pressure> node1_pressure = segments[idx]->GetNode(1)->GetFlowProperties()->GetPressure();
99 
100  // Empirical Equation. Pressure in mmHg, WSS in dyne/cm2.
101  units::quantity<unit::pressure> conversion_pressure(1.0*unit::mmHg);
102  double average_pressure_in_mmHg = (node0_pressure + node1_pressure)/(2.0*conversion_pressure);
103 
104  // The calculation does not work for low pressures, so we need to specify a cut-off value.
105  if (log10(average_pressure_in_mmHg) < 1.0)
106  {
107  mTauP = 1.4 * dyne_per_centi_metre_squared;
108  }
109  else
110  {
111  double inside_exponent = -5000.0*pow(log10(log10(average_pressure_in_mmHg)), 5.4);
112  mTauP = (100.0 - 86.0 * exp(inside_exponent)) * dyne_per_centi_metre_squared;
113  }
114 
115  // The equation is dimensionally inconsistent. Drop out of the units framework.
116  double log_term_1 = log10((segments[idx]->GetFlowProperties()->GetWallShearStress()/dyne_per_centi_metre_squared + mTauRef/dyne_per_centi_metre_squared));
117  double log_term_2 = log10(mTauP/dyne_per_centi_metre_squared);
118 
119  units::quantity<unit::rate> mechanical_stimulus = (log_term_1 - 0.5*log_term_2) * unit::per_second;
120  segments[idx]->GetFlowProperties()->SetGrowthStimulus(segments[idx]->GetFlowProperties()->GetGrowthStimulus() + mechanical_stimulus);
121  }
122 }
123 
124 // Explicit instantiation
125 template class MechanicalStimulusCalculator<2> ;
126 template class MechanicalStimulusCalculator<3> ;
units::quantity< unit::pressure > GetTauP()
units::quantity< unit::pressure > GetTauReference()
boost::shared_ptr< VesselNetwork< DIM > > mpNetwork
units::quantity< unit::pressure > mTauRef
static boost::shared_ptr< MechanicalStimulusCalculator< DIM > > Create()
void SetTauP(units::quantity< unit::pressure > tauP)
units::quantity< unit::pressure > mTauP
void SetTauRef(units::quantity< unit::pressure > tauRef)