Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
56 changes: 3 additions & 53 deletions avaframe/com1DFA/com1DFA.py
Original file line number Diff line number Diff line change
Expand Up @@ -2885,59 +2885,9 @@ def savePartToPickle(dictList, outDir, logName, cfg=""):
if empty str all particle properties are saved, t (time info) always appended
"""

dictKeys = [
"nPart",
"x",
"y",
"trajectoryLengthXY",
"trajectoryLengthXYCor",
"trajectoryLengthXYZ",
"z",
"m",
"dmDet",
"massPerPart",
"nPPK",
"mTot",
"h",
"ux",
"uy",
"uz",
"uAcc",
"stoppCriteria",
"kineticEne",
"trajectoryAngle",
"potentialEne",
"peakKinEne",
"peakMassFlowing",
"simName",
"xllcenter",
"yllcenter",
"ID",
"nID",
"parentID",
"t",
"inCellDEM",
"indXDEM",
"indYDEM",
"indPartInCell",
"partInCell",
"secondaryReleaseInfo",
"iterate",
"idFixed",
"peakForceSPH",
"forceSPHIni",
"totalEnthalpy",
"velocityMag",
"nExitedParticles",
"tPlot",
"dmEnt",
"stoppedParticles",
"massInitialized",
"massEntrained",
"massDetrained",
"massStopped",
]

# fetch all available particleProperties
dictKeys = pI.fetchAvailableParticleProperties()
# filter if desired properties are available
propertiesFilter = _buildParticlePropertiesFilter(cfg, dictKeys)

dicts = dictList if isinstance(dictList, list) else [dictList]
Expand Down
65 changes: 65 additions & 0 deletions avaframe/com1DFA/particleInitialisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,68 @@ def createReleaseBuffer(cfg, inputSimLines):
debPlot.plotBufferRelease(inputSimLines, xBuffered, yBuffered)

return inputSimLines


def fetchAvailableParticleProperties():
""" fetch all available particle properties

Returns
--------
particleProperties: list
list of all available particle properties
"""

particleProperties = [
"nPart",
"x",
"y",
"trajectoryLengthXY",
"trajectoryLengthXYCor",
"trajectoryLengthXYZ",
"z",
"m",
"dmDet",
"massPerPart",
"nPPK",
"mTot",
"h",
"ux",
"uy",
"uz",
"uAcc",
"stoppCriteria",
"kineticEne",
"trajectoryAngle",
"potentialEne",
"peakKinEne",
"peakMassFlowing",
"simName",
"xllcenter",
"yllcenter",
"ID",
"nID",
"parentID",
"t",
"inCellDEM",
"indXDEM",
"indYDEM",
"indPartInCell",
"partInCell",
"secondaryReleaseInfo",
"iterate",
"idFixed",
"peakForceSPH",
"forceSPHIni",
"totalEnthalpy",
"velocityMag",
"nExitedParticles",
"tPlot",
"dmEnt",
"stoppedParticles",
"massInitialized",
"massEntrained",
"massDetrained",
"massStopped",
]

return particleProperties
55 changes: 2 additions & 53 deletions avaframe/tests/test_com1DFA.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from avaframe.in3Utils import cfgUtils
import avaframe.in3Utils.geoTrans as geoTrans
import avaframe.com1DFA.DFAtools as DFAtls

import avaframe.com1DFA.particleInitialisation as pI

def test_prepareInputData(tmp_path):
"""test preparing input data"""
Expand Down Expand Up @@ -1520,58 +1520,7 @@ def test_initializeParticles():
releaseLine["header"]["xllcenter"] = dem["originalHeader"]["xllcenter"]
releaseLine["header"]["yllcenter"] = dem["originalHeader"]["yllcenter"]

dictKeys = [
"nPart",
"x",
"y",
"trajectoryLengthXY",
"trajectoryLengthXYCor",
"trajectoryLengthXYZ",
"z",
"m",
"dmDet",
"massPerPart",
"nPPK",
"mTot",
"h",
"ux",
"uy",
"uz",
"uAcc",
"stoppCriteria",
"kineticEne",
"trajectoryAngle",
"potentialEne",
"peakKinEne",
"peakMassFlowing",
"simName",
"xllcenter",
"yllcenter",
"ID",
"nID",
"parentID",
"t",
"inCellDEM",
"indXDEM",
"indYDEM",
"indPartInCell",
"partInCell",
"secondaryReleaseInfo",
"iterate",
"idFixed",
"peakForceSPH",
"forceSPHIni",
"totalEnthalpy",
"velocityMag",
"nExitedParticles",
"tPlot",
"dmEnt",
"stoppedParticles",
"massInitialized",
"massEntrained",
"massDetrained",
"massStopped",
]
dictKeys = pI.fetchAvailableParticleProperties()

# call function to be tested
particles = com1DFA.initializeParticles(cfg["GENERAL"], releaseLine, dem)
Expand Down
8 changes: 6 additions & 2 deletions docs/com1DFAAlgorithm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Other particles properties are also initialized here:

- ``h`` - flow thickness [m]

- ``ux``, ``uy``, ``uz`` - velocity components [ms-1]
- ``ux``, ``uy``, ``uz`` ``velocityMag``- velocity components and magnitude [ms-1]

- ``uAcc`` - approximation for particle acceleration between each computational time step (simply computed by (velocityMagnitude_t0 - velocityMagnitude_t1) / dt)

Expand All @@ -165,7 +165,7 @@ Other particles properties are also initialized here:

- ``trajectoryLengthXYZ`` - traveled length of a particle accumulated over time in xyz

- ``travelAngle`` - travel angle computed using arctan((z0-z)/trajectoryLengthXY)
- ``trajectoryAngle`` - travel angle computed using arctan((z0-z)/trajectoryLengthXY)

- ``ID, parentID`` - particle IDs and parentID required if splitting, merging

Expand All @@ -177,6 +177,10 @@ Other particles properties are also initialized here:

- ``stoppedParticles`` - dictionary with particles (containing x-, y-coordinates, mass and ID) that are stopped (velocity is zero) and deleted from the particles in each time step (only if ``adaptSfcStopped`` is set to ``1`` in the configuration file)

- additional properties used during computation or summary properties for all particles include: ``nPart``, ``massPerPart``, ``nPPK``, ``mTot``, ``stoppCriteria``, ``kineticEne``, ``potentialEne``, ``peakKinEne``, ``peakMassFlowing``, ``simName``, ``xllcenter``, ``yllcenter``, ``ID``, ``nID``, ``parentID``, ``t``, ``inCellDEM``, ``indXDEM``, ``indYDEM``, ``indPartInCell``, ``partInCell``, ``secondaryReleaseInfo``,
``iterate``, ``idFixed``, ``peakForceSPH``, ``forceSPHIni``, ``totalEnthalpy``, ``velocityMag``, ``nExitedParticles``, ``tPlot``, ``stoppedParticles``, ``massInitialized``, ``massEntrained``,
``massDetrained``, ``massStopped``

For more details, see :py:func:`com1DFA.com1DFA.initializeParticles`.

Go back to :ref:`com1DFAAlgorithm:Algorithm graph`
Expand Down
Loading