Repository navigation
[com1DFA] Add TJEM entrainment model #1339
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
base: master
Are you sure you want to change the base?
Changes from all commits
f500a85
a5c6948
3351410
209eb6e
e2f52b5
408c410
37fc730
e4e6e26
6880e4e
7e5bef1
0b0531a
eb92119
bd149e0
19d2cb1
967e26c
7fd50ce
84c3057
c766071
d3738a5
02df759
cf104f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -27,7 +27,7 @@ import avaframe.in3Utils.geoTrans as geoTrans | |||||
| log = logging.getLogger(__name__) | ||||||
|
|
||||||
|
|
||||||
| def computeForceC(cfg, particles, fields, dem, int frictType, int resistanceType): | ||||||
| def computeForceC(cfg, particles, fields, dem, int frictType, int entrType, int resistanceType): | ||||||
| """ compute forces acting on the particles (without the SPH component) | ||||||
|
|
||||||
| Cython implementation implementation | ||||||
|
|
@@ -44,6 +44,8 @@ def computeForceC(cfg, particles, fields, dem, int frictType, int resistanceType | |||||
| dictionary with dem information | ||||||
| frictType: int | ||||||
| identifier for friction law to be used | ||||||
| entrType: int | ||||||
| identifier for entrainment law to be used | ||||||
| resistanceType: int | ||||||
| identifier for resistance model to be used | ||||||
|
|
||||||
|
|
@@ -73,6 +75,7 @@ def computeForceC(cfg, particles, fields, dem, int frictType, int resistanceType | |||||
| cdef double BSamosAtMedium = cfg.getfloat('Bsamosatmedium') | ||||||
| cdef double RSamosAtMedium = cfg.getfloat('Rsamosatmedium') | ||||||
| cdef double entEroEnergy = cfg.getfloat('entEroEnergy') | ||||||
| cdef double entShearStrength = cfg.getfloat('entShearStrength') | ||||||
| cdef double entShearResistance = cfg.getfloat('entShearResistance') | ||||||
| cdef double entDefResistance = cfg.getfloat('entDefResistance') | ||||||
| cdef double rho = cfg.getfloat('rho') | ||||||
|
|
@@ -375,6 +378,14 @@ def computeForceC(cfg, particles, fields, dem, int frictType, int resistanceType | |||||
| else: | ||||||
| tau = 0.0 | ||||||
|
|
||||||
| # select entrainment model | ||||||
| # compute entrained mass and update tau (in case of TJEM) | ||||||
| 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) | ||||||
| # adding bottom shear resistance contribution | ||||||
| # norm of the friction force >=0 (if 0 -> detatchment) | ||||||
| forceBotTang = - areaPart * tau | ||||||
|
|
@@ -389,14 +400,12 @@ def computeForceC(cfg, particles, fields, dem, int frictType, int resistanceType | |||||
| uMagRes = uMag | ||||||
| forceFrict[k] = forceFrict[k] - forceBotTang/uMagRes | ||||||
|
|
||||||
| # compute entrained mass and if wetSnow case compute total enthalpy of particles with entrainment | ||||||
| entrMassCell = entrMassRaster[indCellY, indCellX] | ||||||
| # continue calculating entrainment | ||||||
| if entrMassCell > 0.0: | ||||||
| # compute entrained mass | ||||||
| dm, areaEntrPart = computeEntMassAndForce(dt, entrMassCell, areaPart, uMag, tau, entEroEnergy, rhoEnt) | ||||||
| # speed loss due to energy loss due to entrained mass | ||||||
| dEnergyEntr = areaEntrPart * entShearResistance + dm * entDefResistance | ||||||
|
|
||||||
| # if wetSnow case compute total enthalpy of particles with entrainment | ||||||
| if frictType == 4 and dm > 0.0: | ||||||
| # enthalpy change due to entrained mass | ||||||
| entrEnthCell = entrEnthRaster[indCellY, indCellX] | ||||||
|
|
@@ -542,6 +551,60 @@ cpdef (double, double) computeEntMassAndForce(double dt, double entrMassCell, | |||||
|
|
||||||
| return dm, areaEntrPart | ||||||
|
|
||||||
| cpdef (double, double, double) computeEntMassAndForceTjem(double dt, double entrMassCell, | ||||||
|
Michael-Pallua marked this conversation as resolved.
Resolved
|
||||||
| double areaPart, double uMag, | ||||||
| double tau, double entShearStrength, | ||||||
| double velMagMin): | ||||||
| """ compute force component due to entrained mass | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add info about which entrainment model (TJEM) |
||||||
|
|
||||||
| Parameters | ||||||
| ---------- | ||||||
| dt: float | ||||||
| time step | ||||||
| entrMassCell : float | ||||||
| available mass for entrainement | ||||||
| areaPart : float | ||||||
| particle area | ||||||
| uMag : float | ||||||
| particle speed (velocity magnitude) | ||||||
| tau : float | ||||||
| bottom shear stress | ||||||
| entShearStrength: float | ||||||
| shear strength of the entrainable snow mass | ||||||
| velMagMin : float | ||||||
| minimum velocity magnitude, avoids division by 0 for resting particles | ||||||
|
|
||||||
| Returns | ||||||
| ------- | ||||||
| dm : float | ||||||
| entrained mass | ||||||
| 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 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| """ | ||||||
| # compute entrained mass | ||||||
| cdef double dm = 0.0 | ||||||
| cdef double areaEntrPart = 0.0 | ||||||
|
|
||||||
| # avoid very small uMag so as not to divide by 0 | ||||||
| if entrMassCell > 0 and uMag > velMagMin: | ||||||
|
|
||||||
| # erosion: erode according to shear strength of snow cover | ||||||
|
|
||||||
| # in contrast to MoTVoellmy tauC 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 | ||||||
| tauC = entShearStrength | ||||||
|
|
||||||
| dm = max(0.0, tau - tauC) * areaPart * dt / uMag | ||||||
| # cannot entrain more than the mass available under the particle | ||||||
| dm = min(dm, entrMassCell * areaPart) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||||||
| areaEntrPart = areaPart | ||||||
| if dm > 0: | ||||||
| tau = min(tau, tauC) | ||||||
|
|
||||||
| return dm, areaEntrPart, tau | ||||||
|
|
||||||
|
|
||||||
| cpdef double computeDetMass(double dt, double detCell, | ||||||
| double areaPart, double uMag): | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -476,11 +476,23 @@ forestThMin = 0.6 | |
| forestVMax = 40. | ||
| forestThMax = 10. | ||
|
|
||
| #++++++++++++ Entrainment Model | ||
| ### Available Models: | ||
| #samosAT | ||
| #tjem | ||
| entrModel = samosAT | ||
|
|
||
| #++++++++++++ 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 samosAT Entrainment Model [m²/s²] | ||
| # Select entEroEnergy = 0 to enable frontal plowing; entEroEnergy > 0 means basal erosion (without frontal plowing) | ||
| entEroEnergy = 5000 | ||
|
|
||
| #++++++++++++ Entrainment Shear Strength | ||
| # Used to determine the strength of the erodible snow cover when using TJEM Entrainment Model [Pa] | ||
| entShearStrength = 500 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
|
|
||
| #++++++++++++Entrainment Energy loss | ||
| # Used to determine the energy loss because of entrainment | ||
| entShearResistance = 0 | ||
| entDefResistance = 0 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
|
||
|
|
||
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?