Skip to content

Commit

Permalink
consolidate rootfracsum checks
Browse files Browse the repository at this point in the history
  • Loading branch information
amullen01 committed Jun 14, 2024
1 parent 669723e commit da70138
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/WildFire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,19 +286,18 @@ void WildFire::burn(int year) {
BOOST_LOG_SEV(glg, note) << "Re-do the soil root fraction for each PFT modified by burning?";
for (int ip = 0; ip < NUM_PFT; ip++) {
double rootfracsum = 0.0;

for (int il = 0; il < cd->m_soil.numsl; il++) {
if (cd->m_soil.type[il]>0 && cd->m_soil.frootfrac[il][ip]>0.) {
rootfracsum += cd->m_soil.frootfrac[il][ip];
}
rootfracsum += cd->m_soil.frootfrac[il][ip];
}

for (int il =0; il <cd->m_soil.numsl; il++) {
if (cd->m_soil.type[il]>0 && cd->m_soil.frootfrac[il][ip]>0. && rootfracsum>0.) {
if (rootfracsum > 0.) {
cd->m_soil.frootfrac[il][ip] /= rootfracsum;
}
else {
cd->m_soil.frootfrac[il][ip] = 0.0;
}
}
}
}

Expand Down

0 comments on commit da70138

Please sign in to comment.