diff --git a/avaframe/com1DFA/com1DFA.py b/avaframe/com1DFA/com1DFA.py index 85a6cf81d..15c615a6c 100644 --- a/avaframe/com1DFA/com1DFA.py +++ b/avaframe/com1DFA/com1DFA.py @@ -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] diff --git a/avaframe/com1DFA/particleInitialisation.py b/avaframe/com1DFA/particleInitialisation.py index 9d67616e5..90a67bd9a 100644 --- a/avaframe/com1DFA/particleInitialisation.py +++ b/avaframe/com1DFA/particleInitialisation.py @@ -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 diff --git a/avaframe/tests/test_com1DFA.py b/avaframe/tests/test_com1DFA.py index 49854b070..64cca3b46 100644 --- a/avaframe/tests/test_com1DFA.py +++ b/avaframe/tests/test_com1DFA.py @@ -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""" @@ -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) diff --git a/docs/com1DFAAlgorithm.rst b/docs/com1DFAAlgorithm.rst index 9cd97edec..4578b7cc9 100644 --- a/docs/com1DFAAlgorithm.rst +++ b/docs/com1DFAAlgorithm.rst @@ -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) @@ -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 @@ -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`