Skip to content

[com1DFA] Add TJEM entrainment model - #1339

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

Michael-Pallua wants to merge 8 commits into
masterfrom
MP_com1DFA_addTJEM

Conversation

@Michael-Pallua

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
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, rhoEnt)

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.

The changed tau has no effect! Tau is last used 19 lines up and not used anymore afterwards. So either drop the value and remove the code, or compute this here earlier in the code

# in contrast to MoTVoellmy tau_c here is not scaled with the flow density
# because com1DFA does not scale shear stress at the bottom of the avalanche with the flow density while MoTVoellmy does
tau_c = entShearStrength
dm = max(0, tau - tau_c) * areaPart * dt / uMag

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.

for resting particles uMag is 0 -> so you get a divide by 0! So protect with velMagMin (similar to friction code) and also cap dm by teh pass available in the cell

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


#++++++++++++ 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.

rename to samosAT

# erosion: erode according to shear strength of snow cover
# in contrast to MoTVoellmy tau_c here is not scaled with the flow density
# because com1DFA does not scale shear stress at the bottom of the avalanche with the flow density while MoTVoellmy does
tau_c = entShearStrength

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.

Use camelCase (tauC)

rhoEnt: float
entrainement density
"""
cdef double width, ABotSwiped

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.

These are unused, remove


return dm, areaEntrPart

cpdef (double, double, double) computeEntMassAndForceTjem(double dt, double entrMassCell,

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.

rhoEnt is passed, but never used

# in contrast to MoTVoellmy tau_c here is not scaled with the flow density
# because com1DFA does not scale shear stress at the bottom of the avalanche with the flow density while MoTVoellmy does
tau_c = entShearStrength
dm = max(0, tau - tau_c) * areaPart * dt / uMag

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.

use max (0.0, ...) -> with double instead of int


#++++++++++++ Entrainment Erosion Energy
# Used to determine speed loss via energy loss due to entrained mass
# Used to determine speed loss via energy loss due to entrained mass when using Avaframe Entrainment Model

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 units

entEroEnergy = 5000

#++++++++++++ Entrainment Shear Strength
# Used to determine the strength of the erodible snow cover when using TJEM Entrainment Model

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 units

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.

2 participants