Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branching airways 3min model-added constructCubeAlveoli function #34

Open
wants to merge 5 commits into
base: branching_airways_3min_model
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add air virion diffusion
  • Loading branch information
Ariana Villegas-Suarez committed Nov 15, 2022
commit a1ad5d38e5a68da98739feb3ab9c79457c8267ff
3 changes: 2 additions & 1 deletion create_config.py
Original file line number Diff line number Diff line change
@@ -16,10 +16,11 @@
parser.add_argument("--virion-production-multiplier" , type=float, help="Multiplier reducing virion production rate where inflammatory signal is present", default=1.0)
parser.add_argument("--virion-clearance" , type=float, help="Fraction by which virion count drops each time step", default=0.004)
parser.add_argument("--virion-diffusion" , type=float, help="Fraction of virions that diffuse into all neighbors each time step", default=0.15)
parser.add_argument("--virion-air-diffusion" , type=float, help="Fraction of chemokine concentration that diffuses into all neighbors through air each time step", default=0.0)
parser.add_argument("--chemokine-production" , type=float, help="Amount of chemokine produced by expressing cells each time step", default=1.0)
parser.add_argument("--chemokine-decay" , type=float, help="Amount by which chemokine concentration drops each time step", default=0.01)
parser.add_argument("--chemokine-diffusion" , type=float, help="Fraction of chemokine concentration that diffuses into all neighbors each time step", default=1.0)
parser.add_argument("--air-diffusion" , type=float, help="Fraction of chemokine concentration that diffuses into all neighbors through air each time step", default=1.0)
parser.add_argument("--chemokine-air-diffusion" , type=float, help="Fraction of chemokine concentration that diffuses into all neighbors through air each time step", default=0.0)
parser.add_argument("--min-chemokine" , type=float, help="Minimum chemokine concentration that triggers a T cell", default=1e-6)
parser.add_argument("--antibody-factor" , type=int, help="Impact of antibodies; multiplier for virion decay (setting to 1 means this has no effect)", default=1)
parser.add_argument("--antibody-period" , type=int, help="Number of time steps before antibodies start to be produced", default=5760)
10 changes: 8 additions & 2 deletions include/options.hpp
Original file line number Diff line number Diff line change
@@ -264,11 +264,12 @@ class Options {
double virion_production_multiplier = 1.0;
double virion_clearance_rate = 0.002;
double virion_diffusion_coef = 1.0;
double virion_air_diffusion_coef = 0.0;

double chemokine_production = 1.0;
double chemokine_decay_rate = 0.01;
double chemokine_diffusion_coef = 1.0;
double air_diffusion_coef = 1.0;
double chemokine_air_diffusion_coef = 0.0;
double min_chemokine = 1e-6;

double antibody_factor = 1;
@@ -347,6 +348,11 @@ class Options {
"Fraction of virions that diffuse into all neighbors each time step")
->check(CLI::Range(0.0, 1.0))
->capture_default_str();
app.add_option("--virion-air-diffusion", virion_air_diffusion_coef,
"Fraction of chemokine concentration that diffuses into all neighbors through air "
"each time step")
->check(CLI::Range(0.0, 1.0))
->capture_default_str();
app.add_option("--chemokine-production", chemokine_production,
"Amount of chemokine produced by expressing cells each time step")
->check(CLI::Range(0.0, 1.0))
@@ -360,7 +366,7 @@ class Options {
"each time step")
->check(CLI::Range(0.0, 1.0))
->capture_default_str();
app.add_option("--air-diffusion", air_diffusion_coef,
app.add_option("--chemokine-air-diffusion", chemokine_air_diffusion_coef,
"Fraction of chemokine concentration that diffuses into all neighbors through air "
"each time step")
->check(CLI::Range(0.0, 1.0))
39 changes: 30 additions & 9 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -437,18 +437,39 @@ void set_active_grid_points(Tissue &tissue) {
for (auto grid_point = tissue.get_first_active_grid_point(); grid_point;
grid_point = tissue.get_next_active_grid_point()) {
auto nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::NONE, true);
if (grid_point->epicell->type == EpiCellType::AIR) {
auto pr_nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::AIR);
diffuse(grid_point->chemokine, grid_point->nb_chemokine, _options->chemokine_diffusion_coef,
pr_nbs->size());

if (_options->chemokine_air_diffusion_coef > 0) {
if (grid_point->epicell->type == EpiCellType::AIR) {
auto pr_nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::AIR);
diffuse(grid_point->chemokine, grid_point->nb_chemokine, _options->chemokine_air_diffusion_coef,
pr_nbs->size());
} else {
auto pr_nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::AIR, true);
diffuse(grid_point->chemokine, grid_point->nb_chemokine, _options->chemokine_diffusion_coef,
pr_nbs->size());
}
} else {
auto pr_nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::AIR, true);
grid_point->nb_chemokine = 0.0;
diffuse(grid_point->chemokine, grid_point->nb_chemokine, _options->air_diffusion_coef,
pr_nbs->size());
diffuse(grid_point->chemokine, grid_point->nb_chemokine, _options->chemokine_diffusion_coef,
nbs->size());
}
spread_virions(grid_point->virions, grid_point->nb_virions, _options->virion_diffusion_coef,


if (_options->virion_air_diffusion_coef > 0) {
if (grid_point->epicell->type == EpiCellType::AIR) {
auto pr_nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::AIR);
spread_virions(grid_point->virions, grid_point->nb_virions, _options->virion_air_diffusion_coef,
nbs->size());
} else {
auto pr_nbs = tissue.get_neighbors(grid_point->coords, EpiCellType::AIR, true);
spread_virions(grid_point->virions, grid_point->nb_virions, _options->virion_diffusion_coef,
nbs->size());
}
} else {
spread_virions(grid_point->virions, grid_point->nb_virions, _options->virion_diffusion_coef,
nbs->size());
}


if (grid_point->chemokine < _options->min_chemokine) grid_point->chemokine = 0;
if (grid_point->virions > MAX_VIRIONS) grid_point->virions = MAX_VIRIONS;
if (grid_point->virions < MIN_VIRIONS) grid_point->virions = 0;