Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 1364bdbd authored by Rachel Clipp's avatar Rachel Clipp
Browse files

Added internal hemorrhage capabilities. Only added internal abdominal...

Added internal hemorrhage capabilities. Only added internal abdominal hemorrhage for now. There is now an abdominal cavity for internal hemorrhaging and the aorta resistance is modified based on the pressure in the abdominal cavity.
parent 4d4678a2
......@@ -386,6 +386,8 @@ namespace pulse {
DEFINE_STATIC_STRING_EX(LeftLeg, LeftLegVasculature);
DEFINE_STATIC_STRING_EX(RightArm, RightArmVasculature);
DEFINE_STATIC_STRING_EX(RightLeg, RightLegVasculature);
DEFINE_STATIC_STRING(Abdomen);
DEFINE_STATIC_STRING(AbdominalCavity);
DEFINE_STATIC_STRING(Ground);
......@@ -396,6 +398,7 @@ namespace pulse {
if (_values.empty())
{
_values.push_back(Aorta);
_values.push_back(Abdomen);
_values.push_back(Heart);
_values.push_back(Myocardium);
_values.push_back(LeftHeart);
......
......@@ -360,6 +360,9 @@ DEFINE_STATIC_STRING_EX(GroundToConnection, MechanicalVentilatorGroundToConnecti
DEFINE_STATIC_STRING(Aorta1);
DEFINE_STATIC_STRING(Aorta2);
DEFINE_STATIC_STRING(Aorta3);
//DEFINE_STATIC_STRING(Aorta4);
DEFINE_STATIC_STRING(AbdominalCavity1);
DEFINE_STATIC_STRING(Bone1);
DEFINE_STATIC_STRING(Bone2);
......@@ -452,6 +455,13 @@ DEFINE_STATIC_STRING_EX(GroundToConnection, MechanicalVentilatorGroundToConnecti
DEFINE_STATIC_STRING(Aorta2ToAorta3);
DEFINE_STATIC_STRING(Aorta3ToAorta1);
DEFINE_STATIC_STRING(Aorta1ToGround);
// Abdominal Cavity
DEFINE_STATIC_STRING(InternalHemorrhageToAorta);
//DEFINE_STATIC_STRING(Aorta1ToAorta4);
DEFINE_STATIC_STRING(AbdominalCavity1ToGround);
DEFINE_STATIC_STRING(GroundToAbdominalCavity1);
// Brain
DEFINE_STATIC_STRING(Aorta1ToBrain1);
DEFINE_STATIC_STRING(Brain1ToGround);
......
......@@ -1203,11 +1203,16 @@ void PulseController::SetupCardiovascular()
LeftHeart3.GetPressure().SetValue(0.0, PressureUnit::mmHg);
LeftHeart1.GetVolumeBaseline().SetValue(VolumeFractionHeartLeft*bloodVolume_mL, VolumeUnit::mL);
SEFluidCircuitNode& AbdominalCavity = cCardiovascular.CreateNode(pulse::CardiovascularNode::AbdominalCavity1);
AbdominalCavity.GetVolumeBaseline().SetValue(10.0, VolumeUnit::mL);
AbdominalCavity.GetPressure().SetValue(1.0, PressureUnit::mmHg);
SEFluidCircuitNode& Aorta1 = cCardiovascular.CreateNode(pulse::CardiovascularNode::Aorta1);
SEFluidCircuitNode& Aorta2 = cCardiovascular.CreateNode(pulse::CardiovascularNode::Aorta2);
SEFluidCircuitNode& Aorta3 = cCardiovascular.CreateNode(pulse::CardiovascularNode::Aorta3);
Aorta1.GetVolumeBaseline().SetValue(VolumeFractionAorta*bloodVolume_mL, VolumeUnit::mL);
Aorta1.GetPressure().SetValue(VascularPressureTargetAorta, PressureUnit::mmHg);
//SEFluidCircuitNode& Aorta4 = cCardiovascular.CreateNode(pulse::CardiovascularNode::Aorta4);
SEFluidCircuitNode& Brain1 = cCardiovascular.CreateNode(pulse::CardiovascularNode::Brain1);
SEFluidCircuitNode& Brain2 = cCardiovascular.CreateNode(pulse::CardiovascularNode::Brain2);
......@@ -1523,6 +1528,14 @@ void PulseController::SetupCardiovascular()
SEFluidCircuitPath& SpleenToPortalVein = cCardiovascular.CreatePath(Spleen, PortalVein, pulse::CardiovascularPath::SpleenToPortalVein);
SpleenToPortalVein.GetResistanceBaseline().SetValue(systemicResistanceModifier*ResistanceSpleenVenous, FlowResistanceUnit::mmHg_s_Per_mL);
SEFluidCircuitPath& AbdominalCavityToGround = cCardiovascular.CreatePath(AbdominalCavity, Ground, pulse::CardiovascularPath::AbdominalCavity1ToGround);
SEFluidCircuitPath& GroundToAbdominalCavity = cCardiovascular.CreatePath(Ground, AbdominalCavity, pulse::CardiovascularPath::GroundToAbdominalCavity1);
GroundToAbdominalCavity.GetFlowSourceBaseline().SetValue(0.0, VolumePerTimeUnit::mL_Per_s);
//SEFluidCircuitPath& Aorta1ToAorta4 = cCardiovascular.CreatePath(Aorta1, Aorta4, pulse::CardiovascularPath::Aorta1ToAorta4);
//SEFluidCircuitPath& InternalHemorrhageToAorta = cCardiovascular.CreatePath(Ground, Spleen, pulse::CardiovascularPath::InternalHemorrhageToAorta);
//InternalHemorrhageToAorta.GetPressureSourceBaseline().SetValue(0.0, PressureUnit::mmHg);
SEFluidCircuitPath& VenaCavaToGround = cCardiovascular.CreatePath(VenaCava, Ground, pulse::CardiovascularPath::VenaCavaToGround);
VenaCavaToGround.GetComplianceBaseline().SetValue(0.0, FlowComplianceUnit::mL_Per_mmHg);
SEFluidCircuitPath& IVToVenaCava = cCardiovascular.CreatePath(Ground, VenaCava, pulse::CardiovascularPath::IVToVenaCava);
......@@ -1571,6 +1584,8 @@ void PulseController::SetupCardiovascular()
//And also modify the compliances
Aorta1ToGround.GetComplianceBaseline().SetValue(largeArteriesComplianceModifier*Aorta1ToGround.GetComplianceBaseline(FlowComplianceUnit::mL_Per_mmHg), FlowComplianceUnit::mL_Per_mmHg);
//For Internal Hemorrhage
AbdominalCavityToGround.GetComplianceBaseline().SetValue(100.0, FlowComplianceUnit::mL_Per_mmHg);
RightPulmonaryArteries.GetVolumeBaseline().SetValue(VolumeModifierPulmArtR * RightPulmonaryArteries.GetVolumeBaseline(VolumeUnit::mL), VolumeUnit::mL);
LeftPulmonaryArteries.GetVolumeBaseline().SetValue(VolumeModifierPulmArtL * LeftPulmonaryArteries.GetVolumeBaseline(VolumeUnit::mL), VolumeUnit::mL);
......@@ -1671,7 +1686,11 @@ void PulseController::SetupCardiovascular()
vAorta.MapNode(Aorta1);
vAorta.MapNode(Aorta2);
vAorta.MapNode(Aorta3);
//vAorta.MapNode(Aorta4);
///////////
// Abdominal Cavity //
SELiquidCompartment& vAbdominalCavity = m_Compartments->CreateLiquidCompartment(pulse::VascularCompartment::AbdominalCavity);
vAbdominalCavity.MapNode(AbdominalCavity);
// Brain //
SELiquidCompartment& vBrain = m_Compartments->CreateLiquidCompartment(pulse::VascularCompartment::Brain);
vBrain.MapNode(Brain1);
......@@ -1792,6 +1811,15 @@ void PulseController::SetupCardiovascular()
vGut.AddChild(vSplanchnic);
vGut.AddChild(vSmallIntestine);
vGut.AddChild(vLargeIntestine);
SELiquidCompartment& vAbdomen = m_Compartments->CreateLiquidCompartment(pulse::VascularCompartment::Abdomen);
vAbdomen.AddChild(vSplanchnic);
vAbdomen.AddChild(vSmallIntestine);
vAbdomen.AddChild(vLargeIntestine);
vAbdomen.AddChild(vLeftKidney);
vAbdomen.AddChild(vRightKidney);
vAbdomen.AddChild(vSpleen);
vAbdomen.AddChild(vLiver);
vAbdomen.AddChild(vAbdominalCavity);
//////////////////
......
......@@ -111,6 +111,7 @@ void Cardiovascular::Clear()
m_RightPulmonaryArteriesToVeins = nullptr;
m_RightPulmonaryArteriesToCapillaries = nullptr;
m_InternalHemorrhageToAorta = nullptr;
m_pAortaToBone = nullptr;
m_pAortaToBrain = nullptr;
m_pBrainToVenaCava = nullptr;
......@@ -127,6 +128,9 @@ void Cardiovascular::Clear()
m_pAortaToSplanchnic = nullptr;
m_pAortaToSpleen = nullptr;
m_pGndToAbdominalCavity = nullptr;
m_pAbdominalCavityToGnd = nullptr;
m_pGndToPericardium = nullptr;
m_pPericardiumToGnd = nullptr;
m_pRightHeartToGnd = nullptr;
......@@ -151,6 +155,7 @@ void Cardiovascular::Clear()
m_RightPulmonaryArteries = nullptr;
m_RightPulmonaryVeins = nullptr;
m_VenaCava = nullptr;
m_AbdominalCavity = nullptr;
m_CardiacCycleArterialPressure_mmHg->Clear();
m_CardiacCycleArterialCO2PartialPressure_mmHg->Clear();
......@@ -271,6 +276,7 @@ void Cardiovascular::SetUp()
m_Pericardium = m_data.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::Pericardium);
m_LeftHeart = m_data.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::LeftHeart);
m_RightHeart = m_data.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::RightHeart);
m_AbdominalCavity = m_data.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::AbdominalCavity);
//Nodes
m_MainPulmonaryArteries = m_CirculatoryCircuit->GetNode(pulse::CardiovascularNode::MainPulmonaryArteries);
m_LeftHeart2 = m_CirculatoryCircuit->GetNode(pulse::CardiovascularNode::LeftHeart2);
......@@ -281,6 +287,7 @@ void Cardiovascular::SetUp()
m_RightPulmonaryArteriesToVeins = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::RightPulmonaryArteriesToRightPulmonaryVeins);
m_RightPulmonaryArteriesToCapillaries = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::RightPulmonaryArteriesToRightPulmonaryCapillaries);
m_InternalHemorrhageToAorta = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Aorta3ToAorta1);
m_pAortaToBone = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Aorta1ToBone1);
m_pAortaToBrain = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Aorta1ToBrain1);
m_pBrainToVenaCava = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Brain1ToBrain2);
......@@ -300,6 +307,9 @@ void Cardiovascular::SetUp()
m_pBrainResistanceDownstream = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Brain1ToBrain2);
m_pBrainResistanceUpstream = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Aorta1ToBrain1);
m_pGndToAbdominalCavity = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::GroundToAbdominalCavity1);
m_pAbdominalCavityToGnd = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::AbdominalCavity1ToGround);
m_pGndToPericardium = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::GroundToPericardium1);
m_pPericardiumToGnd = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::Pericardium1ToGround);
m_pRightHeartToGnd = m_CirculatoryCircuit->GetPath(pulse::CardiovascularPath::RightHeart3ToGround);
......@@ -955,6 +965,7 @@ void Cardiovascular::Hemorrhage()
SEHemorrhage* h;
double TotalLossRate_mL_Per_s = 0.0;
double internal_rate_mL_Per_s = 0.0;
std::vector<SEHemorrhage*> invalid_hemorrhages;
const std::map <std::string, SEHemorrhage*> & hems = m_data.GetActions().GetPatientActions().GetHemorrhages();
for (auto hem : hems)
......@@ -991,6 +1002,18 @@ void Cardiovascular::Hemorrhage()
invalid_hemorrhages.push_back(h);
continue;
}
if (h->GetType() == eHemorrhage_Type::Internal)
{
SELiquidCompartment* abdomenCompartment = m_data.GetCompartments().GetLiquidCompartment(pulse::VascularCompartment::Abdomen);
//SELiquidCompartment* abdomenCompartment = m_data.GetCompartments().GetCardiovascularGraph().GetCompartment(pulse::VascularCompartment::Abdomen);
if (!abdomenCompartment->HasChild(compartment->GetName()))
{
m_ss << "Internal Hemorrhage is only supported for the abdominal region, including the right and left kidneys, liver, spleen, splanchnic, and small and large intestine vascular compartments.";
Error(m_ss);
invalid_hemorrhages.push_back(h);
continue;
}
}
TotalLossRate_mL_Per_s += rate_mL_Per_s;
......@@ -1112,8 +1135,38 @@ void Cardiovascular::Hemorrhage()
//Add to local lists
m_HemorrhagePaths.push_back(&newHemorrhagePath);
m_HemorrhageLinks.push_back(&newHemorrhageLink);
if (h->GetType() == eHemorrhage_Type::Internal)
{
m_InternalHemorrhagePaths.push_back(&newHemorrhagePath);
m_InternalHemorrhageLinks.push_back(&newHemorrhageLink);
}
}
}
//total the internal hemorrhage flow rate and apply it to the abdominal cavity path
for (auto hemorrhage : m_InternalHemorrhagePaths)
{
internal_rate_mL_Per_s = +hemorrhage->GetNextFlowSource().GetValue(VolumePerTimeUnit::mL_Per_s);
}
m_pGndToAbdominalCavity->GetNextFlowSource().SetValue(internal_rate_mL_Per_s, VolumePerTimeUnit::mL_Per_s);
double abdominalBloodVolume = m_AbdominalCavity->GetVolume().GetValue(VolumeUnit::mL);
double compliance_mL_Per_mmHg = 0;
double complianceSlopeParameter = 0.4;
double complianceCurveParameter = 0.55;
//Variable compliance calculation
if (internal_rate_mL_Per_s < 0.0001)
{
compliance_mL_Per_mmHg = m_pAbdominalCavityToGnd->GetNextCompliance().GetValue(FlowComplianceUnit::mL_Per_mmHg);
}
else
{
compliance_mL_Per_mmHg = complianceSlopeParameter / complianceCurveParameter*abdominalBloodVolume;
}
m_pAbdominalCavityToGnd->GetNextCompliance().SetValue(compliance_mL_Per_mmHg, FlowComplianceUnit::mL_Per_mmHg);
InternalHemorrhagePressureApplication();
}
// Remove any invalid hemorrhages
......@@ -1145,7 +1198,7 @@ void Cardiovascular::Hemorrhage()
//Update the patient's mass
double bloodDensity_kg_Per_mL = m_data.GetBloodChemistry().GetBloodDensity(MassPerVolumeUnit::kg_Per_mL);
double massLost_kg = TotalLossRate_mL_Per_s*bloodDensity_kg_Per_mL*m_dT_s;
double massLost_kg = (TotalLossRate_mL_Per_s - internal_rate_mL_Per_s)*bloodDensity_kg_Per_mL*m_dT_s;
double patientMass_kg = m_patient->GetWeight(MassUnit::kg);
patientMass_kg -= massLost_kg;
......@@ -1416,6 +1469,26 @@ void Cardiovascular::PericardialEffusionPressureApplication()
m_pLeftHeartToGnd->GetPressureSourceBaseline().SetValue(pressureResponseFraction*intrapericardialPressure_mmHg, PressureUnit::mmHg);
}
//--------------------------------------------------------------------------------------------------
/// \brief
/// The internal pressure application function calculates the pressure applied to the aorta due to blood pooling in the abdominal cavity.
///
/// \details
/// The pressure applied to the aorta is dictated by the pressure in the abdominal cavity. The response is tuned to 40% of this value
/// to achieve the correct physiologic response. (Unvalidated at this time).
//--------------------------------------------------------------------------------------------------
void Cardiovascular::InternalHemorrhagePressureApplication()
{
double abdominalCavityPressureChange_mmHg = m_AbdominalCavity->GetPressure(PressureUnit::mmHg);
double pressureResponseFraction = 0.45; //Tuning the pressure applied to the aorta
//Set the resistance on the aorta based on the abdominal cavity pressure
double aortaBaselineResistance_mmHg_s_Per_mL = m_InternalHemorrhageToAorta->GetResistanceBaseline().GetValue(FlowResistanceUnit::mmHg_s_Per_mL);
m_InternalHemorrhageToAorta->GetNextResistance().SetValue(pressureResponseFraction*aortaBaselineResistance_mmHg_s_Per_mL*abdominalCavityPressureChange_mmHg, FlowResistanceUnit::mmHg_s_Per_mL);
}
//--------------------------------------------------------------------------------------------------
/// \brief
/// Calculates the contraction and relaxation of the left and right heart during the cardiac cycle
......
......@@ -74,6 +74,7 @@ protected:
/**/void CPR();
/****/void CalculateAndSetCPRcompressionForce();
/**/void Hemorrhage();
/**/void InternalHemorrhagePressureApplication();
/**/void PericardialEffusion();
/**/void PericardialEffusionPressureApplication();
/**/void CardiacArrest();
......@@ -104,7 +105,9 @@ protected:
double m_CompressionPeriod_s;
//Hemorrhage
std::vector<SEFluidCircuitPath*> m_HemorrhagePaths;
std::vector<SEFluidCircuitPath*> m_InternalHemorrhagePaths;
std::vector<SELiquidCompartmentLink*> m_HemorrhageLinks;
std::vector<SELiquidCompartmentLink*> m_InternalHemorrhageLinks;
// Vitals and Averages
double m_CurrentCardiacCycleTime_s;
double m_CardiacCycleDiastolicVolume_mL; // Maximum left heart volume for the current cardiac cycle
......@@ -152,6 +155,7 @@ protected:
SEFluidCircuitPath* m_RightPulmonaryArteriesToVeins;
SEFluidCircuitPath* m_RightPulmonaryArteriesToCapillaries;
SEFluidCircuitPath* m_InternalHemorrhageToAorta;
SEFluidCircuitPath* m_pAortaToBone;
SEFluidCircuitPath* m_pAortaToBrain;
SEFluidCircuitPath* m_pBrainToVenaCava;
......@@ -181,6 +185,9 @@ protected:
SEFluidCircuitPath* m_leftRenalArteryPath;
SEFluidCircuitPath* m_rightRenalArteryPath;
SEFluidCircuitPath* m_pGndToAbdominalCavity;
SEFluidCircuitPath* m_pAbdominalCavityToGnd;
SELiquidCompartment* m_Aorta;
SELiquidSubstanceQuantity* m_AortaCO2;
......@@ -196,6 +203,7 @@ protected:
SELiquidCompartment* m_RightPulmonaryArteries;
SELiquidCompartment* m_RightPulmonaryVeins;
SELiquidCompartment* m_VenaCava;
SELiquidCompartment* m_AbdominalCavity;
std::vector<SEFluidCircuitPath*> m_systemicResistancePaths;
std::vector<SEFluidCircuitPath*> m_systemicCompliancePaths;
......
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