diff --git a/docs/source/usage/how_to_run.rst b/docs/source/usage/how_to_run.rst index 8860fa0..9536aae 100644 --- a/docs/source/usage/how_to_run.rst +++ b/docs/source/usage/how_to_run.rst @@ -156,6 +156,12 @@ The following inputs specify the disease parameters: * ``disease.incubation_length_beta`` (`float`, default ``0.2``) Beta parameter for the incubation length Gamma distribution. The incubation length is the length of time in days after exposure until agents develop symptoms. For a Gamma distribution, the mean is alpha*beta and the variance is alpha*beta^2. +* ``disease.hospital_delay_length_alpha`` (`float`, default ``1.0``) + Alpha parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length of time in days after agents develop symptoms that they seek treatment. + For a Gamma distribution, the mean is alpha*beta and the variance is alpha*beta^2. +* ``disease.hospital_delay_length_beta`` (`float`, default ``1.0``) + Beta parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length of time in days after agents develop symptoms that they seek treatment. + For a Gamma distribution, the mean is alpha*beta and the variance is alpha*beta^2. * ``disease.hospitalization_days`` (`list of float`, default ``3.0 8.0 7.0``) Number of hospitalization days for age groups: under 50, 50-64, 65 and over. * ``disease.xmit_comm`` (`list of float`, default ``0.000018125 0.000054375 0.000145 0.000145 0.000145 0.0002175``) diff --git a/docs/source/usage/utilities.rst b/docs/source/usage/utilities.rst index 46f6860..8d45322 100644 --- a/docs/source/usage/utilities.rst +++ b/docs/source/usage/utilities.rst @@ -42,6 +42,8 @@ Data is either written as an ``int`` or a ``real``. - ``incubation_period``: Symptom development period length (known as incubation period in some contexts), i.e. time between exposure and symptoms appearing. + - ``hospital_delay``: Delay after symptom appearance for agents to seek treatment. + - Every day (time-varying) - Int data diff --git a/examples/inputs.defaults b/examples/inputs.defaults index 3611e06..ebf6ab8 100644 --- a/examples/inputs.defaults +++ b/examples/inputs.defaults @@ -107,6 +107,10 @@ disease.infectious_length_beta = 0.17 disease.incubation_length_alpha = 25.0 # Beta parameter for the incubation length Gamma distribution. The incubation length is the length in days from the time of infection until symptoms develop. disease.incubation_length_beta = 0.2 +# Alpha parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length in days after developing symptoms that agents seek treatment. +disease.hospital_delay_length_alpha = 1.0 +# Beta parameter for the hospital_delay length Gamma distribution. The hospital_delay length is the length in days after developing symptoms that agents seek treatment. +disease.hospital_delay_length_beta = 1.0 # Number of days in hospital for the age groups under 50, 50 to 64 and over 64. disease.hospitalization_days = 3 8 7 diff --git a/src/AgentContainer.cpp b/src/AgentContainer.cpp index 13e72bb..8fa215a 100644 --- a/src/AgentContainer.cpp +++ b/src/AgentContainer.cpp @@ -711,6 +711,7 @@ void AgentContainer::infectAgents () auto latent_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::latent_period).data(); auto infectious_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::infectious_period).data(); auto incubation_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::incubation_period).data(); + auto hospital_delay_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::hospital_delay).data(); const auto lparm = m_d_parm[d]; @@ -722,7 +723,7 @@ void AgentContainer::infectAgents () status_ptr[i] == Status::susceptible ) { if (amrex::Random(engine) < prob_ptr[i]) { setInfected(&(status_ptr[i]), &(counter_ptr[i]), &(latent_period_ptr[i]), &(infectious_period_ptr[i]), - &(incubation_period_ptr[i]), engine, lparm); + &(incubation_period_ptr[i]), &(hospital_delay_ptr[i]), engine, lparm); return; } } diff --git a/src/AgentDefinitions.H b/src/AgentDefinitions.H index 07f3454..daa5dbc 100644 --- a/src/AgentDefinitions.H +++ b/src/AgentDefinitions.H @@ -32,6 +32,7 @@ struct RealIdxDisease latent_period, /*!< Time until infectious, which could be before symptoms appear */ infectious_period, /*!< Length of time infectious */ incubation_period, /*!< Time until symptoms appear */ + hospital_delay, /*!< Delay after symptom onset until hospital treatment is sought */ nattribs /*!< number of real-type attribute*/ }; }; diff --git a/src/DiseaseParm.H b/src/DiseaseParm.H index 6b2f957..34b3fe2 100644 --- a/src/DiseaseParm.H +++ b/src/DiseaseParm.H @@ -94,6 +94,9 @@ struct DiseaseParm Real incubation_length_alpha = Real(25.0); /*! alpha parameter for gamma distribution*/ Real incubation_length_beta = Real(0.2); /*! beta parameter for gamma distribution*/ + Real hospital_delay_length_alpha = Real(1.0); /*! alpha parameter for gamma distribution*/ + Real hospital_delay_length_beta = Real(1.0); /*! beta parameter for gamma distribution*/ + /*! number of hospitalization days by age group (#AgeGroups_Hosp); note that the * age groups here are under 50, 50-64, and over 65, and *not* the age groups * used in other parts of the code (#AgeGroups) */ @@ -164,6 +167,7 @@ void setInfected ( int* status, amrex::ParticleReal* latent_period, amrex::ParticleReal* infectious_period, amrex::ParticleReal* incubation_period, + amrex::ParticleReal* hospital_delay, amrex::RandomEngine const& engine, const DiseaseParm* lparm) { @@ -175,9 +179,12 @@ void setInfected ( int* status, static_cast(amrex::RandomGamma(lparm->infectious_length_alpha, lparm->infectious_length_beta, engine)); *incubation_period = static_cast(amrex::RandomGamma(lparm->incubation_length_alpha, lparm->incubation_length_beta, engine)); + *hospital_delay = + static_cast(amrex::RandomGamma(lparm->hospital_delay_length_alpha, lparm->hospital_delay_length_beta, engine)); if (*latent_period < 0) { *latent_period = amrex::Real(0);} if (*infectious_period < 0) { *infectious_period = amrex::Real(0);} if (*incubation_period < 0) { *incubation_period = amrex::Real(0);} + if (*hospital_delay < 0) { *hospital_delay = amrex::Real(0);} if (*incubation_period > (*infectious_period + *latent_period)) { *incubation_period = std::floor(*infectious_period + *latent_period); } diff --git a/src/DiseaseParm.cpp b/src/DiseaseParm.cpp index 8f6b16c..2db4a3e 100644 --- a/src/DiseaseParm.cpp +++ b/src/DiseaseParm.cpp @@ -77,10 +77,12 @@ void DiseaseParm::readInputs ( const std::string& a_pp_str /*!< Parmparse string pp.query("latent_length_alpha", latent_length_alpha); pp.query("infectious_length_alpha", infectious_length_alpha); pp.query("incubation_length_alpha", incubation_length_alpha); + pp.query("hospital_delay_length_alpha", hospital_delay_length_alpha); pp.query("latent_length_beta", latent_length_beta); pp.query("infectious_length_beta", infectious_length_beta); pp.query("incubation_length_beta", incubation_length_beta); + pp.query("hospital_delay_length_beta", hospital_delay_length_beta); pp.query("immune_length_alpha", immune_length_alpha); pp.query("immune_length_beta", immune_length_beta); diff --git a/src/DiseaseStatus.H b/src/DiseaseStatus.H index 0b34f6e..64ce8ef 100644 --- a/src/DiseaseStatus.H +++ b/src/DiseaseStatus.H @@ -131,6 +131,7 @@ void DiseaseStatus::updateAgents(AC& a_agents, /*!< Agent contain auto latent_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::latent_period).data(); auto infectious_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::infectious_period).data(); auto incubation_period_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::incubation_period).data(); + auto hospital_delay_ptr = soa.GetRealData(r_RT+r0(d)+RealIdxDisease::hospital_delay).data(); auto* disease_parm_d = a_agents.getDiseaseParameters_d(d); auto* disease_parm_h = a_agents.getDiseaseParameters_h(d); @@ -168,6 +169,16 @@ void DiseaseStatus::updateAgents(AC& a_agents, /*!< Agent contain if (symptomatic_withdraw_compliance > 0.0_rt && (Random(engine) < symptomatic_withdraw_compliance)) { withdrawn_ptr[i] = 1; } + if (Math::floor(hospital_delay_ptr[i]) == 0) { + disease_parm_d->check_hospitalization(&(timer_ptr[i]), + &(marked_for_ICU_ptr[i]), + &(marked_for_vent_ptr[i]), + age_group_ptr[i], + engine); } + if (timer_ptr[i] > 0) { marked_for_hosp_ptr[i] = 1; } + } + } else if ((Math::floor(hospital_delay_ptr[i]) > 0) && (Math::floor(counter_ptr[i]) == Math::floor(incubation_period_ptr[i]) + Math::floor(hospital_delay_ptr[i]))) { + if (symptomatic_ptr[i] == SymptomStatus::symptomatic) { disease_parm_d->check_hospitalization(&(timer_ptr[i]), &(marked_for_ICU_ptr[i]), &(marked_for_vent_ptr[i]), diff --git a/src/IO.cpp b/src/IO.cpp index 55a35ea..5a6f403 100644 --- a/src/IO.cpp +++ b/src/IO.cpp @@ -135,6 +135,7 @@ void writePlotFile (const AgentContainer& pc, /*!< Agent (particle) container */ real_varnames.push_back("latent_period"); write_real_comp.push_back(static_cast(step==0)); real_varnames.push_back("infectious_period"); write_real_comp.push_back(static_cast(step==0)); real_varnames.push_back("incubation_period"); write_real_comp.push_back(static_cast(step==0)); + real_varnames.push_back("hospital_delay"); write_real_comp.push_back(static_cast(step==0)); int_varnames.push_back ("status"); write_int_comp.push_back(1); int_varnames.push_back ("symptomatic"); write_int_comp.push_back(1); } else { @@ -145,6 +146,7 @@ void writePlotFile (const AgentContainer& pc, /*!< Agent (particle) container */ real_varnames.push_back(disease_names[d]+"_latent_period"); write_real_comp.push_back(static_cast(step==0)); real_varnames.push_back(disease_names[d]+"_infectious_period"); write_real_comp.push_back(static_cast(step==0)); real_varnames.push_back(disease_names[d]+"_incubation_period"); write_real_comp.push_back(static_cast(step==0)); + real_varnames.push_back(disease_names[d]+"_hospital_delay"); write_real_comp.push_back(static_cast(step==0)); int_varnames.push_back (disease_names[d]+"_status"); write_int_comp.push_back(1); int_varnames.push_back (disease_names[d]+"_symptomatic"); write_int_comp.push_back(1); } diff --git a/src/InitializeInfections.cpp b/src/InitializeInfections.cpp index f02054a..0c9bdb4 100644 --- a/src/InitializeInfections.cpp +++ b/src/InitializeInfections.cpp @@ -81,6 +81,7 @@ static int infect_random_community (AgentContainer& pc, /*!< Agent container (pa auto latent_period_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::latent_period).data(); auto infectious_period_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::infectious_period).data(); auto incubation_period_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::incubation_period).data(); + auto hospital_delay_ptr = soa.GetRealData(r_RT+r0(d_idx)+RealIdxDisease::hospital_delay).data(); auto comm_arr = comm_mf[mfi].array(); @@ -113,7 +114,7 @@ static int infect_random_community (AgentContainer& pc, /*!< Agent container (pa } } else { setInfected(&(status_ptr[pindex]), &(counter_ptr[pindex]), &(latent_period_ptr[pindex]), - &(infectious_period_ptr[pindex]), &(incubation_period_ptr[pindex]), engine, lparm); + &(infectious_period_ptr[pindex]), &(incubation_period_ptr[pindex]), &(hospital_delay_ptr[i]), engine, lparm); ++ni; } }