Skip to content

[com1DFA] Add TJEM entrainment model - #1339

Open
Michael-Pallua wants to merge 21 commits into
masterfrom
MP_com1DFA_addTJEM
Open

Michael-Pallua wants to merge 21 commits into
masterfrom
MP_com1DFA_addTJEM

Conversation

@Michael-Pallua

@Michael-Pallua Michael-Pallua commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

The goal is to make the TJEM entrainment model, which is already present in com9MoTVoellmy, available in com1DFA.

Short description of changed files:

  • com1DFACfg.ini:
    A parameter to select the desired entrainment model (etnrType) is included as well as the parameter of the new entrainment model: the shear strength of the erodible snow cover (entShearStrength).

  • com1DFA.py:
    Changes are made to implement the new selection between the two now available entrainment models.

  • DFAfunctionsCython.pyx and DFAfunctionsCython.pxd
    A new function, computeEntMassAndForceTjem(), which implements the equations of the TJEM entrainment model is added.

PR Checklist

Please confirm before requesting review:

  • I ran pytest locally without fails
  • I added/updated tests where needed
  • I updated documentation where needed

Confirm before the final merge/rebase into master

  • Commits are sensibly squashed and rebased onto latest master
  • Standardtest run without difference (with recompiled cython code)

@Michael-Pallua Michael-Pallua self-assigned this Sep 25, 2026
@Michael-Pallua Michael-Pallua added the enhancement New feature or request label Sep 25, 2026
@qltysh

qltysh Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

All good ✅

Comment thread avaframe/com1DFA/com1DFA.py Resolved
Comment thread avaframe/com1DFA/DFAfunctionsCython.pyx Resolved
Comment thread avaframe/com1DFA/DFAfunctionsCython.pyx Resolved
Comment thread avaframe/com1DFA/com1DFA.py Resolved
Comment thread avaframe/com1DFA/com1DFACfg.ini Resolved
Comment thread avaframe/com1DFA/DFAfunctionsCython.pyx Resolved
Comment thread avaframe/com1DFA/DFAfunctionsCython.pyx Resolved
Comment thread avaframe/com1DFA/DFAfunctionsCython.pyx Resolved
Comment thread avaframe/com1DFA/DFAfunctionsCython.pyx Resolved
Comment thread avaframe/com1DFA/com1DFACfg.ini Resolved
Comment thread avaframe/com1DFA/com1DFACfg.ini Resolved
@fso42
fso42 requested a review from awirb November 5, 2026 08:28
@fso42
fso42 force-pushed the MP_com1DFA_addTJEM branch from 81c6920 to 02df759 Compare November 5, 2026 12:33
@qltysh

qltysh Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Components (1)

RatingComponent% Diff
Coverage rating: C Coverage rating: C
com1DFA100.0%

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
avaframe/com1DFA/com1DFA.py100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@Michael-Pallua
Michael-Pallua deleted the MP_com1DFA_addTJEM branch November 5, 2026 14:46
@fso42
fso42 restored the MP_com1DFA_addTJEM branch November 5, 2026 14:47
@fso42 fso42 reopened this Nov 5, 2026

@awirb awirb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think as the TJEM model is not explained in the docstrings - it is a good idea to add a description thereof to the com1DFA docu already with this PR

Comment thread avaframe/com1DFA/com1DFA.py Outdated
entrModel = cfgGen["entrModel"].lower()
entrType = entrModelsList.index(entrModel) + 1
log.debug("Entrainment Model used: %s, %s" % (entrModelsList[entrType - 1], entrType))
print("Entrainment Model used: %s, %s" % (entrModelsList[entrType - 1], entrType))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove print

Comment thread avaframe/com1DFA/com1DFACfg.ini Outdated

#++++++++++++ Entrainment Model
### Available Models:
#avaframe

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about samosAT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would be more in line with the choice of friction models

#++++++++++++Entrainment Energy loss
# Used to determine the energy loss because of entrainment
entShearResistance = 0
entDefResistance = 0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general I think grouping parameters with respect to the entrainment model that they belong to would make sense

Comment on lines +383 to +388
entrMassCell = entrMassRaster[indCellY, indCellX]
if entrMassCell > 0.0:
if entrType == 1:
dm, areaEntrPart = computeEntMassAndForce(dt, entrMassCell, areaPart, uMag, tau, entEroEnergy, rhoEnt)
if entrType == 2:
dm, areaEntrPart, tau = computeEntMassAndForceTjem(dt, entrMassCell, areaPart, uMag, tau, entShearStrength, velMagMin)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this moved up here and not from line 404 onwards where the if entrMassCell > 0.0: condition is also still required?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not done all at the same spot?

double areaPart, double uMag,
double tau, double entShearStrength,
double velMagMin):
""" compute force component due to entrained mass

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add info about which entrainment model (TJEM)

areaEntrPart : float
Area for entrainment energy loss computation
tau : float
bottom shear stress, limited to the shear strength of the snow cover if entrainment occurs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
bottom shear stress, limited to the shear strength of the snow cover if entrainment occurs
updated bottom shear stress, limited by the shear strength of the snow cover if entrainment occurs


dm = max(0.0, tau - tauC) * areaPart * dt / uMag
# cannot entrain more than the mass available under the particle
dm = min(dm, entrMassCell * areaPart)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the entrMassCell only updated outside of the loop over the particles, so not after mass has been entrained by one particle within the cell? That would mean the subsequent particle within the loop over the particles k, can entrain more than would still be available?


#++++++++++++ Entrainment Shear Strength
# Used to determine the strength of the erodible snow cover when using TJEM Entrainment Model [Pa]
entShearStrength = 500

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it not called tauC? Or why is it then in the computeMassAndEntForceTJEM function renamed to tauC?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants