Commit 15eca329 authored by Harald Scheirich's avatar Harald Scheirich
Browse files

Remove unused variable part - 1

parent 4ae77669
......@@ -254,7 +254,6 @@ void SECircuitCalculator<CIRCUIT_CALCULATOR_TYPES>::ParseIn()
//The b matrix will have all of the right side values (known values) from the KCL equation
//Variables used in the loop
double dStartingCompliance = 0.0;
double dStartingInertance = 0.0;
for (NodeType* n : m_circuit->GetNodes())
{
//Sum of the flows at each node is 0
......
......@@ -573,10 +573,6 @@ void PulseSubstances::WriteBloodGases()
{
SELiquidSubstanceQuantity* O2 = cmpt->GetSubstanceQuantity(*m_O2);
SELiquidSubstanceQuantity* CO2 = cmpt->GetSubstanceQuantity(*m_CO2);
SELiquidSubstanceQuantity* Hb = cmpt->GetSubstanceQuantity(*m_Hb);
SELiquidSubstanceQuantity* HbO2 = cmpt->GetSubstanceQuantity(*m_HbO2);
SELiquidSubstanceQuantity* HbCO2 = cmpt->GetSubstanceQuantity(*m_HbCO2);
SELiquidSubstanceQuantity* HbO2CO2 = cmpt->GetSubstanceQuantity(*m_HbO2CO2);
SELiquidSubstanceQuantity* HCO3 = cmpt->GetSubstanceQuantity(*m_HCO3);
ss << "InitializeBloodGases(*cmpts.GetLiquidCompartment(pulse::VascularCompartment::" << cmpt->GetName() << "), Hb_total_mM, " << O2->GetSaturation() << ", " << O2->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) << ", " << CO2->GetSaturation() << ", " << CO2->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) << ", " << HCO3->GetMolarity(AmountPerVolumeUnit::mmol_Per_L) << ", " << cmpt->GetPH().GetValue() << ");";
......
......@@ -315,7 +315,6 @@ void Drugs::AdministerSubstanceCompoundInfusion()
SESubstanceCompoundInfusion* infusion;
const SESubstanceCompound* compound;
SELiquidSubstanceQuantity* subQ;
double concentration_ug_Per_mL=0;
double rate_mL_Per_s = 0;
double totalRate_mL_Per_s = 0;
double massIncrement_ug=0;
......@@ -351,7 +350,7 @@ void Drugs::AdministerSubstanceCompoundInfusion()
for (const SESubstanceConcentration* component : compound->GetComponents())
{
subQ = m_venaCavaVascular->GetSubstanceQuantity(component->GetSubstance());
double massIncrement_ug = rate_mL_Per_s*component->GetConcentration(MassPerVolumeUnit::ug_Per_mL)*m_dt_s;
massIncrement_ug = rate_mL_Per_s*component->GetConcentration(MassPerVolumeUnit::ug_Per_mL)*m_dt_s;
subQ->GetMass().IncrementValue(massIncrement_ug, MassUnit::ug);
subQ->Balance(BalanceLiquidBy::Mass);
}
......@@ -393,7 +392,6 @@ void Drugs::CalculatePartitionCoefficients()
double IntracellularPHEffects = 0;
double PlasmaPHEffects = 0;
double PHEffectPower = 0;
double PHEffects = 0;
double EquationPartA = 0;
double EquationPartB = 0;
double EquationPartC = 0;
......
......@@ -515,9 +515,9 @@ void Renal::PostProcess(bool solve_and_transport)
//--------------------------------------------------------------------------------------------------
void Renal::CalculateUltrafiltrationFeedback()
{
//Tuning parameters
double glomerularOsmoticSensitivity = 1.0;
double bowmansOsmoticSensitivity = 1.0;
//Tuning parameters unused
const double glomerularOsmoticSensitivity = 1.0;
const double bowmansOsmoticSensitivity = 1.0;
//Get substances
SEFluidCircuitPath* glomerularOsmoticSourcePath = nullptr;
......@@ -583,9 +583,9 @@ void Renal::CalculateUltrafiltrationFeedback()
//--------------------------------------------------------------------------------------------------
void Renal::CalculateReabsorptionFeedback()
{
//Tuning parameters
double peritubularOsmoticSensitivity = 1.0;
double tubulesOsmoticSensitivity = 1.0;
//Tuning parameters, unused
const double peritubularOsmoticSensitivity = 1.0;
const double tubulesOsmoticSensitivity = 1.0;
//Determine the permeability
//Only allow water to be reabsorbed more easily
......@@ -630,7 +630,7 @@ void Renal::CalculateReabsorptionFeedback()
//Set the filter resistance based on its physical properties
//This is the Capillary Filtration Coefficient
//We'll just assume this linear relationship for now
double filterResistance_mmHg_s_Per_mL = filterResistancePath->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
filterResistance_mmHg_s_Per_mL = filterResistancePath->GetNextResistance().GetValue(PressureTimePerVolumeUnit::mmHg_s_Per_mL);
if (permeability_mL_Per_s_Per_mmHg_Per_m2 != 0 && surfaceArea_m2 != 0)
filterResistance_mmHg_s_Per_mL = 1 / (permeability_mL_Per_s_Per_mmHg_Per_m2 * surfaceArea_m2);
else
......@@ -661,11 +661,8 @@ void Renal::CalculateReabsorptionFeedback()
void Renal::CalculateGluconeogenesis()
{
//Whatever Lactate shows up in the Ureter (i.e. what's excreted) is converted to Glucose and put in the TubularCapillaries (i.e. reabsorbed)
SEFluidCircuitNode* tubulesNode = nullptr;
SELiquidSubstanceQuantity* peritubularGlucose = nullptr;
SELiquidSubstanceQuantity* ureterLactate = nullptr;
SEFluidCircuitPath* reabsorptionResistancePath = nullptr;
double totalReabsorptionRate_mg_Per_s = 0.0;
double totalLactateExcretionRate_mg_Per_s = 0.0;
......@@ -772,7 +769,6 @@ void Renal::CalculateActiveTransport()
m_SubstanceTransport.leftGlucoseReabsorptionMass_mg = 0.0;
m_SubstanceTransport.rightGlucoseReabsorptionMass_mg = 0.0;
unsigned int i = 0;
for (SESubstance* sub : m_data.GetCompartments().GetLiquidCompartmentSubstances())
{
if (!sub->HasClearance())
......@@ -1835,7 +1831,6 @@ void Renal::CalculateTubuloglomerularFeedback()
//Get substances and appropriate paths and node which will be utilized in this implementation
SEFluidCircuitPath* tubulesPath = nullptr;
SEFluidCircuitPath* afferentResistancePath = nullptr;
SEFluidCircuitNode* renalArteryNode = nullptr;
//set sodium flow to initially be zero
double sodiumFlow_mg_Per_s = 0.0;
......
......@@ -415,18 +415,17 @@ void Tissue::CalculateDiffusion()
// Sodium is special. We need to diffuse for renal function.
// We will not treat sodium any differently once diffusion functionality is fully implemented.
if (sub == m_Sodium)
double moved_ug = MoveMassByInstantDiffusion(*vascular, extracellular, *sub, m_dt_s);
MoveMassByInstantDiffusion(*vascular, extracellular, *sub, m_dt_s);
continue;
}
double moved_ug;
/////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////// Vascular to Extravascular-Extracellular /////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// --- First, instant diffusion ---
moved_ug = MoveMassByInstantDiffusion(*vascular, extracellular, *sub, m_dt_s);
MoveMassByInstantDiffusion(*vascular, extracellular, *sub, m_dt_s);
// --- Second, simple diffusion ---
// Compute the vascular to extracellular permeability coefficient
......@@ -444,7 +443,7 @@ void Tissue::CalculateDiffusion()
double vToECpermeabilityCoefficient_mL_Per_s = vToECpermeabilityCoefficient_mL_Per_s_g * tissue->GetTotalMass(MassUnit::g);
// A tuning factor helps tune the dynamics - note that concentrations will ALWAYS equilibrate in steady state given enough time regardless of the permeability
double vToECPermeabilityTuningFactor = 1.0;
moved_ug = MoveMassBySimpleDiffusion(*vascular, extracellular, *sub, vToECPermeabilityTuningFactor*vToECpermeabilityCoefficient_mL_Per_s, m_dt_s);
MoveMassBySimpleDiffusion(*vascular, extracellular, *sub, vToECPermeabilityTuningFactor*vToECpermeabilityCoefficient_mL_Per_s, m_dt_s);
// --- Third facilitated diffusion ---
if (sub->HasMaximumDiffusionFlux())
......@@ -453,13 +452,13 @@ void Tissue::CalculateDiffusion()
double capCoverage_cm2 = massToAreaCoefficient_cm2_Per_g * tissue->GetTotalMass(MassUnit::g);
double maximumMassFlux = sub->GetMaximumDiffusionFlux(MassPerAreaTimeUnit::g_Per_cm2_s);
double combinedCoefficient_g_Per_s = maximumMassFlux*capCoverage_cm2;
moved_ug = MoveMassByFacilitatedDiffusion(*vascular, extracellular, *sub, combinedCoefficient_g_Per_s, m_dt_s);
MoveMassByFacilitatedDiffusion(*vascular, extracellular, *sub, combinedCoefficient_g_Per_s, m_dt_s);
}
// --- Fourth, and final vascular to EV-EC, Active diffusion ---
double pumpRate_g_Per_s = 0.0;
/// \todo Compute the pump rate from an empirically-determined baseline pump rate.
moved_ug = MoveMassByActiveTransport(*vascular, extracellular, *sub, pumpRate_g_Per_s, m_dt_s);
MoveMassByActiveTransport(*vascular, extracellular, *sub, pumpRate_g_Per_s, m_dt_s);
#ifdef PROBE_BLOOD_GASES
if (sub == &m_data.GetSubstances().GetO2() || sub == &m_data.GetSubstances().GetCO2())
......@@ -475,12 +474,12 @@ void Tissue::CalculateDiffusion()
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// --- First, instant diffusion ---
moved_ug = MoveMassByInstantDiffusion(extracellular, intracellular, *sub, m_dt_s);
MoveMassByInstantDiffusion(extracellular, intracellular, *sub, m_dt_s);
// --- Second, simple diffusion ---
// Assuming that the capillary permeability coefficient is proportional to the cellular membrane permeability coefficient for a given tissue and substance
double ECtoICPermeabilityFactor = 1.0; // This is the permeability constant
moved_ug = MoveMassBySimpleDiffusion(extracellular, intracellular, *sub, ECtoICPermeabilityFactor*vToECpermeabilityCoefficient_mL_Per_s, m_dt_s);
MoveMassBySimpleDiffusion(extracellular, intracellular, *sub, ECtoICPermeabilityFactor*vToECpermeabilityCoefficient_mL_Per_s, m_dt_s);
// --- Third facilitated diffusion ---
// In Pulse, only glucose moves by facilitated diffusion, and it is assumed that all glucose that gets to the
......@@ -490,7 +489,7 @@ void Tissue::CalculateDiffusion()
// --- Fourth, and final vascular to EV-EC, Active diffusion ---
pumpRate_g_Per_s = 0.0;
/// \todo Compute the pump rate from an empirically-determined baseline pump rate.
moved_ug = MoveMassByActiveTransport(extracellular, intracellular, *sub, pumpRate_g_Per_s, m_dt_s);
MoveMassByActiveTransport(extracellular, intracellular, *sub, pumpRate_g_Per_s, m_dt_s);
#ifdef PROBE_BLOOD_GASES
if (sub == &m_data.GetSubstances().GetO2() || sub == &m_data.GetSubstances().GetCO2())
......@@ -998,7 +997,7 @@ void Tissue::GlucoseLipidControl(double time_s)
double bloodLipidDelta_mg_Per_mL = (currentBloodLipid_mg_Per_mL - m_RestingBloodLipid_mg_Per_mL);
double insulinFeedback = currentInsulinConcentration_mg_Per_mL / m_RestingBloodInsulin_mg_Per_mL;
double massDelta_mg = 0.0;
double evFlow_mL_Per_s = 0.0;
double vascularVolume = 0.0;
double extravascularVolume = 0.0;
double transferTimeConstant_per_s = 0.1;
......@@ -1163,13 +1162,10 @@ void Tissue::DistributeMassbyVolumeWeighted(SELiquidCompartment& cmpt, const SES
if (mass == 0)
return;
SELiquidSubstanceQuantity* subQ = cmpt.GetSubstanceQuantity(sub);
if (mass < 0.0)
if (mass < 0.0 && -mass > subQ->GetMass(unit))
{
if (-mass > subQ->GetMass(unit))
{
mass = -subQ->GetMass(unit);
Info("The amount of mass decrement to distribute by volume weighted was greater than available. High probability of negative mass. DistributeMassbyMassWeighted is preferred for decrements.");
}
}
if (!cmpt.HasChildren())
......@@ -1186,11 +1182,11 @@ void Tissue::DistributeMassbyVolumeWeighted(SELiquidCompartment& cmpt, const SES
for (SELiquidCompartment* leaf : cmpt.GetLeaves())
{
double leafMass = mass * (leaf->GetVolume(VolumeUnit::mL) / volume_mL);
SELiquidSubstanceQuantity* subQ = leaf->GetSubstanceQuantity(sub);
subQ->GetMass().IncrementValue(leafMass, unit);
if (std::abs(subQ->GetMass(MassUnit::ug)) < ZERO_APPROX)
SELiquidSubstanceQuantity* leafSubQ = leaf->GetSubstanceQuantity(sub);
leafSubQ->GetMass().IncrementValue(leafMass, unit);
if (std::abs(leafSubQ->GetMass(MassUnit::ug)) < ZERO_APPROX)
{
subQ->GetMass().SetValue(0.0, MassUnit::ug);
leafSubQ->GetMass().SetValue(0.0, MassUnit::ug);
}
}
}
......@@ -1231,16 +1227,16 @@ void Tissue::DistributeMassbyMassWeighted(SELiquidCompartment& cmpt, const SESub
double mass_ug = subQ->GetMass(MassUnit::ug);
for (SELiquidCompartment* leaf : cmpt.GetLeaves())
{
SELiquidSubstanceQuantity* subQ = leaf->GetSubstanceQuantity(sub);
SELiquidSubstanceQuantity* leafSubQ = leaf->GetSubstanceQuantity(sub);
double leafMass = 0.0;
if (mass_ug != 0.0)
{
leafMass = mass * (subQ->GetMass(MassUnit::ug) / mass_ug);
leafMass = mass * (leafSubQ->GetMass(MassUnit::ug) / mass_ug);
}
subQ->GetMass().IncrementValue(leafMass, unit);
if (std::abs(subQ->GetMass(MassUnit::ug)) < ZERO_APPROX)
leafSubQ->GetMass().IncrementValue(leafMass, unit);
if (std::abs(leafSubQ->GetMass(MassUnit::ug)) < ZERO_APPROX)
{
subQ->GetMass().SetValue(0.0, MassUnit::ug);
leafSubQ->GetMass().SetValue(0.0, MassUnit::ug);
}
}
}
......@@ -1466,8 +1462,6 @@ double Tissue::MoveMassByInstantDiffusion(SELiquidCompartment& source, SELiquidC
const SELiquidSubstanceQuantity* srcQ = source.GetSubstanceQuantity(sub);
const SELiquidSubstanceQuantity* tgtQ = target.GetSubstanceQuantity(sub);
double sConc_ug = srcQ->GetMass(MassUnit::ug);
double tConc_ug = tgtQ->GetMass(MassUnit::ug);
double sConc_ug_Per_mL = srcQ->GetConcentration(MassPerVolumeUnit::ug_Per_mL);
double tConc_ug_Per_mL = tgtQ->GetConcentration(MassPerVolumeUnit::ug_Per_mL);
double sVol_mL = source.GetVolume(VolumeUnit::mL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment