From fa8044ad23a9f8f9f09f0f050ecf67164db1595b Mon Sep 17 00:00:00 2001 From: Hamidreza Norouzi <72734524+hamidrezanorouzi@users.noreply.github.com> Date: Thu, 28 Sep 2023 23:29:51 +0330 Subject: [PATCH 01/20] Update README.md --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8abc5fda..a85ef5e6 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,16 @@ -**PhasicFlow** is a parallel C++ code for performing DEM simulations. It can run on shared-memory multi-core computational units such as multi-core CPUs or GPUs (for now it works on CUDA-enabled GPUs). The parallelization method mainly relies on loop-level parallelization on a shared-memory computational unit. You can build and run PhasicFlow in serial mode on regular PCs, in parallel mode for multi-core CPUs, or build it for a GPU device to off-load computations to a GPU. In its current statues you can simulate millions of particles (up to 80M particles tested) on a single desktop computer. You can see the [performance tests of PhasicFlow](https://github.com/PhasicFlow/phasicFlow/wiki/Performance-of-phasicFlow) in the wiki page. +**PhasicFlow** is a parallel C++ code for performing DEM simulations. It can run on shared-memory multi-core computational units such as multi-core CPUs or GPUs (for now it works on CUDA-enabled GPUs). The parallelization method mainly relies on loop-level parallelization on a shared-memory computational unit. You can build and run PhasicFlow in serial mode on regular PCs, in parallel mode for multi-core CPUs, or build it for a GPU device to off-load computations to a GPU. In its current statues you can simulate millions of particles (up to 80M particles tested) on a single desktop computer. You can see the [performance tests of PhasicFlow](https://github.com/PhasicFlow/phasicFlow/wiki/Performance-of-phasicFlow) in the wiki page. +**MPI** parallelization with dynamic load balancing is under development. With this level of parallelization, PhasicFlow can leverage the computational power of **multi-gpu** workstations or clusters with distributed memory CPUs. +In summary PhasicFlow can have 6 execution modes: +1. Serial on a single CPU, +2. Parallel on a multi-core computer/node (using OpenMP), +3. Parallel on an nvidia-GPU (using Cuda), +4. Parallel on distributed memory workstation (Using MPI) +5. Parallel on distributed memory workstations with multi-core nodes (using MPI+OpenMP) +6. Parallel on workstations with multiple GPUs (using MPI+Cuda). ## How to build? You can build PhasicFlow for CPU and GPU executions. [Here is a complete step-by-step procedure](https://github.com/PhasicFlow/phasicFlow/wiki/How-to-Build-PhasicFlow). From c562815bbe55d837e1949cc0beedc572ebad98c7 Mon Sep 17 00:00:00 2001 From: Hamidreza Norouzi <72734524+hamidrezanorouzi@users.noreply.github.com> Date: Thu, 28 Sep 2023 23:30:50 +0330 Subject: [PATCH 02/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a85ef5e6..ba8b15ac 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ **MPI** parallelization with dynamic load balancing is under development. With this level of parallelization, PhasicFlow can leverage the computational power of **multi-gpu** workstations or clusters with distributed memory CPUs. In summary PhasicFlow can have 6 execution modes: -1. Serial on a single CPU, +1. Serial on a single CPU core, 2. Parallel on a multi-core computer/node (using OpenMP), 3. Parallel on an nvidia-GPU (using Cuda), 4. Parallel on distributed memory workstation (Using MPI) From 9facc730559daed4595a59dc4624fdd930997e9a Mon Sep 17 00:00:00 2001 From: PhasicFlow <113092888+PhasicFlow@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:48:25 +0330 Subject: [PATCH 03/20] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba8b15ac..e1281936 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ In summary PhasicFlow can have 6 execution modes: 5. Parallel on distributed memory workstations with multi-core nodes (using MPI+OpenMP) 6. Parallel on workstations with multiple GPUs (using MPI+Cuda). ## How to build? -You can build PhasicFlow for CPU and GPU executions. [Here is a complete step-by-step procedure](https://github.com/PhasicFlow/phasicFlow/wiki/How-to-Build-PhasicFlow). +You can build PhasicFlow for CPU and GPU executions. The latest release of PhasicFlow is v-0.1. [Here is a complete step-by-step procedure for building phasicFlow-v-0.1.](https://github.com/PhasicFlow/phasicFlow/wiki/How-to-Build-PhasicFlow). ## Online code documentation You can find a full documentation of the code, its features, and other related materials on [online documentation of the code](https://phasicflow.github.io/phasicFlow/) From 888343c6557f38bc5d341e96b80736b63e40783d Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Sun, 19 May 2024 20:50:00 +0430 Subject: [PATCH 04/20] Tutorial binarySystemOfParticles are modified based on version 1.x --- .../caseSetup/interaction | 54 +++++----- .../caseSetup/particleInsertion | 7 +- .../caseSetup/{sphereShape => shapes} | 8 +- .../binarySystemOfParticles/cleanThisCase | 0 .../binarySystemOfParticles/runThisCase | 0 .../settings/domainDict | 65 ++++++++++++ .../settings/geometryDict | 100 +++++++++++------- .../settings/particlesDict | 89 +++++++++------- .../settings/settingsDict | 35 +++--- 9 files changed, 224 insertions(+), 134 deletions(-) mode change 100755 => 100644 tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction mode change 100755 => 100644 tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion rename tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/{sphereShape => shapes} (68%) mode change 100755 => 100644 mode change 100755 => 100644 tutorials/sphereGranFlow/binarySystemOfParticles/cleanThisCase mode change 100755 => 100644 tutorials/sphereGranFlow/binarySystemOfParticles/runThisCase create mode 100644 tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction old mode 100755 new mode 100644 index 79aef8f9..9910a2fb --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction @@ -6,49 +6,47 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +materials (prop1); // a list of materials names +densities (1000.0); // density of materials [kg/m3] -materials (prop1); // a list of materials names -densities (1000.0); // density of materials [kg/m3] +contactListType sortedContactList; -contactListType sortedContactList; +contactSearch +{ + + method NBS; // method for broad search particle-particle + + updateInterval 10; + + sizeRatio 1.1; + + cellExtent 0.55; + + adjustableBox Yes; +} model { contactForceModel nonLinearNonLimited; + rollingFrictionModel normal; - Yeff (1.0e6); // Young modulus [Pa] + // Property (solid-solid Properties) - Geff (0.8e6); // Shear modulus [Pa] + Yeff (1.0e6); // Young modulus [Pa] - nu (0.25); // Poisson's ratio [-] + Geff (0.8e6); // Shear modulus [Pa] - en (0.7); // coefficient of normal restitution + nu (0.25); // Poisson's ratio [-] - et (1.0); // coefficient of tangential restitution + en (0.7); // coefficient of normal restitution - mu (0.3); // dynamic friction + et (1.0); // coefficient of tangential restitution - mur (0.1); // rolling friction - + mu (0.3); // dynamic friction + + mur (0.1); // rolling friction } -contactSearch -{ - method multiGridNBS; // method for broad search particle-particle - wallMapping multiGridMapping; // method for broad search particle-wall - multiGridNBSInfo - { - updateFrequency 10; // each 10 timesteps, update neighbor list - sizeRatio 1.1; // bounding box size to particle diameter (max) - } - - multiGridMappingInfo - { - updateFrequency 10; // each 10 timesteps, update neighbor list - cellExtent 0.6; // bounding box for particle-wall search (> 0.5) - } - -} diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion old mode 100755 new mode 100644 index dbbc4709..3629d63f --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion @@ -6,10 +6,9 @@ objectName particleInsertion; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +active No; // is insertion active -> yes or no + +collisionCheck No; // is checked -> yes or no -active no; // is insertion active? - -collisionCheck No; // not implemented for yes - diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/sphereShape b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes old mode 100755 new mode 100644 similarity index 68% rename from tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/sphereShape rename to tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes index ffe420d8..625afe3a --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/sphereShape +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes @@ -6,7 +6,9 @@ objectName sphereDict; objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +names (smallSphere largeSphere); // names of shapes -names (smallSphere largeSphere); // names of shapes -diameters (0.003 0.005); // diameter of shapes -materials (prop1 prop1); // material names for shapes +diameters (0.003 0.005); // diameter of shapes + +materials (prop1 prop1); // material names for shapes + \ No newline at end of file diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/cleanThisCase b/tutorials/sphereGranFlow/binarySystemOfParticles/cleanThisCase old mode 100755 new mode 100644 diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/runThisCase b/tutorials/sphereGranFlow/binarySystemOfParticles/runThisCase old mode 100755 new mode 100644 diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict new file mode 100644 index 00000000..c2344fc8 --- /dev/null +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict @@ -0,0 +1,65 @@ +/* -------------------------------*- C++ -*--------------------------------- *\ +| phasicFlow File | +| copyright: www.cemf.ir | +\* ------------------------------------------------------------------------- */ +objectName domainDict; +objectType dictionary; +fileFormat ASCII; +/*---------------------------------------------------------------------------*/ +globalBox +{ + min (-0.12 -0.12 0); + max (0.12 0.12 0.1); +} + +decomposition +{ + direction z; + +} + +boundaries +{ + // How often (how many iterations) do you want to + // rebuild the list of particles in the neighbor list + // of all boundaries in the simulation domain? + neighborListUpdateInterval 50; + + // How often do you want to update the new changes in the + // boundary + updateInterval 10; + + // The distance from the boundary plane within which particles are + // marked to be in the boundary list. + neighborLength 0.004; + + left + { + type exit; // other options: periodict, reflective + } + + right + { + type exit; + } + + bottom + { + type exit; + } + + top + { + type exit; + } + + rear + { + type exit; + } + + front + { + type exit; + } +} \ No newline at end of file diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict index 46d4025b..8f5b0697 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict @@ -6,66 +6,86 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +motionModel rotatingAxis; // motion model can be rotatingAxis or stationary or vibrating -// motion model: rotating object around an axis -motionModel rotatingAxisMotion; +rotatingAxisInfo // information for rotatingAxisMotion motion model +{ + rotAxis + { + p1 (0.0 0.0 0.0); // first point for the axis of rotation + + p2 (0.0 0.0 1.0); // second point for the axis of rotation + + omega 1.214; // rotation speed (rad/s) + } +} surfaces { /* - A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) - and (0 0 0.1) + A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1) */ + cylinder { - type cylinderWall; // type of the wall - p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.1); // end point of cylinder axis - radius1 0.12; // radius at p1 - radius2 0.12; // radius at p2 - resolution 24; // number of divisions - material prop1; // material name of this wall - motion rotAxis; // motion component name + type cylinderWall; // type of the wall + + p1 (0.0 0.0 0.0); // begin point of cylinder axis + + p2 (0.0 0.0 0.1); // end point of cylinder axis + + radius1 0.12; // radius at p1 + + radius2 0.12; // radius at p2 + + resolution 24; // number of divisions + + material prop1; // material name of this wall + + motion rotAxis; // motion component name } /* - This is a plane wall at the rear end of cylinder + This is a plane wall at the rear end of cylinder */ + wall1 { - type planeWall; // type of the wall - p1 (-0.12 -0.12 0.0); // first point of the wall - p2 ( 0.12 -0.12 0.0); // second point - p3 ( 0.12 0.12 0.0); // third point - p4 (-0.12 0.12 0.0); // fourth point - material prop1; // material name of the wall - motion rotAxis; // motion component name + type planeWall; // type of the wall + + p1 (-0.12 -0.12 0.0); // first point of the wall + + p2 ( 0.12 -0.12 0.0); // second point of the wall + + p3 ( 0.12 0.12 0.0); // third point of the wall + + p4 (-0.12 0.12 0.0); // fourth point of the wall + + material prop1; // material name of the wall + + motion rotAxis; // motion component name } /* - This is a plane wall at the front end of cylinder + This is a plane wall at the front end of cylinder */ + wall2 { - type planeWall; - p1 (-0.12 -0.12 0.1); - p2 ( 0.12 -0.12 0.1); - p3 ( 0.12 0.12 0.1); - p4 (-0.12 0.12 0.1); - material prop1; - motion rotAxis; + type planeWall; // type of the wall + + p1 (-0.12 -0.12 0.1); // first point of the wall + + p2 ( 0.12 -0.12 0.1); // second point of the wall + + p3 ( 0.12 0.12 0.1); // third point of the wall + + p4 (-0.12 0.12 0.1); // fourth point of the wall + + material prop1; // material name of the wall + + motion rotAxis; // motion component name } - - } -// information for rotatingAxisMotion motion model -rotatingAxisMotionInfo -{ - rotAxis - { - p1 (0.0 0.0 0.0); // first point for the axis of rotation - p2 (0.0 0.0 1.0); // second point for the axis of rotation - omega 1.214; // rotation speed (rad/s) - } -} \ No newline at end of file + diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict index 089d8f96..114256e7 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict @@ -6,64 +6,73 @@ objectName particlesDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ - -// positions particles -positionParticles -{ - method positionOrdered; // ordered positioning - - maxNumberOfParticles 30001; // maximum number of particles in the simulation - mortonSorting Yes; // perform initial sorting based on morton code? - - cylinder // cylinder region for positioning particles - { - p1 (0.0 0.0 0.003); // begin point of cylinder axis - p2 (0.0 0.0 0.097); // end point of cylinder axis - radius 0.117; // radius of cylinder - } - - positionOrderedInfo - { - diameter 0.005; // minimum space between centers of particles - numPoints 30000; // number of particles in the simulation - axisOrder (z x y); // axis order for filling the space with particles - } -} - setFields { /* - Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles.*/ + Default value for fields defined for particles + These fields should always be defined for simulations with + spherical particles. + */ defaultValue { - velocity realx3 (0 0 0); // linear velocity (m/s) - acceleration realx3 (0 0 0); // linear acceleration (m/s2) - rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - shapeName word smallSphere; // name of the particle shape + velocity realx3 (0 0 0); // linear velocity (m/s) + + acceleration realx3 (0 0 0); // linear acceleration (m/s2) + + rVelocity realx3 (0 0 0); // rotational velocity (rad/s) + + shapeName word smallSphere; // name of the particle shape } selectors { shapeAssigne { - selector selectRange; // type of point selector - selectRangeInfo + selector stridedRange; // type of point selector + + stridedRangeInfo { - begin 0; // begin index of points - end 30000; // end index of points - stride 3; // stride for selector + begin 0; // begin index of points + + end 30000; // end index of points + + stride 3; // stride for selector } - fieldValue // fields that the selector is applied to + + fieldValue // fields that the selector is applied to { - /* - sets shapeName of the selected points to largeSphere*/ - shapeName word largeSphere; + shapeName word largeSphere; // sets shapeName of the selected points to largeSphere } } } } +positionParticles // positions particles +{ + method ordered; // can be ordered or random or empty + + orderedInfo + { + diameter 0.005; // diameter of particles + + numPoints 30000; // number of particles in the simulation + + axisOrder (z x y); // axis order for filling the space with particles + } + + maxNumberOfParticles 30001; // maximum number of particles in the simulation + + regionType cylinder; // can be box or cylinder or sphere + + cylinderInfo // cylinder region for positioning particles + { + p1 (0.0 0.0 0.003); // begin point of cylinder axis + + p2 (0.0 0.0 0.097); // end point of cylinder axis + + radius 0.117; // radius of cylinder + } +} + diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict index 3df9af04..873b4f3c 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict @@ -6,36 +6,33 @@ objectName settingsDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ - - run binarySystemofParticles; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0; // start time for simulation +startTime 0; // start time for simulation -endTime 10; // end time for simulation +endTime 10; // end time for simulation -saveInterval 0.1; // time interval for saving the simulation +saveInterval 0.1; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 -9.8 0); // gravity vector (m/s2) +g (0 -9.8 0); // gravity vector (m/s2) /* - Simulation domain - every particles that goes outside this domain is deleted. + Simulation domain every particles that goes outside this domain is deleted */ -domain -{ - min (-0.12 -0.12 0); - max (0.12 0.12 0.1); -} -integrationMethod AdamsBashforth2; // integration method +// save necessary (i.e., required) data on disk +includeObjects (diameter); +// exclude unnecessary data from saving on disk +excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); -writeFormat ascii; +integrationMethod AdamsBashforth2; // integration method -timersReport Yes; // report timers? +writeFormat ascii; // data writting format (ascii or binary) -timersReportInterval 0.01; // time interval for reporting timers +timersReport Yes; // report timers + +timersReportInterval 0.01; // time interval for reporting timers From 74833ce6a6dfdf5b4d760e1d94892911b49a898f Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 21 May 2024 13:30:16 +0430 Subject: [PATCH 05/20] This toturial has been modified for version 1.x of phasicFlow. --- .../settings/domainDict | 20 +++++++++---------- .../settings/geometryDict | 2 +- .../settings/settingsDict | 4 ---- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict index c2344fc8..77dea711 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict @@ -6,16 +6,16 @@ objectName domainDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -globalBox +globalBox // Simulation domain: every particles that goes outside this domain will be deleted { min (-0.12 -0.12 0); + max (0.12 0.12 0.1); } decomposition { direction z; - } boundaries @@ -25,12 +25,10 @@ boundaries // of all boundaries in the simulation domain? neighborListUpdateInterval 50; - // How often do you want to update the new changes in the - // boundary + // How often do you want to update the new changes in the boundary updateInterval 10; - // The distance from the boundary plane within which particles are - // marked to be in the boundary list. + // The distance from the boundary plane within which particles are marked to be in the boundary list neighborLength 0.004; left @@ -40,26 +38,26 @@ boundaries right { - type exit; + type exit; // other options: periodict, reflective } bottom { - type exit; + type exit; // other options: periodict, reflective } top { - type exit; + type exit; // other options: periodict, reflective } rear { - type exit; + type exit; // other options: periodict, reflective } front { - type exit; + type exit; // other options: periodict, reflective } } \ No newline at end of file diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict index 8f5b0697..df536ef1 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict @@ -8,7 +8,7 @@ fileFormat ASCII; /*---------------------------------------------------------------------------*/ motionModel rotatingAxis; // motion model can be rotatingAxis or stationary or vibrating -rotatingAxisInfo // information for rotatingAxisMotion motion model +rotatingAxisInfo // information for rotatingAxis motion model { rotAxis { diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict index 873b4f3c..595daae5 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict @@ -20,10 +20,6 @@ timePrecision 6; // maximum number of digits for time f g (0 -9.8 0); // gravity vector (m/s2) -/* - Simulation domain every particles that goes outside this domain is deleted -*/ - // save necessary (i.e., required) data on disk includeObjects (diameter); // exclude unnecessary data from saving on disk From afa790b04de834232ac967b7dea3a33ecc8997c2 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 21 May 2024 16:59:15 +0430 Subject: [PATCH 06/20] binarySystemOfParticles --- .../caseSetup/interaction | 4 ++-- .../settings/domainDict | 18 +++++++++--------- .../settings/geometryDict | 4 ---- .../settings/particlesDict | 10 ++++------ 4 files changed, 15 insertions(+), 21 deletions(-) diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction index 9910a2fb..9e154f4c 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction @@ -6,7 +6,7 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -materials (prop1); // a list of materials names +materials (prop1); // properties of material densities (1000.0); // density of materials [kg/m3] @@ -15,7 +15,7 @@ contactListType sortedContactList; contactSearch { - method NBS; // method for broad search particle-particle + method NBS; // method for broad search updateInterval 10; diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict index 77dea711..f4679bbb 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict @@ -20,12 +20,12 @@ decomposition boundaries { - // How often (how many iterations) do you want to + // Determines how often (how many iterations) do you want to // rebuild the list of particles in the neighbor list - // of all boundaries in the simulation domain? + // of all boundaries in the simulation domain neighborListUpdateInterval 50; - // How often do you want to update the new changes in the boundary + // Determines how often do you want to update the new changes in the boundary updateInterval 10; // The distance from the boundary plane within which particles are marked to be in the boundary list @@ -33,31 +33,31 @@ boundaries left { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } right { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } bottom { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } top { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } rear { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } front { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } } \ No newline at end of file diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict index df536ef1..6dfadd8b 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict @@ -22,10 +22,6 @@ rotatingAxisInfo // information for rotatingAxis motion mo surfaces { - /* - A cylinder with begin and end radii 0.12 m and axis points at (0 0 0) and (0 0 0.1) - */ - cylinder { type cylinderWall; // type of the wall diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict index 114256e7..384c17c3 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict @@ -29,7 +29,7 @@ setFields { shapeAssigne { - selector stridedRange; // type of point selector + selector stridedRange; // other options: box, cylinder, sphere, randomPoints stridedRangeInfo { @@ -50,7 +50,7 @@ setFields positionParticles // positions particles { - method ordered; // can be ordered or random or empty + method ordered; // other options: random and empty orderedInfo { @@ -60,12 +60,10 @@ positionParticles // positions particles axisOrder (z x y); // axis order for filling the space with particles } - - maxNumberOfParticles 30001; // maximum number of particles in the simulation - regionType cylinder; // can be box or cylinder or sphere + regionType cylinder; // other options: box and sphere - cylinderInfo // cylinder region for positioning particles + cylinderInfo // cylinder information for positioning particles { p1 (0.0 0.0 0.003); // begin point of cylinder axis From 5e56671c054951670926f67cb900d01eb66bddcb Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 21 May 2024 19:43:58 +0430 Subject: [PATCH 07/20] layeredSiloFilling tutorial is updated for phasicFlow version 1.x. --- .../layeredSiloFilling/caseSetup/interaction | 50 +++--- .../caseSetup/particleInsertion | 146 +++--------------- .../layeredSiloFilling/caseSetup/shapes | 13 ++ .../layeredSiloFilling/cleanThisCase | 0 .../layeredSiloFilling/runThisCase | 0 .../layeredSiloFilling/settings/domainDict | 58 +++++++ .../layeredSiloFilling/settings/geometryDict | 70 ++++++--- .../layeredSiloFilling/settings/particlesDict | 32 ++-- .../layeredSiloFilling/settings/settingsDict | 34 ++-- 9 files changed, 198 insertions(+), 205 deletions(-) mode change 100755 => 100644 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction mode change 100755 => 100644 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion create mode 100644 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes mode change 100755 => 100644 tutorials/sphereGranFlow/layeredSiloFilling/cleanThisCase mode change 100755 => 100644 tutorials/sphereGranFlow/layeredSiloFilling/runThisCase create mode 100644 tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction old mode 100755 new mode 100644 index de2272e8..2c2eac9e --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction @@ -6,15 +6,29 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +materials (lightMat heavyMat wallMat); // a list of materials names -materials (lightMat heavyMat wallMat); // a list of materials names -densities (1000 1500.0 2500); // density of materials [kg/m3] +densities (1000 1500.0 2500); // density of materials [kg/m3] contactListType sortedContactList; +contactSearch +{ + method NBS; // method for broad search particle-particle + + updateInterval 10; + + sizeRatio 1.1; + + cellExtent 0.55; + + adjustableBox Yes; +} + model { contactForceModel nonLinearLimited; + rollingFrictionModel normal; /* @@ -23,51 +37,33 @@ model wallMat-wallMat ); */ - Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa] + Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa] 1.0e6 1.0e6 1.0e6); - Geff (0.8e6 0.8e6 0.8e6 // Shear modulus [Pa] + Geff (0.8e6 0.8e6 0.8e6 // Shear modulus [Pa] 0.8e6 0.8e6 0.8e6); - nu (0.25 0.25 0.25 // Poisson's ratio [-] + nu (0.25 0.25 0.25 // Poisson's ratio [-] 0.25 0.25 0.25); - en (0.97 0.97 0.85 // coefficient of normal restitution + en (0.97 0.97 0.85 // coefficient of normal restitution 0.97 0.85 1.00); - et (1.0 1.0 1.0 // coefficient of tangential restitution + et (1.0 1.0 1.0 // coefficient of tangential restitution 1.0 1.0 1.0); - mu (0.65 0.65 0.35 // dynamic friction + mu (0.65 0.65 0.35 // dynamic friction 0.65 0.35 0.35); - mur (0.1 0.1 0.1 // rolling friction + mur (0.1 0.1 0.1 // rolling friction 0.1 0.1 0.1); } -contactSearch -{ - method NBS; // method for broad search particle-particle - wallMapping cellMapping; // method for broad search particle-wall - - NBSInfo - { - updateFrequency 10; // each 20 timesteps, update neighbor list - sizeRatio 1.1; // bounding box size to particle diameter (max) - } - - cellMappingInfo - { - updateFrequency 10; // each 20 timesteps, update neighbor list - cellExtent 0.6; // bounding box for particle-wall search (> 0.5) - } - -} \ No newline at end of file diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion old mode 100755 new mode 100644 index ff00abb0..860280e8 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion @@ -6,147 +6,47 @@ objectName particleInsertion; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +active yes; // is insertion active -> yes or no -active yes; // is insertion active? - -collisionCheck No; // not implemented for yes +checkForCollision No; // is checked -> yes or no /* -five layers of particles are packed one-by-one using 5 insertion steps. + one layers of particles are packed */ layer0 -{ - type cylinderRegion; // type of insertion region - rate 15000; // insertion rate (particles/s) - startTime 0; // (s) - endTime 0.5; // (s) - interval 0.025; //s +{ + timeControl simulationTime; - cylinderRegionInfo + regionType cylinder; // type of insertion region + + rate 15000; // insertion rate (particles/s) + + startTime 0; // (s) + + endTime 0.5; // (s) + + insertionInterval 0.025; // s + + cylinderInfo { - radius 0.09; // radius of cylinder (m) - p1 ( 0.0 0.0 0.1 ); // (m,m,m) - p2 ( 0.0 0.0 0.11); // (m,m,m) + radius 0.09; // radius of cylinder (m) + + p1 ( 0.0 0.0 0.1 ); // (m,m,m) + + p2 ( 0.0 0.0 0.11); // (m,m,m) } setFields { - velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles + velocity realx3 (0.0 0.0 -0.6); // initial velocity of inserted particles } mixture { - lightSphere 1; // mixture composition of inserted particles - + lightSphere 1; // mixture composition of inserted particles } } -layer1 -{ - type cylinderRegion; - rate 15000; // (particles/s) - startTime 0.7; // (s) - endTime 1.2; // (s) - interval 0.025; //s - cylinderRegionInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.16 ); // (m,m,m) - p2 ( 0.0 0.0 0.17); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - heavySphere 1; // only heavySphere - - } -} - -layer2 -{ - type cylinderRegion; - rate 15000; // (particles/s) - startTime 1.4; // (s) - endTime 1.9; // (s) - interval 0.025; //s - - cylinderRegionInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.2 ); // (m,m,m) - p2 ( 0.0 0.0 0.21); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - lightSphere 1; // only lightSphere - - } -} - -layer3 -{ - type cylinderRegion; - rate 15000; // (particles/s) - startTime 2.1; // (s) - endTime 2.6; // (s) - interval 0.025; //s - - cylinderRegionInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.28 ); // (m,m,m) - p2 ( 0.0 0.0 0.29); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - heavySphere 1; - - } -} - -layer4 -{ - type cylinderRegion; - rate 15000; // (particles/s) - startTime 2.8; // (s) - endTime 3.3; // (s) - interval 0.025; //s - - cylinderRegionInfo - { - radius 0.09; - p1 ( 0.0 0.0 0.37 ); // (m,m,m) - p2 ( 0.0 0.0 0.38); // (m,m,m) - } - - setFields - { - velocity realx3 (0.0 0.0 -0.6); - } - - mixture - { - lightSphere 1; - - } -} diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes new file mode 100644 index 00000000..04cda25c --- /dev/null +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes @@ -0,0 +1,13 @@ +/* -------------------------------*- C++ -*--------------------------------- *\ +| phasicFlow File | +| copyright: www.cemf.ir | +\* ------------------------------------------------------------------------- */ +objectName sphereDict; +objectType sphereShape; +fileFormat ASCII; +/*---------------------------------------------------------------------------*/ +names (lightSphere heavySphere); // names of shapes + +diameters (0.007 0.007); // diameter of shapes + +materials (lightMat heavyMat); // material names for shapes diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/cleanThisCase b/tutorials/sphereGranFlow/layeredSiloFilling/cleanThisCase old mode 100755 new mode 100644 diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/runThisCase b/tutorials/sphereGranFlow/layeredSiloFilling/runThisCase old mode 100755 new mode 100644 diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict new file mode 100644 index 00000000..3ff734a8 --- /dev/null +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict @@ -0,0 +1,58 @@ +/* -------------------------------*- C++ -*--------------------------------- *\ +| phasicFlow File | +| copyright: www.cemf.ir | +\* ------------------------------------------------------------------------- */ +objectName domainDict; +objectType dictionary; +fileFormat ASCII; +/*---------------------------------------------------------------------------*/ +globalBox // Simulation domain: every particles that goes outside this domain will be deleted +{ + min (-0.11 -0.11 -0.11); + + max ( 0.11 0.11 0.41); +} + +boundaries +{ + // Determines how often (how many iterations) do you want to + // rebuild the list of particles in the neighbor list + // of all boundaries in the simulation domain + neighborListUpdateInterval 30; + + // Determines how often do you want to update the new changes in the boundary + updateInterval 10; + + // The distance from the boundary plane within which particles are marked to be in the boundary list + neighborLength 0.004; + + left + { + type exit; // other options: periodict, reflective + } + + right + { + type exit; // other options: periodict, reflective + } + + bottom + { + type exit; // other options: periodict, reflective + } + + top + { + type exit; // other options: periodict, reflective + } + + rear + { + type exit; // other options: periodict, reflective + } + + front + { + type exit; // other options: periodict, reflective + } +} \ No newline at end of file diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict index fa71f7ba..dcdd281e 100644 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict @@ -6,47 +6,67 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ +motionModel stationary; // motion model can be rotatingAxis or stationary or vibrating -// motion model: all surfaces are fixed -motionModel fixedWall; +stationaryInfo +{ + +} surfaces { - cylinderShell { - type cylinderWall; // type of the wall - p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.4); // end point of cylinder axis - radius1 0.1; // radius at p1 - radius2 0.1; // radius at p2 - resolution 36; // number of divisions - material wallMat; // material name of this wall + type cylinderWall; // type of the wall + + p1 (0.0 0.0 0.0); // begin point of cylinder axis + + p2 (0.0 0.0 0.4); // end point of cylinder axis + + radius1 0.1; // radius at p1 + + radius2 0.1; // radius at p2 + + resolution 36; // number of divisions + + material wallMat; // material name of this wall } coneShell { - type cylinderWall; // type of the wall - p1 (0.0 0.0 -0.1); // begin point of cylinder axis - p2 (0.0 0.0 0.0); // end point of cylinder axis - radius1 0.02; // radius at p1 - radius2 0.1; // radius at p2 - resolution 36; // number of divisions - material wallMat; // material name of this wall + type cylinderWall; // type of the wall + + p1 (0.0 0.0 -0.1); // begin point of cylinder axis + + p2 (0.0 0.0 0.0); // end point of cylinder axis + + radius1 0.02; // radius at p1 + + radius2 0.1; // radius at p2 + + resolution 36; // number of divisions + + material wallMat; // material name of this wall } /* - This is a plane wall at the exit of silo + This is a plane wall at the exit of silo */ + exitGate { - type planeWall; - p1 (-0.02 -0.02 -0.1); - p2 ( 0.02 -0.02 -0.1); - p3 ( 0.02 0.02 -0.1); - p4 (-0.02 0.02 -0.1); - material wallMat; + type planeWall; // type of the wall + + p1 (-0.02 -0.02 -0.1); // first point of the wall + + p2 ( 0.02 -0.02 -0.1); // second point of the wall + + p3 ( 0.02 0.02 -0.1); // third point of the wall + + p4 (-0.02 0.02 -0.1); // fourth point of the wall + + material wallMat; // material name of the wall } - } + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict index 83a1e367..ec788fbe 100644 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict @@ -6,27 +6,39 @@ objectName particlesDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ - setFields { + /* + Default value for fields defined for particles + These fields should always be defined for simulations with + spherical particles. + */ + defaultValue { - velocity realx3 (0 0 0); // linear velocity (m/s) - acceleration realx3 (0 0 0); // linear acceleration (m/s2) - rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - shapeName word lightSphere; // name of the particle shape + velocity realx3 (0 0 0); // linear velocity (m/s) + + acceleration realx3 (0 0 0); // linear acceleration (m/s2) + + rVelocity realx3 (0 0 0); // rotational velocity (rad/s) + + shapeName word lightSphere; // name of the particle shape } selectors {} } -// positions particles -positionParticles +positionParticles // positions particles { - method empty; // creates the required fields with zero particles (empty). + method empty; // other options: ordered and random - maxNumberOfParticles 50000; // maximum number of particles in the simulation - mortonSorting Yes; // perform initial sorting based on morton code? + regionType box; // other options: cylinder and sphere + boxInfo // box region for positioning particles + { + min (-0.08 -0.08 0.015); // lower corner point of the box + + max ( 0.08 0.08 0.098); // upper corner point of the box + } } diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict index 6f19dd6e..d1d09442 100644 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict @@ -6,35 +6,29 @@ objectName settingsDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ - run layerdSiloFilling; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0; // start time for simulation +startTime 0.0; // start time for simulation -endTime 5; // end time for simulation +endTime 5.0; // end time for simulation -saveInterval 0.05; // time interval for saving the simulation +saveInterval 0.05; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 0 -9.8); // gravity vector (m/s2) +g (0 0 -9.8); // gravity vector (m/s2) -/* - Simulation domain - every particles that goes outside this domain is deleted. -*/ -domain -{ - min (-0.1 -0.1 -0.1); - max ( 0.1 0.1 0.40); -} +// save necessary (i.e., required) data on disk +includeObjects (diameter); +// exclude unnecessary data from saving on disk +excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); -integrationMethod AdamsBashforth3; // integration method +integrationMethod AdamsBashforth2; // integration method -writeFormat ascii; +writeFormat ascii; // data writting format (ascii or binary) -timersReport Yes; // report timers? +timersReport Yes; // report timers -timersReportInterval 0.01; // time interval for reporting timers +timersReportInterval 0.01; // time interval for reporting timers From 569646c6acf41457147e2fdbc22a383dcab47c5e Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:03:10 +0430 Subject: [PATCH 08/20] Tutorials are updated --- .../caseSetup/interaction | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction old mode 100644 new mode 100755 index 9e154f4c..6593ff8b --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction @@ -6,47 +6,47 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -materials (prop1); // properties of material +materials (prop1); // properties of material -densities (1000.0); // density of materials [kg/m3] +densities (1000.0); // density of materials [kg/m3] -contactListType sortedContactList; +contactListType sortedContactList; contactSearch { - method NBS; // method for broad search + method NBS; // method for broad search - updateInterval 10; + updateInterval 10; - sizeRatio 1.1; + sizeRatio 1.1; cellExtent 0.55; - adjustableBox Yes; + adjustableBox Yes; } model { - contactForceModel nonLinearNonLimited; + contactForceModel nonLinearNonLimited; - rollingFrictionModel normal; + rollingFrictionModel normal; // Property (solid-solid Properties) - Yeff (1.0e6); // Young modulus [Pa] + Yeff (1.0e6); // Young modulus [Pa] - Geff (0.8e6); // Shear modulus [Pa] + Geff (0.8e6); // Shear modulus [Pa] - nu (0.25); // Poisson's ratio [-] + nu (0.25); // Poisson's ratio [-] - en (0.7); // coefficient of normal restitution + en (0.7); // coefficient of normal restitution - et (1.0); // coefficient of tangential restitution + et (1.0); // coefficient of tangential restitution - mu (0.3); // dynamic friction + mu (0.3); // dynamic friction - mur (0.1); // rolling friction + mur (0.1); // rolling friction } From 180bc29df41a6ce08ed641889ee788c037b196a6 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:08:25 +0430 Subject: [PATCH 09/20] Tutorials are updated. --- .../binarySystemOfParticles/caseSetup/particleInsertion | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion old mode 100644 new mode 100755 index 3629d63f..25c1d909 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion @@ -6,9 +6,8 @@ objectName particleInsertion; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -active No; // is insertion active -> yes or no - -collisionCheck No; // is checked -> yes or no +collisionCheck No; // is checked -> yes or no +active No; // is insertion active -> yes or no From 526059707b1fd2c1d0b57e0c504ab0807b566b41 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:09:52 +0430 Subject: [PATCH 10/20] Tutorials are updated. --- .../sphereGranFlow/binarySystemOfParticles/caseSetup/shapes | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes old mode 100644 new mode 100755 index 625afe3a..bc016686 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes @@ -6,9 +6,9 @@ objectName sphereDict; objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (smallSphere largeSphere); // names of shapes +names (smallSphere largeSphere); // names of shapes -diameters (0.003 0.005); // diameter of shapes +diameters (0.003 0.005); // diameter of shapes -materials (prop1 prop1); // material names for shapes +materials (prop1 prop1); // material names for shapes \ No newline at end of file From 7b6271a16553c12f70793f2b89ff39a64543cbff Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:15:45 +0430 Subject: [PATCH 11/20] Tutorial is updated for version 1.x. --- .../settings/domainDict | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict old mode 100644 new mode 100755 index f4679bbb..a94bdb3c --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict @@ -6,11 +6,11 @@ objectName domainDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -globalBox // Simulation domain: every particles that goes outside this domain will be deleted +globalBox // Simulation domain: every particles that goes outside this domain will be deleted { - min (-0.12 -0.12 0); + min (-0.12 -0.12 0); - max (0.12 0.12 0.1); + max (0.12 0.12 0.1); } decomposition @@ -23,41 +23,41 @@ boundaries // Determines how often (how many iterations) do you want to // rebuild the list of particles in the neighbor list // of all boundaries in the simulation domain - neighborListUpdateInterval 50; + neighborListUpdateInterval 50; // Determines how often do you want to update the new changes in the boundary - updateInterval 10; + updateInterval 10; // The distance from the boundary plane within which particles are marked to be in the boundary list - neighborLength 0.004; + neighborLength 0.004; left { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } right { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } bottom { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } top { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } rear { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } front { - type exit; // other options: periodict, reflective + type exit; // other options: periodict, reflective } } \ No newline at end of file From 7b2c7c6199ebc547f008ac267bc693917eca84f5 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:19:37 +0430 Subject: [PATCH 12/20] Tutorial is updated for 1.x. --- .../settings/geometryDict | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict old mode 100644 new mode 100755 index 6dfadd8b..db1c16ea --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict @@ -6,17 +6,17 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -motionModel rotatingAxis; // motion model can be rotatingAxis or stationary or vibrating +motionModel rotatingAxis; // motion model can be rotatingAxis or stationary or vibrating -rotatingAxisInfo // information for rotatingAxis motion model +rotatingAxisInfo // information for rotatingAxis motion model { rotAxis { - p1 (0.0 0.0 0.0); // first point for the axis of rotation + p1 (0.0 0.0 0.0); // first point for the axis of rotation - p2 (0.0 0.0 1.0); // second point for the axis of rotation + p2 (0.0 0.0 1.0); // second point for the axis of rotation - omega 1.214; // rotation speed (rad/s) + omega 1.214; // rotation speed (rad/s) } } @@ -24,21 +24,21 @@ surfaces { cylinder { - type cylinderWall; // type of the wall + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 0.0); // begin point of cylinder axis + p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.1); // end point of cylinder axis + p2 (0.0 0.0 0.1); // end point of cylinder axis - radius1 0.12; // radius at p1 + radius1 0.12; // radius at p1 - radius2 0.12; // radius at p2 + radius2 0.12; // radius at p2 - resolution 24; // number of divisions + resolution 24; // number of divisions - material prop1; // material name of this wall + material prop1; // material name of this wall - motion rotAxis; // motion component name + motion rotAxis; // motion component name } /* @@ -47,19 +47,19 @@ surfaces wall1 { - type planeWall; // type of the wall + type planeWall; // other options: cuboidWall and cylinderWall p1 (-0.12 -0.12 0.0); // first point of the wall - p2 ( 0.12 -0.12 0.0); // second point of the wall + p2 (0.12 -0.12 0.0); // second point of the wall - p3 ( 0.12 0.12 0.0); // third point of the wall + p3 (0.12 0.12 0.0); // third point of the wall - p4 (-0.12 0.12 0.0); // fourth point of the wall + p4 (-0.12 0.12 0.0); // fourth point of the wall - material prop1; // material name of the wall + material prop1; // material name of the wall - motion rotAxis; // motion component name + motion rotAxis; // motion component name } /* @@ -68,19 +68,19 @@ surfaces wall2 { - type planeWall; // type of the wall + type planeWall; // other options: cuboidWall and cylinderWall p1 (-0.12 -0.12 0.1); // first point of the wall - p2 ( 0.12 -0.12 0.1); // second point of the wall + p2 (0.12 -0.12 0.1); // second point of the wall - p3 ( 0.12 0.12 0.1); // third point of the wall + p3 (0.12 0.12 0.1); // third point of the wall - p4 (-0.12 0.12 0.1); // fourth point of the wall + p4 (-0.12 0.12 0.1); // fourth point of the wall - material prop1; // material name of the wall + material prop1; // material name of the wall - motion rotAxis; // motion component name + motion rotAxis; // motion component name } } From afa7d63c841ba6c3df9ccc98c5267146cdaedb79 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:23:05 +0430 Subject: [PATCH 13/20] Tutorial is updated for version 1.x. --- .../binarySystemOfParticles/settings/particlesDict | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict old mode 100644 new mode 100755 index 384c17c3..fb1c5e43 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict @@ -9,9 +9,8 @@ fileFormat ASCII; setFields { /* - Default value for fields defined for particles - These fields should always be defined for simulations with - spherical particles. + Default value for fields defined for particles: + These fields should always be defined for simulations with spherical particles */ defaultValue From 159ec5f1ff06752369ff2d8b08c9d753b62a8115 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:25:10 +0430 Subject: [PATCH 14/20] Tutorial is updated for version 1.x. --- .../settings/settingsDict | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict old mode 100644 new mode 100755 index 595daae5..cda6dfdf --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict @@ -6,29 +6,29 @@ objectName settingsDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -run binarySystemofParticles; +run binarySystemofParticles; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (seconds) -startTime 0; // start time for simulation +startTime 0.0; // start time for simulation -endTime 10; // end time for simulation +endTime 10.0; // end time for simulation -saveInterval 0.1; // time interval for saving the simulation +saveInterval 0.1; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 -9.8 0); // gravity vector (m/s2) +g (0 -9.8 0); // gravity vector (m/s2) // save necessary (i.e., required) data on disk includeObjects (diameter); // exclude unnecessary data from saving on disk excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); -integrationMethod AdamsBashforth2; // integration method +integrationMethod AdamsBashforth2; // integration method -writeFormat ascii; // data writting format (ascii or binary) +writeFormat ascii; // data writting format (ascii or binary) -timersReport Yes; // report timers +timersReport Yes; // report timers -timersReportInterval 0.01; // time interval for reporting timers +timersReportInterval 0.01; // time interval for reporting timers From 2f9db61983ab6a09b26ddf3461a5016de7adc2b8 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 12:38:21 +0430 Subject: [PATCH 15/20] The Tutorial is updated for version 1.x. --- .../layeredSiloFilling/caseSetup/interaction | 21 +++++----- .../caseSetup/particleInsertion | 4 +- .../layeredSiloFilling/caseSetup/shapes | 6 +-- .../layeredSiloFilling/caseSetup/sphereShape | 12 ------ .../layeredSiloFilling/cleanThisCase | 0 .../layeredSiloFilling/runThisCase | 0 .../layeredSiloFilling/settings/domainDict | 4 +- .../layeredSiloFilling/settings/geometryDict | 42 +++++++++---------- .../layeredSiloFilling/settings/particlesDict | 18 ++++---- .../layeredSiloFilling/settings/settingsDict | 22 +++++----- 10 files changed, 58 insertions(+), 71 deletions(-) mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes delete mode 100755 tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/sphereShape mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/cleanThisCase mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/runThisCase mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict mode change 100644 => 100755 tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction old mode 100644 new mode 100755 index 2c2eac9e..107400c1 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction @@ -6,9 +6,9 @@ objectName interaction; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -materials (lightMat heavyMat wallMat); // a list of materials names +materials (lightMat heavyMat wallMat); // a list of materials names -densities (1000 1500.0 2500); // density of materials [kg/m3] +densities (1000 1500.0 2500); // density of materials [kg/m3] contactListType sortedContactList; @@ -37,33 +37,32 @@ model wallMat-wallMat ); */ - Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa] + Yeff (1.0e6 1.0e6 1.0e6 // Young modulus [Pa] 1.0e6 1.0e6 1.0e6); - Geff (0.8e6 0.8e6 0.8e6 // Shear modulus [Pa] + Geff (0.8e6 0.8e6 0.8e6 // Shear modulus [Pa] 0.8e6 0.8e6 0.8e6); - nu (0.25 0.25 0.25 // Poisson's ratio [-] + nu (0.25 0.25 0.25 // Poisson's ratio [-] 0.25 0.25 0.25); - en (0.97 0.97 0.85 // coefficient of normal restitution + en (0.97 0.97 0.85 // coefficient of normal restitution 0.97 0.85 1.00); - et (1.0 1.0 1.0 // coefficient of tangential restitution + et (1.0 1.0 1.0 // coefficient of tangential restitution 1.0 1.0 1.0); - mu (0.65 0.65 0.35 // dynamic friction + mu (0.65 0.65 0.35 // dynamic friction 0.65 0.35 0.35); - mur (0.1 0.1 0.1 // rolling friction + mur (0.1 0.1 0.1 // rolling friction 0.1 0.1 - 0.1); - + 0.1); } diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion old mode 100644 new mode 100755 index 860280e8..c6387c8e --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion @@ -6,9 +6,9 @@ objectName particleInsertion; objectType dicrionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -active yes; // is insertion active -> yes or no +active Yes; // is insertion active -> yes or no -checkForCollision No; // is checked -> yes or no +checkForCollision No; // is checked -> yes or no /* one layers of particles are packed diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes old mode 100644 new mode 100755 index 04cda25c..f35ae33c --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes @@ -6,8 +6,8 @@ objectName sphereDict; objectType sphereShape; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -names (lightSphere heavySphere); // names of shapes +names (lightSphere heavySphere); // names of shapes -diameters (0.007 0.007); // diameter of shapes +diameters (0.007 0.007); // diameter of shapes -materials (lightMat heavyMat); // material names for shapes +materials (lightMat heavyMat); // material names for shapes diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/sphereShape b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/sphereShape deleted file mode 100755 index 749d1f0c..00000000 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/sphereShape +++ /dev/null @@ -1,12 +0,0 @@ -/* -------------------------------*- C++ -*--------------------------------- *\ -| phasicFlow File | -| copyright: www.cemf.ir | -\* ------------------------------------------------------------------------- */ -objectName sphereDict; -objectType sphereShape; -fileFormat ASCII; -/*---------------------------------------------------------------------------*/ - -names (lightSphere heavySphere); // names of shapes -diameters (0.007 0.007); // diameter of shapes -materials (lightMat heavyMat); // material names for shapes diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/cleanThisCase b/tutorials/sphereGranFlow/layeredSiloFilling/cleanThisCase old mode 100644 new mode 100755 diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/runThisCase b/tutorials/sphereGranFlow/layeredSiloFilling/runThisCase old mode 100644 new mode 100755 diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict old mode 100644 new mode 100755 index 3ff734a8..1a8009f1 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict @@ -21,10 +21,10 @@ boundaries neighborListUpdateInterval 30; // Determines how often do you want to update the new changes in the boundary - updateInterval 10; + updateInterval 10; // The distance from the boundary plane within which particles are marked to be in the boundary list - neighborLength 0.004; + neighborLength 0.004; left { diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict old mode 100644 new mode 100755 index dcdd281e..3433f4f4 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict @@ -6,7 +6,7 @@ objectName geometryDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -motionModel stationary; // motion model can be rotatingAxis or stationary or vibrating +motionModel stationary; // motion model can be rotatingAxis or stationary or vibrating stationaryInfo { @@ -17,36 +17,36 @@ surfaces { cylinderShell { - type cylinderWall; // type of the wall + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 0.0); // begin point of cylinder axis + p1 (0.0 0.0 0.0); // begin point of cylinder axis - p2 (0.0 0.0 0.4); // end point of cylinder axis + p2 (0.0 0.0 0.4); // end point of cylinder axis - radius1 0.1; // radius at p1 + radius1 0.1; // radius at p1 - radius2 0.1; // radius at p2 + radius2 0.1; // radius at p2 - resolution 36; // number of divisions + resolution 36; // number of divisions - material wallMat; // material name of this wall + material wallMat; // material name of this wall } coneShell { - type cylinderWall; // type of the wall + type cylinderWall; // other options: cuboidWall and planeWall - p1 (0.0 0.0 -0.1); // begin point of cylinder axis + p1 (0.0 0.0 -0.1); // begin point of cylinder axis - p2 (0.0 0.0 0.0); // end point of cylinder axis + p2 (0.0 0.0 0.0); // end point of cylinder axis - radius1 0.02; // radius at p1 + radius1 0.02; // radius at p1 - radius2 0.1; // radius at p2 + radius2 0.1; // radius at p2 - resolution 36; // number of divisions + resolution 36; // number of divisions - material wallMat; // material name of this wall + material wallMat; // material name of this wall } /* @@ -55,17 +55,17 @@ surfaces exitGate { - type planeWall; // type of the wall + type planeWall; // other options: cuboidWall and cylinderWall - p1 (-0.02 -0.02 -0.1); // first point of the wall + p1 (-0.02 -0.02 -0.1); // first point of the wall - p2 ( 0.02 -0.02 -0.1); // second point of the wall + p2 ( 0.02 -0.02 -0.1); // second point of the wall - p3 ( 0.02 0.02 -0.1); // third point of the wall + p3 ( 0.02 0.02 -0.1); // third point of the wall - p4 (-0.02 0.02 -0.1); // fourth point of the wall + p4 (-0.02 0.02 -0.1); // fourth point of the wall - material wallMat; // material name of the wall + material wallMat; // material name of the wall } } diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict old mode 100644 new mode 100755 index ec788fbe..98cdc79e --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict @@ -16,13 +16,13 @@ setFields defaultValue { - velocity realx3 (0 0 0); // linear velocity (m/s) + velocity realx3 (0 0 0); // linear velocity (m/s) - acceleration realx3 (0 0 0); // linear acceleration (m/s2) + acceleration realx3 (0 0 0); // linear acceleration (m/s2) - rVelocity realx3 (0 0 0); // rotational velocity (rad/s) + rVelocity realx3 (0 0 0); // rotational velocity (rad/s) - shapeName word lightSphere; // name of the particle shape + shapeName word lightSphere; // name of the particle shape } selectors @@ -31,14 +31,14 @@ setFields positionParticles // positions particles { - method empty; // other options: ordered and random + method empty; // other options: ordered and random - regionType box; // other options: cylinder and sphere + regionType box; // other options: cylinder and sphere - boxInfo // box region for positioning particles + boxInfo // box region for positioning particles { - min (-0.08 -0.08 0.015); // lower corner point of the box + min (-0.08 -0.08 0.015); // lower corner point of the box - max ( 0.08 0.08 0.098); // upper corner point of the box + max ( 0.08 0.08 0.098); // upper corner point of the box } } diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict old mode 100644 new mode 100755 index d1d09442..04b3b9b7 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict @@ -6,29 +6,29 @@ objectName settingsDict; objectType dictionary; fileFormat ASCII; /*---------------------------------------------------------------------------*/ -run layerdSiloFilling; +run layerdSiloFilling; -dt 0.00001; // time step for integration (s) +dt 0.00001; // time step for integration (s) -startTime 0.0; // start time for simulation +startTime 0.0; // start time for simulation -endTime 5.0; // end time for simulation +endTime 5.0; // end time for simulation -saveInterval 0.05; // time interval for saving the simulation +saveInterval 0.05; // time interval for saving the simulation -timePrecision 6; // maximum number of digits for time folder +timePrecision 6; // maximum number of digits for time folder -g (0 0 -9.8); // gravity vector (m/s2) +g (0 0 -9.8); // gravity vector (m/s2) // save necessary (i.e., required) data on disk includeObjects (diameter); // exclude unnecessary data from saving on disk excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); -integrationMethod AdamsBashforth2; // integration method +integrationMethod AdamsBashforth2; // integration method -writeFormat ascii; // data writting format (ascii or binary) +writeFormat ascii; // data writting format (ascii or binary) -timersReport Yes; // report timers +timersReport Yes; // report timers -timersReportInterval 0.01; // time interval for reporting timers +timersReportInterval 0.01; // time interval for reporting timers From b591d8fda1a1bf0940ef71a8ae5dc9dbf17234e0 Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 13:10:19 +0430 Subject: [PATCH 16/20] binarySystemOfParticles updated --- .../binarySystemOfParticles/caseSetup/interaction | 1 - .../binarySystemOfParticles/caseSetup/particleInsertion | 2 -- .../sphereGranFlow/binarySystemOfParticles/caseSetup/shapes | 1 - .../sphereGranFlow/binarySystemOfParticles/settings/domainDict | 2 +- .../binarySystemOfParticles/settings/geometryDict | 2 -- .../binarySystemOfParticles/settings/particlesDict | 2 -- .../binarySystemOfParticles/settings/settingsDict | 1 + 7 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction index 6593ff8b..3a7920f2 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/interaction @@ -49,4 +49,3 @@ model mur (0.1); // rolling friction } - diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion index 25c1d909..47ba5063 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/particleInsertion @@ -9,5 +9,3 @@ fileFormat ASCII; collisionCheck No; // is checked -> yes or no active No; // is insertion active -> yes or no - - diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes index bc016686..7c3fe1d3 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/caseSetup/shapes @@ -11,4 +11,3 @@ names (smallSphere largeSphere); // names of shapes diameters (0.003 0.005); // diameter of shapes materials (prop1 prop1); // material names for shapes - \ No newline at end of file diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict index a94bdb3c..afda899f 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/domainDict @@ -60,4 +60,4 @@ boundaries { type exit; // other options: periodict, reflective } -} \ No newline at end of file +} diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict index db1c16ea..baff5621 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/geometryDict @@ -83,5 +83,3 @@ surfaces motion rotAxis; // motion component name } } - - diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict index fb1c5e43..1dcb3938 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/particlesDict @@ -71,5 +71,3 @@ positionParticles // positions particles radius 0.117; // radius of cylinder } } - - diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict index cda6dfdf..b7aeb33b 100755 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/settings/settingsDict @@ -32,3 +32,4 @@ writeFormat ascii; // data writting format (ascii or binar timersReport Yes; // report timers timersReportInterval 0.01; // time interval for reporting timers + \ No newline at end of file From c8a28f82c9a25d23a97a44a633c6025173f057fc Mon Sep 17 00:00:00 2001 From: Ramin Khodabandeh Date: Tue, 28 May 2024 13:24:34 +0430 Subject: [PATCH 17/20] layeredSiloFilling updated --- .../sphereGranFlow/layeredSiloFilling/caseSetup/interaction | 2 ++ .../layeredSiloFilling/caseSetup/particleInsertion | 2 ++ .../sphereGranFlow/layeredSiloFilling/caseSetup/shapes | 2 ++ .../sphereGranFlow/layeredSiloFilling/settings/domainDict | 4 +++- .../sphereGranFlow/layeredSiloFilling/settings/geometryDict | 4 ++++ .../layeredSiloFilling/settings/particlesDict | 1 + .../sphereGranFlow/layeredSiloFilling/settings/settingsDict | 6 +++++- 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction index 107400c1..d73e4195 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/interaction @@ -66,3 +66,5 @@ model 0.1); } + + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion index c6387c8e..fd311c48 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/particleInsertion @@ -50,3 +50,5 @@ layer0 + + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes index f35ae33c..603c28cb 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes +++ b/tutorials/sphereGranFlow/layeredSiloFilling/caseSetup/shapes @@ -11,3 +11,5 @@ names (lightSphere heavySphere); // names of shapes diameters (0.007 0.007); // diameter of shapes materials (lightMat heavyMat); // material names for shapes + + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict index 1a8009f1..c9f52b8d 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/domainDict @@ -55,4 +55,6 @@ boundaries { type exit; // other options: periodict, reflective } -} \ No newline at end of file +} + + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict index 3433f4f4..fcab5c6d 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/geometryDict @@ -70,3 +70,7 @@ surfaces } + + + + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict index 98cdc79e..5145dddc 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/particlesDict @@ -42,3 +42,4 @@ positionParticles // positions particle max ( 0.08 0.08 0.098); // upper corner point of the box } } + diff --git a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict index 04b3b9b7..44823844 100755 --- a/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict +++ b/tutorials/sphereGranFlow/layeredSiloFilling/settings/settingsDict @@ -20,7 +20,8 @@ timePrecision 6; // maximum number of digits for time folder g (0 0 -9.8); // gravity vector (m/s2) -// save necessary (i.e., required) data on disk +// save data objects that are not automatically saved on disk. +// overrides the default behavior includeObjects (diameter); // exclude unnecessary data from saving on disk excludeObjects (rVelocity.dy1 pStructPosition.dy1 pStructVelocity.dy1); @@ -32,3 +33,6 @@ writeFormat ascii; // data writting format (ascii or binar timersReport Yes; // report timers timersReportInterval 0.01; // time interval for reporting timers + + + From ca1bc218d2b84358ae542f57564996f969d340a1 Mon Sep 17 00:00:00 2001 From: ramin1728 <85011717+ramin1728@users.noreply.github.com> Date: Tue, 28 May 2024 13:26:34 +0330 Subject: [PATCH 18/20] Update README.md --- .../binarySystemOfParticles/README.md | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/tutorials/sphereGranFlow/binarySystemOfParticles/README.md b/tutorials/sphereGranFlow/binarySystemOfParticles/README.md index b18c204c..299245d9 100644 --- a/tutorials/sphereGranFlow/binarySystemOfParticles/README.md +++ b/tutorials/sphereGranFlow/binarySystemOfParticles/README.md @@ -1,6 +1,6 @@ # Problem definition -A rotating drum with two particle sizes is randomly filled and let it rotate to see the segregation of particles. -The focus of this tutorial is to show how to use the pre-processing tool, `particlesPhasicFlow`, to create the initial mixture of small and large particles. + +A rotating drum is randomly filled with two particle sizes and rotated to observe particle segregation. The focus of this tutorial is to show how to use the preprocessing tool `particlesPhasicFlow` to create the initial mixture of small and large particles. **Note:** It is supposed that you have reviewed [simulating a rotating drum](https://github.com/PhasicFlow/phasicFlow/wiki/Simulating-a-rotating-drum) tutorial before starting this tutorial. @@ -14,11 +14,13 @@ a view of the rotating drum with small and large particles after 7 seconds of ro *** # Case setup -PhasicFlow simulation case setup is based on the text-based files that we provide in two folders located in the simulation case folder: `settings` and `caseSetup`. Here we will have a look at some important files and the rest can be found in the tutorial folder of this case setup. + +In the file `caseSetup/sphereShape` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined. [Simulation case setup files can be found in tutorials/sphereGranFlow folder.](https://github.com/PhasicFlow/phasicFlow/tree/main/tutorials/sphereGranFlow/binarySystemOfParticles) ### Shape definition -In file `caseSetup/sphereShape`, two particle types with names `smallSphere` and `largeSphere` and diameters 3 and 5 mm are defined. + +In the file `caseSetup/sphereShape` two particle types with the names `smallSphere` and `largeSphere` and the diameters 3 and 5 mm are defined.
in caseSetup/sphereShape file @@ -31,7 +33,7 @@ materials (prop1 prop1); // material names for shapes ``` ### Positioning and initial mixture -In dictionary `positionParticles` located in file `settings/particlesDict`, 30000 particles are located in a cylindrical region. These particles are positioned in order along `z`, `x` and then `y` axis with 0.005 m distance between their centers. +In the dictionary `positionParticles` located in file `settings/particlesDict`, 30000 particles are located in a cylindrical region. These particles are positioned in order along `z`, `x` and then `y` axis with 0.005 m distance between their centers.
in settings/particlesDict file @@ -42,10 +44,16 @@ in settings/particlesDict file // positions particles positionParticles { - method positionOrdered; // ordered positioning + method ordered; // other options: random or empty - maxNumberOfParticles 30001; // maximum number of particles in the simulation - mortonSorting Yes; // perform initial sorting based on morton code? + orderedInfo + { + diameter 0.005; // minimum space between centers of particles + numPoints 30000; // number of particles in the simulation + axisOrder (z x y); // axis order for filling the space with particles + } + + regionType cylinder; // other options: box and sphere cylinder // cylinder region for positioning particles { @@ -53,17 +61,9 @@ positionParticles p2 (0.0 0.0 0.097); // end point of cylinder axis (m m m) radius 0.117; // radius of cylinder (m) } - - positionOrderedInfo - { - diameter 0.005; // minimum space between centers of particles - numPoints 30000; // number of particles in the simulation - axisOrder (z x y); // axis order for filling the space with particles - } } ``` - -In dictionary `setFields` located in file `settings/particlesDict`, you define the initial `velocity`, `acceleration`, `rotVelocity`, and `shapeName` fields for all 30000 particles in the simulation. In `selectors` dictionary, you can select subsets of particles and set the field value for these subsets. In `shapeAssigne` sub-dictionary, the `selectRange` selector is defined. It defines a range with `begin` (begin index), `end` (end index) and `stride` to select particles. And in `fieldValue` sub-dictionary, the fields values for selected particles are set (any number of field values can be set here). +In the `setFields` dictionary, located in the `settings/particlesDict` file, you define the initial `velocity`, `acceleration`, `rotVelocity` and `shapeName` fields for all 30000 particles in the simulation. In the `selectors' dictionary, you can select subsets of particles and set the field value for those subsets. The `selectRange` selector is defined in the `shapeAssigne` subdictionary. It defines a range with `begin`, `end` and `stride` to select particles. And in the `fieldValue` subdictionary the field values for selected particles are set (any number of field values can be set here). **Note:** Other selectors are: `selectBox` that selects particles inside a box and `randomSelect` that selects particles randomly from a given index range. @@ -77,7 +77,8 @@ setFields /* Default value for fields defined for particles These fields should always be defined for simulations with - spherical particles.*/ + spherical particles. +*/ defaultValue { @@ -91,8 +92,9 @@ setFields { shapeAssigne { - selector selectRange; // type of point selector - selectRangeInfo + selector stridedRange; // other options: box, cylinder, sphere, randomPoints + + stridedRangeInfo { begin 0; // begin index of points end 30000; // end index of points @@ -101,10 +103,10 @@ setFields fieldValue // fields that the selector is applied to { /* - sets shapeName of the selected points to largeSphere*/ + sets shapeName of the selected points to largeSphere + */ shapeName word largeSphere; } - } } From 2bd95b933f285d2fc73ea18b40e4d248c65290fc Mon Sep 17 00:00:00 2001 From: alireza Hosseini Date: Sun, 17 Nov 2024 10:19:40 +0330 Subject: [PATCH 19/20] course graining added --- CMakeLists.txt | 2 +- cmake/bashrc | 2 +- solvers/CMakeLists.txt | 2 + solvers/grainGranFlow/CMakeLists.txt | 7 + solvers/grainGranFlow/createDEMComponents.hpp | 50 +++ solvers/grainGranFlow/grainGranFlow.cpp | 123 +++++ src/Integration/CMakeLists.txt | 6 +- src/Interaction/CMakeLists.txt | 6 + .../contactForce/cGAbsoluteLinearCF.hpp | 350 +++++++++++++++ .../contactForce/cGRelativeLinearCF.hpp | 340 ++++++++++++++ .../Models/grainContactForceModels.hpp | 45 ++ .../Models/rolling/grainRolling.hpp | 119 +++++ .../boundaryGrainInteraction.cpp | 104 +++++ .../boundaryGrainInteraction.hpp | 186 ++++++++ .../boundaryGrainInteractionList.cpp | 23 + .../boundaryGrainInteractionList.hpp | 40 ++ .../createBoundaryGrainInteraction.hpp | 31 ++ .../periodicBoundaryGrainInteraction.cpp | 70 +++ .../periodicBoundaryGrainInteraction.hpp | 96 ++++ .../periodicBoundarySIKernels.hpp | 121 +++++ .../grainInteraction/grainInteraction.cpp | 359 +++++++++++++++ .../grainInteraction/grainInteraction.hpp | 169 +++++++ .../grainInteractionKernels.hpp | 337 ++++++++++++++ .../grainTriSurfaceContact.hpp | 231 ++++++++++ .../grainInteraction/pLine.hpp | 107 +++++ .../grainInteraction/triWall.hpp | 108 +++++ .../grainInteractionsLinearModels.cpp | 62 +++ .../grainInteractionsNonLinearModModels.cpp | 43 ++ .../grainInteractionsNonLinearModels.cpp | 43 ++ src/Particles/CMakeLists.txt | 9 + .../GrainParticles/boundaryGrainParticles.cpp | 64 +++ .../GrainParticles/boundaryGrainParticles.hpp | 80 ++++ .../boundaryGrainParticlesList.cpp | 19 + .../boundaryGrainParticlesList.hpp | 36 ++ .../grainParticles/grainParticles.cpp | 422 ++++++++++++++++++ .../grainParticles/grainParticles.hpp | 236 ++++++++++ .../grainParticles/grainParticlesKernels.cpp | 101 +++++ .../grainParticles/grainParticlesKernels.hpp | 59 +++ .../GrainParticles/grainShape/grainShape.cpp | 242 ++++++++++ .../GrainParticles/grainShape/grainShape.hpp | 110 +++++ .../Insertion/Insertion/Insertions.cpp | 3 +- .../Insertion/Insertion/Insertions.hpp | 4 + .../boundaries/boundaryBase/boundaryBase.hpp | 4 +- 43 files changed, 4566 insertions(+), 5 deletions(-) create mode 100755 solvers/grainGranFlow/CMakeLists.txt create mode 100755 solvers/grainGranFlow/createDEMComponents.hpp create mode 100755 solvers/grainGranFlow/grainGranFlow.cpp create mode 100755 src/Interaction/Models/contactForce/cGAbsoluteLinearCF.hpp create mode 100755 src/Interaction/Models/contactForce/cGRelativeLinearCF.hpp create mode 100755 src/Interaction/Models/grainContactForceModels.hpp create mode 100755 src/Interaction/Models/rolling/grainRolling.hpp create mode 100644 src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.cpp create mode 100644 src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.hpp create mode 100644 src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.cpp create mode 100644 src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.hpp create mode 100644 src/Interaction/grainInteraction/boundaries/createBoundaryGrainInteraction.hpp create mode 100644 src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.cpp create mode 100644 src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.hpp create mode 100644 src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundarySIKernels.hpp create mode 100644 src/Interaction/grainInteraction/grainInteraction/grainInteraction.cpp create mode 100644 src/Interaction/grainInteraction/grainInteraction/grainInteraction.hpp create mode 100644 src/Interaction/grainInteraction/grainInteraction/grainInteractionKernels.hpp create mode 100644 src/Interaction/grainInteraction/grainInteraction/grainTriSurfaceContact.hpp create mode 100644 src/Interaction/grainInteraction/grainInteraction/pLine.hpp create mode 100644 src/Interaction/grainInteraction/grainInteraction/triWall.hpp create mode 100755 src/Interaction/grainInteraction/grainInteractionsLinearModels.cpp create mode 100755 src/Interaction/grainInteraction/grainInteractionsNonLinearModModels.cpp create mode 100755 src/Interaction/grainInteraction/grainInteractionsNonLinearModels.cpp create mode 100644 src/Particles/GrainParticles/boundaryGrainParticles.cpp create mode 100644 src/Particles/GrainParticles/boundaryGrainParticles.hpp create mode 100644 src/Particles/GrainParticles/boundaryGrainParticlesList.cpp create mode 100644 src/Particles/GrainParticles/boundaryGrainParticlesList.hpp create mode 100644 src/Particles/GrainParticles/grainParticles/grainParticles.cpp create mode 100644 src/Particles/GrainParticles/grainParticles/grainParticles.hpp create mode 100644 src/Particles/GrainParticles/grainParticles/grainParticlesKernels.cpp create mode 100644 src/Particles/GrainParticles/grainParticles/grainParticlesKernels.hpp create mode 100644 src/Particles/GrainParticles/grainShape/grainShape.cpp create mode 100644 src/Particles/GrainParticles/grainShape/grainShape.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index fa88bc95..9e770954 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -76,7 +76,7 @@ add_subdirectory(solvers) add_subdirectory(utilities) #add_subdirectory(DEMSystems) -add_subdirectory(testIO) + install(FILES "${PROJECT_BINARY_DIR}/phasicFlowConfig.H" DESTINATION include) diff --git a/cmake/bashrc b/cmake/bashrc index 32c92d87..d5e04cf8 100644 --- a/cmake/bashrc +++ b/cmake/bashrc @@ -1,7 +1,7 @@ export pFlow_PROJECT_VERSION=v-1.0 -export pFlow_PROJECT=phasicFlow +export pFlow_PROJECT=phasicFlowV-1.0 projectDir="$HOME/PhasicFlow" diff --git a/solvers/CMakeLists.txt b/solvers/CMakeLists.txt index 7db5fd36..5ecf3fb5 100644 --- a/solvers/CMakeLists.txt +++ b/solvers/CMakeLists.txt @@ -5,3 +5,5 @@ add_subdirectory(iterateSphereParticles) add_subdirectory(iterateGeometry) add_subdirectory(sphereGranFlow) + +add_subdirectory(grainGranFlow) diff --git a/solvers/grainGranFlow/CMakeLists.txt b/solvers/grainGranFlow/CMakeLists.txt new file mode 100755 index 00000000..afd35eb4 --- /dev/null +++ b/solvers/grainGranFlow/CMakeLists.txt @@ -0,0 +1,7 @@ + +set(source_files +grainGranFlow.cpp +) +set(link_lib Kokkos::kokkos phasicFlow Particles Geometry Property Interaction Interaction Utilities) + +pFlow_make_executable_install(grainGranFlow source_files link_lib) diff --git a/solvers/grainGranFlow/createDEMComponents.hpp b/solvers/grainGranFlow/createDEMComponents.hpp new file mode 100755 index 00000000..a92ed5c4 --- /dev/null +++ b/solvers/grainGranFlow/createDEMComponents.hpp @@ -0,0 +1,50 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +// +REPORT(0)<<"\nReading sphere particles . . ."<( + objectFile( + insertionFile__, + "", + objectFile::READ_ALWAYS, + objectFile::WRITE_ALWAYS + ), + sphParticles, + sphParticles.shapes() + );*/ + +auto grnInsertion = pFlow::grainInsertion( + grnParticles, + grnParticles.grains()); + +REPORT(0)<<"\nCreating interaction model for sphere-sphere contact and sphere-wall contact . . ."< +class cGAbsoluteLinear +{ +public: + + struct contactForceStorage + { + realx3 overlap_t_ = 0.0; + }; + + + struct linearProperties + { + real kn_ = 1000.0; + real kt_ = 800.0; + real en_ = 0.0; + real ethat_ = 0.0; + real mu_ = 0.00001; + + INLINE_FUNCTION_HD + linearProperties(){} + + INLINE_FUNCTION_HD + linearProperties(real kn, real kt, real en, real etha_t, real mu ): + kn_(kn), kt_(kt), en_(en),ethat_(etha_t), mu_(mu) + {} + + INLINE_FUNCTION_HD + linearProperties(const linearProperties&)=default; + + INLINE_FUNCTION_HD + linearProperties& operator=(const linearProperties&)=default; + + INLINE_FUNCTION_HD + ~linearProperties() = default; + }; + + + +protected: + + using LinearArrayType = symArray; + + int32 numMaterial_ = 0; + + ViewType1D rho_; + + LinearArrayType linearProperties_; + + int32 addDissipationModel_; + + + bool readLinearDictionary(const dictionary& dict) + { + + + auto kn = dict.getVal("kn"); + auto kt = dict.getVal("kt"); + auto en = dict.getVal("en"); + auto et = dict.getVal("et"); + auto mu = dict.getVal("mu"); + + auto nElem = kn.size(); + + if(nElem != kt.size()) + { + fatalErrorInFunction<< + "sizes of kn("< prop("prop", nElem); + ForAll(i,kn) + { + prop[i] = {kn[i], kt[i], en[i], etha_t[i], mu[i] }; + } + + linearProperties_.assign(prop); + + auto adm = dict.getVal("additionalDissipationModel"); + + + if(adm == "none") + { + addDissipationModel_ = 1; + } + else if(adm == "LU") + { + addDissipationModel_ = 2; + } + else if (adm == "GB") + { + addDissipationModel_ = 3; + } + else + { + addDissipationModel_ = 1; + } + + return true; + + } + + static const char* modelName() + { + if constexpr (limited) + { + return "cGAbsoluteLinearLimited"; + } + else + { + return "cGAbsoluteLinearNonLimited"; + } + return ""; + } + +public: + + + TypeInfoNV(modelName()); + + INLINE_FUNCTION_HD + cGAbsoluteLinear(){} + + cGAbsoluteLinear(int32 nMaterial, const ViewType1D& rho, const dictionary& dict) + : + numMaterial_(nMaterial), + rho_("rho",nMaterial), + linearProperties_("linearProperties",nMaterial) + { + + Kokkos::deep_copy(rho_,rho); + if(!readLinearDictionary(dict)) + { + fatalExit; + } + } + + INLINE_FUNCTION_HD + cGAbsoluteLinear(const cGAbsoluteLinear&) = default; + + INLINE_FUNCTION_HD + cGAbsoluteLinear(cGAbsoluteLinear&&) = default; + + INLINE_FUNCTION_HD + cGAbsoluteLinear& operator=(const cGAbsoluteLinear&) = default; + + INLINE_FUNCTION_HD + cGAbsoluteLinear& operator=(cGAbsoluteLinear&&) = default; + + + INLINE_FUNCTION_HD + ~cGAbsoluteLinear()=default; + + INLINE_FUNCTION_HD + int32 numMaterial()const + { + return numMaterial_; + } + + //// - Methods + INLINE_FUNCTION_HD + void contactForce + ( + const real dt, + const uint32 i, + const uint32 j, + const uint32 propId_i, + const uint32 propId_j, + const real Ri, + const real Rj, + const real cGFi, + const real cGFj, + const real ovrlp_n, + const realx3& Vr, + const realx3& Nij, + contactForceStorage& history, + realx3& FCn, + realx3& FCt + )const + { + + + auto prop = linearProperties_(propId_i,propId_j); + + + real f_ = ( cGFi + cGFj )/2 ; + + + real vrn = dot(Vr, Nij); + realx3 Vt = Vr - vrn*Nij; + + history.overlap_t_ += Vt*dt; + + real mi = 3*Pi/4*pow(Ri,3.0)*rho_[propId_i]; + real mj = 3*Pi/4*pow(Rj,3.0)*rho_[propId_j]; + + real sqrt_meff = sqrt((mi*mj)/(mi+mj)); + + + // disipation model + if (addDissipationModel_==2) + { + prop.en_ = sqrt(1+((pow(prop.en_,2)-1)*f_)); + } + else if (addDissipationModel_==3) + { + auto pie =3.14; + prop.en_ = exp((pow(f_,1.5)*log(prop.en_)*sqrt( (1-((pow(log(prop.en_),2))/(pow(log(prop.en_),2)+pow(pie,2))))/(1-(pow(f_,3)*(pow(log(prop.en_),2))/(pow(log(prop.en_),2)+pow(pie,2)))) ) )); + } + + + + + real ethan_ = -2.0*log(prop.en_)*sqrt(prop.kn_)/ + sqrt(pow(log(prop.en_),2.0)+ pow(Pi,2.0)); + + //REPORT(0)<<"\n en n is : "< ft_fric) + { + if( length(history.overlap_t_) >static_cast(0.0)) + { + if constexpr (limited) + { + FCt *= (ft_fric/ft); + history.overlap_t_ = - (FCt/prop.kt_); + } + else + { + FCt = (FCt/ft)*ft_fric; + } + //cout<<"friction is applied here \n"; + + } + else + { + FCt = 0.0; + } + } + + } + +}; + +} //pFlow::cfModels + +#endif diff --git a/src/Interaction/Models/contactForce/cGRelativeLinearCF.hpp b/src/Interaction/Models/contactForce/cGRelativeLinearCF.hpp new file mode 100755 index 00000000..48a77884 --- /dev/null +++ b/src/Interaction/Models/contactForce/cGRelativeLinearCF.hpp @@ -0,0 +1,340 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __cGRelativeLinearCF_hpp__ +#define __cGRelativeLinearCF_hpp__ + +#include "types.hpp" +#include "symArrays.hpp" + + + + + + + + +namespace pFlow::cfModels +{ + +template +class cGRelativeLinear +{ +public: + + struct contactForceStorage + { + realx3 overlap_t_ = 0.0; + }; + + + struct linearProperties + { + real kn_ = 1000.0; + real kt_ = 800.0; + real en_ = 0.0; + real ethat_ = 0.0; + real mu_ = 0.00001; + + INLINE_FUNCTION_HD + linearProperties(){} + + INLINE_FUNCTION_HD + linearProperties(real kn, real kt, real en, real etha_t, real mu ): + kn_(kn), kt_(kt), en_(en),ethat_(etha_t), mu_(mu) + {} + + INLINE_FUNCTION_HD + linearProperties(const linearProperties&)=default; + + INLINE_FUNCTION_HD + linearProperties& operator=(const linearProperties&)=default; + + INLINE_FUNCTION_HD + ~linearProperties() = default; + }; + + + +protected: + + using LinearArrayType = symArray; + + int32 numMaterial_ = 0; + + ViewType1D rho_; + + LinearArrayType linearProperties_; + + int32 addDissipationModel_; + + + bool readLinearDictionary(const dictionary& dict) + { + + + auto kn = dict.getVal("kn"); + auto kt = dict.getVal("kt"); + auto en = dict.getVal("en"); + auto et = dict.getVal("et"); + auto mu = dict.getVal("mu"); + + + auto nElem = kn.size(); + + + if(nElem != kt.size()) + { + fatalErrorInFunction<< + "sizes of kn("< prop("prop", nElem); + ForAll(i,kn) + { + prop[i] = {kn[i], kt[i], en[i], etha_t[i], mu[i] }; + } + + linearProperties_.assign(prop); + + auto adm = dict.getVal("additionalDissipationModel"); + + + if(adm == "none") + { + addDissipationModel_ = 1; + } + else if(adm == "LU") + { + addDissipationModel_ = 2; + } + else if (adm == "GB") + { + addDissipationModel_ = 3; + } + else + { + addDissipationModel_ = 1; + } + + return true; + + } + + static const char* modelName() + { + if constexpr (limited) + { + return "cGRelativeLinearLimited"; + } + else + { + return "cGRelativeLinearNonLimited"; + } + return ""; + } + +public: + + + TypeInfoNV(modelName()); + + INLINE_FUNCTION_HD + cGRelativeLinear(){} + + cGRelativeLinear(int32 nMaterial, const ViewType1D& rho, const dictionary& dict) + : + numMaterial_(nMaterial), + rho_("rho",nMaterial), + linearProperties_("linearProperties",nMaterial) + { + + Kokkos::deep_copy(rho_,rho); + if(!readLinearDictionary(dict)) + { + fatalExit; + } + } + + INLINE_FUNCTION_HD + cGRelativeLinear(const cGRelativeLinear&) = default; + + INLINE_FUNCTION_HD + cGRelativeLinear(cGRelativeLinear&&) = default; + + INLINE_FUNCTION_HD + cGRelativeLinear& operator=(const cGRelativeLinear&) = default; + + INLINE_FUNCTION_HD + cGRelativeLinear& operator=(cGRelativeLinear&&) = default; + + + INLINE_FUNCTION_HD + ~cGRelativeLinear()=default; + + INLINE_FUNCTION_HD + int32 numMaterial()const + { + return numMaterial_; + } + + //// - Methods + INLINE_FUNCTION_HD + void contactForce + ( + const real dt, + const uint32 i, + const uint32 j, + const uint32 propId_i, + const uint32 propId_j, + const real Ri, + const real Rj, + const real cGFi, + const real cGFj, + const real ovrlp_n, + const realx3& Vr, + const realx3& Nij, + contactForceStorage& history, + realx3& FCn, + realx3& FCt + )const + { + + auto prop = linearProperties_(propId_i,propId_j); + + real f_ = ( cGFi + cGFj )/2 ; + + + real vrn = dot(Vr, Nij); + realx3 Vt = Vr - vrn*Nij; + + history.overlap_t_ += Vt*dt; + + real mi = 3*Pi/4*pow(Ri,3.0)*rho_[propId_i]; + real mj = 3*Pi/4*pow(Rj,3.0)*rho_[propId_j]; + + real sqrt_meff = sqrt((mi*mj)/(mi+mj)); + + + if (addDissipationModel_==2) + { + prop.en_ = sqrt(1+((pow(prop.en_,2)-1)*f_)); + } + else if (addDissipationModel_==3) + { + auto pie =3.14; + prop.en_ = exp((pow(f_,1.5)*log(prop.en_)*sqrt( (1-((pow(log(prop.en_),2))/(pow(log(prop.en_),2)+pow(pie,2))))/(1-(pow(f_,3)*(pow(log(prop.en_),2))/(pow(log(prop.en_),2)+pow(pie,2)))) ) )); + } + real ethan_ = -2.0*log(prop.en_)*sqrt(prop.kn_)/ + sqrt(pow(log(prop.en_),2.0)+ pow(Pi,2.0)); + + + FCn = ( -pow(f_,1.0)*prop.kn_ * ovrlp_n - sqrt_meff * pow(f_,0.5) * ethan_ * vrn)*Nij; + FCt = ( -pow(f_,1.0)*prop.kt_ * history.overlap_t_ - sqrt_meff * pow(f_,0.5) * prop.ethat_*Vt); + + + + real ft = length(FCt); + real ft_fric = prop.mu_ * length(FCn); + + if(ft > ft_fric) + { + if( length(history.overlap_t_) >static_cast(0.0)) + { + if constexpr (limited) + { + FCt *= (ft_fric/ft); + history.overlap_t_ = - (FCt/prop.kt_); + } + else + { + FCt = (FCt/ft)*ft_fric; + } + //cout<<"friction is applied here \n"; + + } + else + { + FCt = 0.0; + } + } + + } + +}; + +} //pFlow::cfModels + +#endif diff --git a/src/Interaction/Models/grainContactForceModels.hpp b/src/Interaction/Models/grainContactForceModels.hpp new file mode 100755 index 00000000..908117f5 --- /dev/null +++ b/src/Interaction/Models/grainContactForceModels.hpp @@ -0,0 +1,45 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __grainContactForceModels_hpp__ +#define __grainContactForceModels_hpp__ + +#include "cGAbsoluteLinearCF.hpp" +#include "cGRelativeLinearCF.hpp" + +#include "grainRolling.hpp" + + + +namespace pFlow::cfModels +{ + + +using limitedCGAbsoluteLinearGrainRolling = grainRolling>; +using nonLimitedCGAbsoluteLinearGrainRolling = grainRolling>; + +using limitedCGRelativeLinearGrainRolling = grainRolling>; +using nonLimitedCGRelativeLinearGrainRolling = grainRolling>; + +} + + + +#endif //__grainContactForceModels_hpp__ diff --git a/src/Interaction/Models/rolling/grainRolling.hpp b/src/Interaction/Models/rolling/grainRolling.hpp new file mode 100755 index 00000000..b8eff130 --- /dev/null +++ b/src/Interaction/Models/rolling/grainRolling.hpp @@ -0,0 +1,119 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __grainRolling_hpp__ +#define __grainRolling_hpp__ + + +namespace pFlow::cfModels +{ + +template +class grainRolling +: + public contactForceModel +{ +public: + + using contactForceStorage = + typename contactForceModel::contactForceStorage; + + + realSymArray_D mur_; + + bool readGrainDict(const dictionary& dict) + { + auto mur = dict.getVal("mur"); + + uint32 nMat; + + if(!realSymArray_D::getN(mur.size(),nMat) || nMat != this->numMaterial()) + { + fatalErrorInFunction<< + "wrong number of values supplied in mur. \n"; + return false; + } + + mur_.assign(mur); + + return true; + } + +public: + + TypeInfoNV(word("normal<"+contactForceModel::TYPENAME()+">")); + + + grainRolling(int32 nMaterial, const ViewType1D& rho, const dictionary& dict) + : + contactForceModel(nMaterial, rho, dict), + mur_("mur", nMaterial) + { + if(!readGrainDict(dict)) + { + fatalExit; + } + } + + INLINE_FUNCTION_HD + void rollingFriction + ( + const real dt, + const uint32 i, + const uint32 j, + const uint32 propId_i, + const uint32 propId_j, + const real Ri, + const real Rj, + const real cGFi, + const real cGFj, + const realx3& wi, + const realx3& wj, + const realx3& Nij, + const realx3& FCn, + realx3& Mri, + realx3& Mrj + )const + { + + realx3 w_hat = wi-wj; + real w_hat_mag = length(w_hat); + + if( !equal(w_hat_mag,0.0) ) + w_hat /= w_hat_mag; + else + w_hat = 0.0; + + auto Reff = (Ri*Rj)/(Ri+Rj); + + Mri = ( -mur_(propId_i,propId_j) *length(FCn) * Reff ) * w_hat ; + + //removing the normal part + // Mri = Mri - ( (Mri .dot. nij)*nij ) + + Mrj = -Mri; + } + + +}; + +} + +#endif diff --git a/src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.cpp b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.cpp new file mode 100644 index 00000000..a2949227 --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.cpp @@ -0,0 +1,104 @@ +#include "boundarySphereInteraction.hpp" +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +template +void pFlow::boundaryGrainInteraction::allocatePPPairs() +{ + ppPairs_.reset(nullptr); + ppPairs_ = makeUnique(1); +} + +template +void pFlow::boundaryGrainInteraction::allocatePWPairs() +{ + pwPairs_.reset(nullptr); + pwPairs_ = makeUnique(1); +} + + +template +pFlow::boundaryGrainInteraction::boundaryGrainInteraction( + const boundaryBase &boundary, + const grainParticles &grnPrtcls, + const GeometryMotionModel &geomMotion) + : generalBoundary(boundary, grnPrtcls.pStruct(), "", ""), + geometryMotion_(geomMotion), + grnParticles_(grnPrtcls) +{ +} + +template +pFlow::uniquePtr> +pFlow::boundaryGrainInteraction::create( + const boundaryBase &boundary, + const grainParticles &grnPrtcls, + const GeometryMotionModel &geomMotion) +{ + word cfTypeName = ContactForceModel::TYPENAME(); + word gmTypeName = MotionModel::TYPENAME(); + word bType = boundary.type(); + + word boundaryTypeName = angleBracketsNames3( + "boundaryGrainInteraction", + bType, + cfTypeName, + gmTypeName); + + word altBTypeName = angleBracketsNames2( + "boundaryGrainInteraction", + cfTypeName, + gmTypeName); + + if (boundaryBasevCtorSelector_.search(boundaryTypeName)) + { + pOutput.space(4) << "Creating boundry type " << Green_Text(boundaryTypeName) << + " for boundary " << boundary.name() << " . . ." << END_REPORT; + return boundaryBasevCtorSelector_[boundaryTypeName]( + boundary, + grnPrtcls, + geomMotion); + } + else if(boundaryBasevCtorSelector_[altBTypeName]) + { + // if boundary condition is not implemented, the default is used + + pOutput.space(4) << "Creating boundry type " << Green_Text(altBTypeName) << + " for boundary " << boundary.name() << " . . ." << END_REPORT; + return boundaryBasevCtorSelector_[altBTypeName]( + boundary, + grnPrtcls, + geomMotion); + } + else + { + printKeys + ( + fatalError << "Ctor Selector "<< boundaryTypeName<< + " and "<< altBTypeName << " do not exist. \n" + <<"Avaiable ones are: \n\n" + , + boundaryBasevCtorSelector_ + ); + fatalExit; + } + + return nullptr; +} diff --git a/src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.hpp b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.hpp new file mode 100644 index 00000000..4800194c --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteraction/boundaryGrainInteraction.hpp @@ -0,0 +1,186 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ +#ifndef __boundaryGrainInteraction_hpp__ +#define __boundaryGrainInteraction_hpp__ + +#include "virtualConstructor.hpp" +#include "generalBoundary.hpp" +#include "sortedContactList.hpp" +#include "grainParticles.hpp" + +namespace pFlow +{ + +template +class boundaryGrainInteraction +: + public generalBoundary +{ +public: + + using BoundaryGrainInteractionType + = boundaryGrainInteraction; + + using GeometryMotionModel = geometryMotionModel; + + using ContactForceModel = contactForceModel; + + using MotionModel = typename geometryMotionModel::MotionModel; + + using ModelStorage = typename ContactForceModel::contactForceStorage; + + using IdType = uint32; + + using IndexType = uint32; + + using ContactListType = + sortedContactList; + +private: + + const GeometryMotionModel& geometryMotion_; + + /// const reference to sphere particles + const grainParticles& grnParticles_; + + uniquePtr ppPairs_ = nullptr; + + uniquePtr pwPairs_ = nullptr; + +protected: + + void allocatePPPairs(); + + void allocatePWPairs(); + +public: + + TypeInfoTemplate12("boundaryGrainInteraction", ContactForceModel, MotionModel); + + boundaryGrainInteraction( + const boundaryBase& boundary, + const grainParticles& grnPrtcls, + const GeometryMotionModel& geomMotion); + + create_vCtor + ( + BoundaryGrainInteractionType, + boundaryBase, + ( + const boundaryBase& boundary, + const grainParticles& grnPrtcls, + const GeometryMotionModel& geomMotion + ), + (boundary, grnPrtcls, geomMotion) + ); + + add_vCtor + ( + BoundaryGrainInteractionType, + BoundaryGrainInteractionType, + boundaryBase + ); + + ~boundaryGrainInteraction()override=default; + + const auto& grnParticles()const + { + return grnParticles_; + } + + const auto& geometryMotion()const + { + return geometryMotion_; + } + + ContactListType& ppPairs() + { + return ppPairs_(); + } + + const ContactListType& ppPairs()const + { + return ppPairs_(); + } + + ContactListType& pwPairs() + { + return pwPairs_(); + } + + const ContactListType& pwPairs()const + { + return pwPairs_(); + } + + bool ppPairsAllocated()const + { + if( ppPairs_)return true; + return false; + } + + bool pwPairsAllocated()const + { + if( pwPairs_)return true; + return false; + } + + virtual + bool grainGrainInteraction( + real dt, + const ContactForceModel& cfModel, + uint32 step) + { + // for default boundary, no thing to be done + return false; + } + + + + bool hearChanges + ( + real t, + real dt, + uint32 iter, + const message& msg, + const anyList& varList + ) override + { + + pOutput<<"Function (hearChanges in boundarySphereInteractions)is not implmented Message "<< + msg <boundaryName() <<" type "<< this->type()< create( + const boundaryBase& boundary, + const grainParticles& sphPrtcls, + const GeometryMotionModel& geomMotion + ); + +}; + +} + +#include "boundaryGrainInteraction.cpp" + +#endif //__boundaryGrainInteraction_hpp__ diff --git a/src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.cpp b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.cpp new file mode 100644 index 00000000..7875210d --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.cpp @@ -0,0 +1,23 @@ + + +template +pFlow::boundaryGrainInteractionList::boundaryGrainInteractionList +( + const grainParticles &grnPrtcls, + const gMModel &geomMotion +) +: + ListPtr>(6), + boundaries_(grnPrtcls.pStruct().boundaries()) +{ + //gSettings::sleepMiliSeconds(1000*pFlowProcessors().localRank()); + for(uint32 i=0; i<6; i++) + { + this->set( + i, + boundaryGrainInteraction::create( + boundaries_[i], + grnPrtcls, + geomMotion)); + } +} \ No newline at end of file diff --git a/src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.hpp b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.hpp new file mode 100644 index 00000000..ed4cabc8 --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/boundaryGrainInteractionList.hpp @@ -0,0 +1,40 @@ +#ifndef __boundaryGrainInteractionList_hpp__ +#define __boundaryGrainInteractionList_hpp__ + + +#include "boundaryList.hpp" +#include "ListPtr.hpp" +#include "boundaryGrainInteraction.hpp" + + +namespace pFlow +{ + + +template +class boundaryGrainInteractionList +: + public ListPtr> +{ +private: + + const boundaryList& boundaries_; + +public: + + boundaryGrainInteractionList( + const grainParticles& grnPrtcls, + const geometryMotionModel& geomMotion + ); + + ~boundaryGrainInteractionList()=default; + +}; + + + +} + +#include "boundaryGrainInteractionList.cpp" + +#endif //__boundaryGrainInteractionList_hpp__ \ No newline at end of file diff --git a/src/Interaction/grainInteraction/boundaries/createBoundaryGrainInteraction.hpp b/src/Interaction/grainInteraction/boundaries/createBoundaryGrainInteraction.hpp new file mode 100644 index 00000000..12049af0 --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/createBoundaryGrainInteraction.hpp @@ -0,0 +1,31 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +-----------------------------------------------------------------------------*/ + +#include "boundaryGrainInteraction.hpp" +#include "periodicBoundaryGrainInteraction.hpp" + +#define createBoundaryGrainInteraction(ForceModel,GeomModel) \ + template class pFlow::boundaryGrainInteraction< \ + ForceModel, \ + GeomModel>; \ + \ + template class pFlow::periodicBoundaryGrainInteraction< \ + ForceModel, \ + GeomModel>; + diff --git a/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.cpp b/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.cpp new file mode 100644 index 00000000..0eedf973 --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.cpp @@ -0,0 +1,70 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#include "periodicBoundarySIKernels.hpp" + +template +pFlow::periodicBoundaryGrainInteraction::periodicBoundaryGrainInteraction( + const boundaryBase &boundary, + const grainParticles &grnPrtcls, + const GeometryMotionModel &geomMotion) + : boundaryGrainInteraction(boundary, grnPrtcls, geomMotion), + transferVec_(boundary.mirrorBoundary().displacementVectroToMirror()) +{ + if(boundary.thisBoundaryIndex()%2==1) + { + masterInteraction_ = true; + this->allocatePPPairs(); + this->allocatePWPairs(); + + } + else + { + masterInteraction_ = false; + } +} + +template +bool pFlow::periodicBoundaryGrainInteraction::grainGrainInteraction +( + real dt, + const ContactForceModel &cfModel, + uint32 step +) +{ + if(!masterInteraction_) return false; + + pFlow::periodicBoundarySIKernels::grainGrainInteraction( + dt, + this->ppPairs(), + cfModel, + transferVec_, + this->boundary().thisPoints(), + this->mirrorBoundary().thisPoints(), + this->grnParticles().diameter().deviceViewAll(), + this->grnParticles().coarseGrainFactor().deviceViewAll(), + this->grnParticles().propertyId().deviceViewAll(), + this->grnParticles().velocity().deviceViewAll(), + this->grnParticles().rVelocity().deviceViewAll(), + this->grnParticles().contactForce().deviceViewAll(), + this->grnParticles().contactTorque().deviceViewAll()); + + return false; +} \ No newline at end of file diff --git a/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.hpp b/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.hpp new file mode 100644 index 00000000..e9148c9d --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundaryGrainInteraction.hpp @@ -0,0 +1,96 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __periodicBoundaryGrainInteraction_hpp__ +#define __periodicBoundaryGrainInteraction_hpp__ + +#include "boundaryGrainInteraction.hpp" + +namespace pFlow +{ + +template +class periodicBoundaryGrainInteraction +: + public boundaryGrainInteraction +{ +public: + + using PBSInteractionType = + periodicBoundaryGrainInteraction; + + using BSInteractionType = + boundaryGrainInteraction; + + using GeometryMotionModel = typename BSInteractionType::GeometryMotionModel; + + using ContactForceModel = typename BSInteractionType::ContactForceModel; + + using MotionModel = typename geometryMotionModel::MotionModel; + + using ModelStorage = typename ContactForceModel::contactForceStorage; + + using IdType = typename BSInteractionType::IdType; + + using IndexType = typename BSInteractionType::IndexType; + + using ContactListType = typename BSInteractionType::ContactListType; + +private: + + realx3 transferVec_; + + bool masterInteraction_; +public: + + TypeInfoTemplate22("boundaryGrainInteraction", "periodic",ContactForceModel, MotionModel); + + + periodicBoundaryGrainInteraction( + const boundaryBase& boundary, + const grainParticles& grnPrtcls, + const GeometryMotionModel& geomMotion + ); + + add_vCtor + ( + BSInteractionType, + PBSInteractionType, + boundaryBase + ); + + ~periodicBoundaryGrainInteraction()override = default; + + + + + bool grainGrainInteraction( + real dt, + const ContactForceModel& cfModel, + uint32 step)override; + +}; + +} + +#include "periodicBoundaryGrainInteraction.cpp" + + +#endif //__periodicBoundaryGrainInteraction_hpp__ \ No newline at end of file diff --git a/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundarySIKernels.hpp b/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundarySIKernels.hpp new file mode 100644 index 00000000..6a8a618e --- /dev/null +++ b/src/Interaction/grainInteraction/boundaries/periodicBoundaryGrainInteraction/periodicBoundarySIKernels.hpp @@ -0,0 +1,121 @@ + +namespace pFlow::periodicBoundarySIKernels +{ + +template +inline +void grainGrainInteraction +( + real dt, + const ContactListType& cntctList, + const ContactForceModel& forceModel, + const realx3& transferVec, + const deviceScatteredFieldAccess& thisPoints, + const deviceScatteredFieldAccess& mirrorPoints, + const deviceViewType1D& diam, + const deviceViewType1D& coarseGrainFactor, + const deviceViewType1D& propId, + const deviceViewType1D& vel, + const deviceViewType1D& rVel, + const deviceViewType1D& cForce, + const deviceViewType1D& cTorque +) +{ + + using ValueType = typename ContactListType::ValueType; + uint32 ss = cntctList.size(); + uint32 lastItem = cntctList.loopCount(); + if(lastItem == 0u)return; + + Kokkos::parallel_for( + "pFlow::periodicBoundarySIKernels::grainGrainInteraction", + deviceRPolicyDynamic(0,lastItem), + LAMBDA_HD(uint32 n) + { + + if(!cntctList.isValid(n))return; + + auto [i,j] = cntctList.getPair(n); + uint32 ind_i = thisPoints.index(i); + uint32 ind_j = mirrorPoints.index(j); + + real Ri = 0.5*diam[ind_i]; + real Rj = 0.5*diam[ind_j]; + real cGFi = coarseGrainFactor[ind_i]; + real cGFj = coarseGrainFactor[ind_j]; + realx3 xi = thisPoints.field()[ind_i]; + realx3 xj = mirrorPoints.field()[ind_j]+transferVec; + real dist = length(xj-xi); + real ovrlp = (Ri+Rj) - dist; + + if( ovrlp >0.0 ) + { + auto Nij = (xj-xi)/dist; + auto wi = rVel[ind_i]; + auto wj = rVel[ind_j]; + auto Vr = vel[ind_i] - vel[ind_j] + cross((Ri*wi+Rj*wj), Nij); + + auto history = cntctList.getValue(n); + + int32 propId_i = propId[ind_i]; + int32 propId_j = propId[ind_j]; + + realx3 FCn, FCt, Mri, Mrj, Mij, Mji; + + // calculates contact force + forceModel.contactForce( + dt, i, j, + propId_i, propId_j, + Ri, Rj, cGFi , cGFj , + ovrlp, + Vr, Nij, + history, + FCn, FCt); + + forceModel.rollingFriction( + dt, i, j, + propId_i, propId_j, + Ri, Rj, cGFi , cGFj , + wi, wj, + Nij, + FCn, + Mri, Mrj); + + auto M = cross(Nij,FCt); + Mij = Ri*M+Mri; + Mji = Rj*M+Mrj; + + auto FC = FCn + FCt; + + + Kokkos::atomic_add(&cForce[ind_i].x_,FC.x_); + Kokkos::atomic_add(&cForce[ind_i].y_,FC.y_); + Kokkos::atomic_add(&cForce[ind_i].z_,FC.z_); + + Kokkos::atomic_add(&cForce[ind_j].x_,-FC.x_); + Kokkos::atomic_add(&cForce[ind_j].y_,-FC.y_); + Kokkos::atomic_add(&cForce[ind_j].z_,-FC.z_); + + Kokkos::atomic_add(&cTorque[ind_i].x_, Mij.x_); + Kokkos::atomic_add(&cTorque[ind_i].y_, Mij.y_); + Kokkos::atomic_add(&cTorque[ind_i].z_, Mij.z_); + + Kokkos::atomic_add(&cTorque[ind_j].x_, Mji.x_); + Kokkos::atomic_add(&cTorque[ind_j].y_, Mji.y_); + Kokkos::atomic_add(&cTorque[ind_j].z_, Mji.z_); + + + cntctList.setValue(n,history); + + } + else + { + cntctList.setValue(n, ValueType()); + } + + }); + Kokkos::fence(); +} + + +} //pFlow::periodicBoundarySIKernels \ No newline at end of file diff --git a/src/Interaction/grainInteraction/grainInteraction/grainInteraction.cpp b/src/Interaction/grainInteraction/grainInteraction/grainInteraction.cpp new file mode 100644 index 00000000..65c84a77 --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteraction/grainInteraction.cpp @@ -0,0 +1,359 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +template class cLT> +bool pFlow::grainInteraction::createGrainInteraction() +{ + + realVector_D rhoD("densities", this->densities()); + + auto modelDict = this->subDict("model"); + + forceModel_ = makeUnique( + this->numMaterials(), + rhoD.deviceView(), + modelDict ); + + + uint32 nPrtcl = grnParticles_.size(); + + contactSearch_ = contactSearch::create( + subDict("contactSearch"), + grnParticles_.extendedDomain().domainBox(), + grnParticles_, + geometryMotion_, + timers()); + + ppContactList_ = makeUnique(nPrtcl+1); + + pwContactList_ = makeUnique(nPrtcl/5+1); + + return true; +} + + +template class cLT> +bool pFlow::grainInteraction::grainGrainInteraction() +{ + auto lastItem = ppContactList_().loopCount(); + + // create the kernel functor + pFlow::grainInteractionKernels::ppInteractionFunctor + ppInteraction( + this->dt(), + this->forceModel_(), + ppContactList_(), // to be read + grnParticles_.diameter().deviceViewAll(), + grnParticles_.coarseGrainFactor().deviceViewAll(), + grnParticles_.propertyId().deviceViewAll(), + grnParticles_.pointPosition().deviceViewAll(), + grnParticles_.velocity().deviceViewAll(), + grnParticles_.rVelocity().deviceViewAll(), + grnParticles_.contactForce().deviceViewAll(), + grnParticles_.contactTorque().deviceViewAll() + ); + + Kokkos::parallel_for( + "ppInteraction", + rpPPInteraction(0,lastItem), + ppInteraction + ); + + Kokkos::fence(); + + return true; +} + + +template class cLT> +bool pFlow::grainInteraction::grainWallInteraction() +{ + + uint32 lastItem = pwContactList_().loopCount(); + uint32 iter = this->currentIter(); + real t = this->currentTime(); + real dt = this->dt(); + + pFlow::grainInteractionKernels::pwInteractionFunctor + pwInteraction( + dt, + this->forceModel_(), + pwContactList_(), + geometryMotion_.getTriangleAccessor(), + geometryMotion_.getModel(iter, t, dt) , + grnParticles_.diameter().deviceViewAll() , + grnParticles_.coarseGrainFactor().deviceViewAll() , + grnParticles_.propertyId().deviceViewAll(), + grnParticles_.pointPosition().deviceViewAll(), + grnParticles_.velocity().deviceViewAll(), + grnParticles_.rVelocity().deviceViewAll() , + grnParticles_.contactForce().deviceViewAll(), + grnParticles_.contactTorque().deviceViewAll() , + geometryMotion_.triMotionIndex().deviceViewAll(), + geometryMotion_.propertyId().deviceViewAll(), + geometryMotion_.contactForceWall().deviceViewAll() + ); + + Kokkos::parallel_for( + "", + rpPWInteraction(0,lastItem), + pwInteraction + ); + + + Kokkos::fence(); + + return true; +} + + +template class cLT> +pFlow::grainInteraction::grainInteraction +( + systemControl& control, + const particles& prtcl, + const geometry& geom +) +: + interaction(control, prtcl, geom), + geometryMotion_(dynamic_cast(geom)), + grnParticles_(dynamic_cast(prtcl)), + boundaryInteraction_(grnParticles_,geometryMotion_), + ppInteractionTimer_("grain-graine interaction (internal)", &this->timers()), + pwInteractionTimer_("grain-wall interaction (internal)", &this->timers()), + boundaryInteractionTimer_("grain-grain interaction (boundary)",&this->timers()), + contactListMangementTimer_("list management (interal)", &this->timers()), + contactListMangementBoundaryTimer_("list management (boundary)", &this->timers()) +{ + + if(!createGrainInteraction()) + { + fatalExit; + } + + for(uint32 i=0; i<6; i++) + { + activeBoundaries_[i] = boundaryInteraction_[i].ppPairsAllocated(); + } +} + +template class cLT> +bool pFlow::grainInteraction::beforeIteration() +{ + return true; +} + +template class cLT> +bool pFlow::grainInteraction::iterate() +{ + + timeInfo ti = this->TimeInfo(); + auto iter = ti.iter(); + auto t = ti.t(); + auto dt = ti.dt(); + + auto& contactSearchRef = contactSearch_(); + + bool broadSearch = contactSearchRef.enterBroadSearch(ti); + bool broadSearchBoundary = contactSearchRef.enterBroadSearchBoundary(ti); + + /// update boundaries of the fields that are being used by inreaction + grnParticles_.diameter().updateBoundaries(DataDirection::SlaveToMaster); + grnParticles_.velocity().updateBoundaries(DataDirection::SlaveToMaster); + grnParticles_.rVelocity().updateBoundaries(DataDirection::SlaveToMaster); + grnParticles_.propertyId().updateBoundaries(DataDirection::SlaveToMaster); + + /// lists + if(broadSearch) + { + contactListMangementTimer_.start(); + ComputationTimer().start(); + ppContactList_().beforeBroadSearch(); + pwContactList_().beforeBroadSearch(); + ComputationTimer().end(); + contactListMangementTimer_.pause(); + } + + if(broadSearchBoundary) + { + contactListMangementBoundaryTimer_.start(); + ComputationTimer().start(); + for(uint32 i=0; i<6u; i++) + { + if(activeBoundaries_[i]) + { + auto& BI = boundaryInteraction_[i]; + BI.ppPairs().beforeBroadSearch(); + BI.pwPairs().beforeBroadSearch(); + } + } + ComputationTimer().end(); + contactListMangementBoundaryTimer_.pause(); + } + + if( grnParticles_.numActive()<=0)return true; + + ComputationTimer().start(); + if( !contactSearchRef.broadSearch( + ti, + ppContactList_(), + pwContactList_()) ) + { + fatalErrorInFunction<< + "unable to perform broadSearch.\n"; + fatalExit; + } + + for(uint32 i=0; i<6u; i++) + { + if(activeBoundaries_[i]) + { + auto& BI = boundaryInteraction_[i]; + if(!contactSearchRef.boundaryBroadSearch( + i, + ti, + BI.ppPairs(), + BI.pwPairs()) + ) + { + fatalErrorInFunction<< + "failed to perform broadSearch for boundary index "<(true); + const auto& cfModel = this->forceModel_(); + uint32 step=1; + boundaryInteractionTimer_.start(); + ComputationTimer().start(); + while(requireStep.anyElement(true) && step <= 10) + { + for(uint32 i=0; i<6u; i++) + { + if(requireStep[i] ) + { + requireStep[i] = boundaryInteraction_[i].grainGrainInteraction( + dt, + this->forceModel_(), + step + ); + } + } + step++; + } + ComputationTimer().end(); + boundaryInteractionTimer_.pause(); + + + ppInteractionTimer_.start(); + ComputationTimer().start(); + grainGrainInteraction(); + ComputationTimer().end(); + ppInteractionTimer_.end(); + + + pwInteractionTimer_.start(); + ComputationTimer().start(); + grainWallInteraction(); + ComputationTimer().start(); + pwInteractionTimer_.end(); + + { + boundaryInteractionTimer_.resume(); + ComputationTimer().start(); + auto requireStep = boundariesMask<6>(true); + + uint32 step = 11; + const auto& cfModel = this->forceModel_(); + while( requireStep.anyElement(true) && step < 20 ) + { + for(uint32 i=0; i<6u; i++) + { + if(requireStep[i]) + { + requireStep[i] = boundaryInteraction_[i].grainGrainInteraction( + dt, + cfModel, + step + ); + } + } + step++; + } + ComputationTimer().end(); + boundaryInteractionTimer_.end(); + } + + return true; +} + +template class cLT> +bool pFlow::grainInteraction::afterIteration() +{ + return true; +} + +template class cLT> +bool pFlow::grainInteraction::hearChanges +( + real t, + real dt, + uint32 iter, + const message& msg, + const anyList& varList +) +{ + if(msg.equivalentTo(message::ITEM_REARRANGE)) + { + notImplementedFunction; + } + return true; +} \ No newline at end of file diff --git a/src/Interaction/grainInteraction/grainInteraction/grainInteraction.hpp b/src/Interaction/grainInteraction/grainInteraction/grainInteraction.hpp new file mode 100644 index 00000000..2d30165b --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteraction/grainInteraction.hpp @@ -0,0 +1,169 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __grainInteraction_hpp__ +#define __grainInteraction_hpp__ + +#include "interaction.hpp" +#include "grainParticles.hpp" +#include "boundaryGrainInteractionList.hpp" +#include "grainInteractionKernels.hpp" +#include "boundariesMask.hpp" +#include "MPITimer.hpp" +//#include "unsortedContactList.hpp" + + + +namespace pFlow +{ + +template< + typename contactForceModel, + typename geometryMotionModel, + template class contactListType> +class grainInteraction +: + public interaction +{ +public: + + using GeometryMotionModel = geometryMotionModel; + + using ContactForceModel = contactForceModel; + + using MotionModel = typename geometryMotionModel::MotionModel; + + using ModelStorage = typename ContactForceModel::contactForceStorage; + + using BoundaryListType = boundaryGrainInteractionList; + + using IdType = uint32; + + using IndexType = uint32; + + using ContactListType = + contactListType; + + //using BoundaryContactListType = unsortedContactList; + + + +private: + + /// const reference to geometry + const GeometryMotionModel& geometryMotion_; + + /// const reference to particles + const grainParticles& grnParticles_; + + /// particle-particle and particle-wall interactions at boundaries + BoundaryListType boundaryInteraction_; + + /// a mask for active boundaries (boundaries with intreaction) + boundariesMask<6> activeBoundaries_; + + /// contact search object for pp and pw interactions + uniquePtr contactSearch_ = nullptr; + + /// contact force model + uniquePtr forceModel_ = nullptr; + + /// contact list for particle-particle interactoins (keeps the history) + uniquePtr ppContactList_ = nullptr; + + /// contact list for particle-wall interactions (keeps the history) + uniquePtr pwContactList_ = nullptr; + + + /// timer for particle-particle interaction computations + Timer ppInteractionTimer_; + + /// timer for particle-wall interaction computations + Timer pwInteractionTimer_; + + /// timer for boundary interaction time + Timer boundaryInteractionTimer_; + + /// timer for managing contact lists (only inernal points) + Timer contactListMangementTimer_; + + Timer contactListMangementBoundaryTimer_; + + + + bool createGrainInteraction(); + + bool grainGrainInteraction(); + + bool grainWallInteraction(); + + /// range policy for p-p interaction execution + using rpPPInteraction = + Kokkos::RangePolicy, Kokkos::Schedule>; + + /// range policy for p-w interaction execution + using rpPWInteraction = rpPPInteraction; + +public: + + TypeInfoTemplate13("grainInteraction", ContactForceModel, MotionModel, ContactListType); + + /// Constructor from components + grainInteraction( + systemControl& control, + const particles& prtcl, + const geometry& geom); + + + /// Add virtual constructor + add_vCtor + ( + interaction, + grainInteraction, + systemControl + ); + + /// This is called in time loop, before iterate. (overriden from demComponent) + bool beforeIteration() override; + + /// This is called in time loop. Perform the main calculations + /// when the component should evolve along time. (overriden from demComponent) + bool iterate() override; + + /// This is called in time loop, after iterate. (overriden from demComponent) + bool afterIteration() override; + + /// Check for changes in the point structures. (overriden from observer) + bool hearChanges( + real t, + real dt, + uint32 iter, + const message& msg, + const anyList& varList)override; + + +}; + + +} + +#include "grainInteraction.cpp" + +#endif //__grainInteraction_hpp__ diff --git a/src/Interaction/grainInteraction/grainInteraction/grainInteractionKernels.hpp b/src/Interaction/grainInteraction/grainInteraction/grainInteractionKernels.hpp new file mode 100644 index 00000000..7ee5ef39 --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteraction/grainInteractionKernels.hpp @@ -0,0 +1,337 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __grainInteractionKernels_hpp__ +#define __grainInteractionKernels_hpp__ + + +#include "grainTriSurfaceContact.hpp" + +namespace pFlow::grainInteractionKernels +{ + +template< + typename ContactForceModel, + typename ContactListType> +struct ppInteractionFunctor +{ + + using PairType = typename ContactListType::PairType; + using ValueType = typename ContactListType::ValueType; + + real dt_; + + ContactForceModel forceModel_; + ContactListType tobeFilled_; + + deviceViewType1D diam_; + deviceViewType1D coarseGrainFactor_; + deviceViewType1D propId_; + deviceViewType1D pos_; + deviceViewType1D lVel_; + deviceViewType1D rVel_; + deviceViewType1D cForce_; + deviceViewType1D cTorque_; + + + ppInteractionFunctor( + real dt, + ContactForceModel forceModel, + ContactListType tobeFilled, + deviceViewType1D diam, + deviceViewType1D coarseGrainFactor, + deviceViewType1D propId, + deviceViewType1D pos, + deviceViewType1D lVel, + deviceViewType1D rVel, + deviceViewType1D cForce, + deviceViewType1D cTorque ) + : + dt_(dt), + forceModel_(forceModel), + tobeFilled_(tobeFilled), + diam_(diam), + coarseGrainFactor_(coarseGrainFactor), + propId_(propId), + pos_(pos), + lVel_(lVel), + rVel_(rVel), + cForce_(cForce), // this is converted to an atomic vector + cTorque_(cTorque) // this is converted to an atomic vector + {} + + INLINE_FUNCTION_HD + void operator()(const uint32 n)const + { + + if(!tobeFilled_.isValid(n))return; + + auto [i,j] = tobeFilled_.getPair(n); + + real Ri = 0.5*diam_[i]; + real Rj = 0.5*diam_[j]; + + real cGFi = coarseGrainFactor_[j]; + real cGFj = coarseGrainFactor_[j]; + + realx3 xi = pos_[i]; + realx3 xj = pos_[j]; + real dist = length(xj-xi); + real ovrlp = (Ri+Rj) - dist; + + if( ovrlp >0.0 ) + { + + auto Vi = lVel_[i]; + auto Vj = lVel_[j]; + auto wi = rVel_[i]; + auto wj = rVel_[j]; + auto Nij = (xj-xi)/dist; + auto Vr = Vi - Vj + cross((Ri*wi+Rj*wj), Nij); + + auto history = tobeFilled_.getValue(n); + + int32 propId_i = propId_[i]; + int32 propId_j = propId_[j]; + + realx3 FCn, FCt, Mri, Mrj, Mij, Mji; + + // calculates contact force + forceModel_.contactForce( + dt_, i, j, + propId_i, propId_j, + Ri, Rj, cGFi , cGFj , + ovrlp, + Vr, Nij, + history, + FCn, FCt + ); + + forceModel_.rollingFriction( + dt_, i, j, + propId_i, propId_j, + Ri, Rj, cGFi , cGFj , + wi, wj, + Nij, + FCn, + Mri, Mrj + ); + + auto M = cross(Nij,FCt); + Mij = Ri*M+Mri; + Mji = Rj*M+Mrj; + + auto FC = FCn + FCt; + + Kokkos::atomic_add(&cForce_[i].x_,FC.x_); + Kokkos::atomic_add(&cForce_[i].y_,FC.y_); + Kokkos::atomic_add(&cForce_[i].z_,FC.z_); + + Kokkos::atomic_add(&cForce_[j].x_,-FC.x_); + Kokkos::atomic_add(&cForce_[j].y_,-FC.y_); + Kokkos::atomic_add(&cForce_[j].z_,-FC.z_); + + Kokkos::atomic_add(&cTorque_[i].x_, Mij.x_); + Kokkos::atomic_add(&cTorque_[i].y_, Mij.y_); + Kokkos::atomic_add(&cTorque_[i].z_, Mij.z_); + + Kokkos::atomic_add(&cTorque_[j].x_, Mji.x_); + Kokkos::atomic_add(&cTorque_[j].y_, Mji.y_); + Kokkos::atomic_add(&cTorque_[j].z_, Mji.z_); + + + tobeFilled_.setValue(n,history); + + } + else + { + tobeFilled_.setValue(n, ValueType()); + } + + } +}; + + +template< + typename ContactForceModel, + typename ContactListType, + typename TraingleAccessor, + typename MotionModel> +struct pwInteractionFunctor +{ + using PairType = typename ContactListType::PairType; + using ValueType = typename ContactListType::ValueType; + + real dt_; + + ContactForceModel forceModel_; + ContactListType tobeFilled_; + + TraingleAccessor triangles_; + MotionModel motionModel_; + + deviceViewType1D diam_; + deviceViewType1D coarseGrainFactor_; + deviceViewType1D propId_; + deviceViewType1D pos_; + deviceViewType1D lVel_; + deviceViewType1D rVel_; + deviceViewType1D cForce_; + deviceViewType1D cTorque_; + deviceViewType1D wTriMotionIndex_; + deviceViewType1D wPropId_; + deviceViewType1D wCForce_; + + + pwInteractionFunctor( + real dt, + ContactForceModel forceModel, + ContactListType tobeFilled, + TraingleAccessor triangles, + MotionModel motionModel , + deviceViewType1D diam , + deviceViewType1D coarseGrainFactor, + deviceViewType1D propId, + deviceViewType1D pos , + deviceViewType1D lVel, + deviceViewType1D rVel, + deviceViewType1D cForce, + deviceViewType1D cTorque , + deviceViewType1D wTriMotionIndex, + deviceViewType1D wPropId, + deviceViewType1D wCForce) + : + dt_(dt), + forceModel_(forceModel), + tobeFilled_(tobeFilled), + triangles_(triangles) , + motionModel_(motionModel) , + diam_(diam) , + coarseGrainFactor_(coarseGrainFactor), + propId_(propId), + pos_(pos) , + lVel_(lVel), + rVel_(rVel) , + cForce_(cForce), + cTorque_(cTorque) , + wTriMotionIndex_(wTriMotionIndex) , + wPropId_(wPropId), + wCForce_(wCForce) + {} + + INLINE_FUNCTION_HD + void operator()(const int32 n)const + { + + if(!tobeFilled_.isValid(n))return; + + auto [i,tj] = tobeFilled_.getPair(n); + + real Ri = 0.5*diam_[i]; + real Rj = 10000.0; + real cGFi = coarseGrainFactor_[i]; + real cGFj = coarseGrainFactor_[i]; + realx3 xi = pos_[i]; + + realx3x3 tri = triangles_(tj); + real ovrlp; + realx3 Nij, cp; + + if( pFlow::grnTriInteraction::isGrainInContactBothSides( + tri, xi, Ri, ovrlp, Nij, cp) ) + { + auto Vi = lVel_[i]; + auto wi = rVel_[i]; + + int32 mInd = wTriMotionIndex_[tj]; + + auto Vw = motionModel_(mInd, cp); + + //output<< "par-wall index "<< i<<" - "<< tj< 1) + { + Ln = 2; return true; + } + else if (nuW >= 0) + { + if (nu >= 0 && w >= 0) + { + Ln = 0; return true; + } + if (nu > 0 && w < 0) + { + Ln = 1; return true; + } + if (nu < 0 && w > 0) + { + Ln = 3; return true; + } + } + else + { + Ln = 1; return true; + } + + return false; +} + +INLINE_FUNCTION_HD +bool isGrainInContactActiveSide( + const realx3& p1, + const realx3& p2, + const realx3& p3, + const realx3& cntr, + real rad, + real& ovrlp, + realx3& norm, + realx3& cp) +{ + + triWall wall(true, p1,p2,p3); + + real dist = wall.normalDistFromWall(cntr); + + if(dist < 0.0 )return false; + + ovrlp = rad - dist; + + if (ovrlp > 0) + { + realx3 ptOnPlane = wall.nearestPointOnWall(cntr); + + if (pointInPlane(p1, p2, p3, ptOnPlane)) + { + cp = ptOnPlane; + norm = -wall.n_; + return true; + } + + realx3 lnv; + + if (pLine(p1,p2).lineGrainCheck(cntr, rad, lnv, cp, ovrlp)) + { + norm = -lnv; + return true; + } + + if ( pLine(p2,p3).lineGrainCheck(cntr, rad, lnv, cp, ovrlp)) + { + norm = -lnv; + return true; + } + + if ( pLine(p3,p1).lineGrainCheck(cntr, rad, lnv, cp, ovrlp)) + { + norm = -lnv; + return true; + } + } + + return false; +} + +INLINE_FUNCTION_HD +bool isGrainInContactBothSides( + const realx3x3& tri, + const realx3& cntr, + real Rad, + real& ovrlp, + realx3& norm, + realx3& cp) +{ + + triWall wall(true, tri.x_,tri.y_,tri.z_); + + real dist = wall.normalDistFromWall(cntr); + + + ovrlp = Rad - abs(dist); + + if (ovrlp > 0) + { + realx3 ptOnPlane = wall.nearestPointOnWall(cntr); + + if (pointInPlane(tri.x_,tri.y_,tri.z_,ptOnPlane)) + { + cp = ptOnPlane; + + if(dist >= 0.0) + norm = -wall.n_; + else + norm = wall.n_; + return true; + } + + realx3 lnv; + + if (pLine(tri.x_, tri.y_).lineGrainCheck(cntr, Rad, lnv, cp, ovrlp)) + { + norm = -lnv; + return true; + } + + if ( pLine(tri.y_, tri.z_).lineGrainCheck(cntr, Rad, lnv, cp, ovrlp)) + { + norm = -lnv; + return true; + } + + if ( pLine(tri.z_, tri.x_).lineGrainCheck(cntr, Rad, lnv, cp, ovrlp)) + { + norm = -lnv; + return true; + } + } + + return false; +} + + +} // pFlow::grnTriInteraction + + +#endif //__grainTriSurfaceContact_hpp__ \ No newline at end of file diff --git a/src/Interaction/grainInteraction/grainInteraction/pLine.hpp b/src/Interaction/grainInteraction/grainInteraction/pLine.hpp new file mode 100644 index 00000000..848ff66f --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteraction/pLine.hpp @@ -0,0 +1,107 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __pLine_hpp__ +#define __pLine_hpp__ + +#include "types.hpp" + +namespace pFlow::grnTriInteraction +{ + +struct pLine +{ + + realx3 p1_; // point 1 + realx3 p2_; // piont 2 + realx3 v_; // direction vector + real L_; // line lenght + + INLINE_FUNCTION_HD + pLine(){} + + INLINE_FUNCTION_HD + pLine(const realx3 &p1, const realx3 &p2) + : + p1_(p1), + p2_(p2), + v_(p2-p1), + L_(length(v_)) + {} + + // get a point on the line based on input 0<= t <= 1 + INLINE_FUNCTION_HD + realx3 point(real t)const { + return v_ * t + p1_; + } + + // return the projected point of point p on line + INLINE_FUNCTION_HD + realx3 projectPoint(const realx3 &p) const + { + return point(projectNormLength(p)); + } + + // calculates the normalized distance between projected p and p1 + INLINE_FUNCTION_HD + real projectNormLength(realx3 p) const + { + realx3 w = p - p1_; + return dot(w,v_) / (L_*L_); + } + + INLINE_FUNCTION_HD + bool lineGrainCheck( + const realx3 pos, + real Rad, + realx3 &nv, + realx3 &cp, + real &ovrlp)const + { + + + real t = projectNormLength(pos); + + if(t >= 0.0 && t <= 1.0) cp = point(t); + else if(t >= (-Rad / L_) && t < 0.0) cp = point(0.0); + else if(t>1.0 && t >= (1.0 + Rad / L_)) cp = point(1.0); + else return false; + + realx3 vec = pos - cp; // from cp to pos + + real dist = length(vec); + ovrlp = Rad - dist; + + if (ovrlp >= 0.0) + { + if (dist > 0) + nv = vec / dist; + else + nv = v_; + return true; + } + + return false; + } +}; + +} //pFlow::grnTriInteractio + +#endif diff --git a/src/Interaction/grainInteraction/grainInteraction/triWall.hpp b/src/Interaction/grainInteraction/grainInteraction/triWall.hpp new file mode 100644 index 00000000..5a0086a4 --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteraction/triWall.hpp @@ -0,0 +1,108 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __triWall_hpp__ +#define __triWall_hpp__ + +#include "types.hpp" + +namespace pFlow::grnTriInteraction +{ + +struct triWall +{ + + realx3 n_; + real offset_; + + INLINE_FUNCTION_H + triWall(const realx3& p1, const realx3& p2, const realx3& p3) + { + if(!makeWall(p1,p2,p3, n_, offset_)) + { + fatalErrorInFunction<< + "bad input for the wall.\n"; + fatalExit; + } + } + + INLINE_FUNCTION_HD + triWall(bool, const realx3& p1, const realx3& p2, const realx3& p3) + { + makeWall(p1,p2,p3,n_,offset_); + } + + INLINE_FUNCTION_HD + triWall(const realx3x3& tri) + { + makeWall(tri.x_, tri.y_, tri.z_, n_, offset_); + } + + INLINE_FUNCTION_HD + triWall(const triWall&) = default; + + INLINE_FUNCTION_HD + triWall& operator=(const triWall&) = default; + + INLINE_FUNCTION_HD + triWall(triWall&&) = default; + + INLINE_FUNCTION_HD + triWall& operator=(triWall&&) = default; + + INLINE_FUNCTION_HD + ~triWall()=default; + + + INLINE_FUNCTION_HD + real normalDistFromWall(const realx3 &p) const + { + return dot(n_, p) + offset_; + } + + INLINE_FUNCTION_HD + realx3 nearestPointOnWall(const realx3 &p) const + { + real t = -(dot(n_, p) + offset_); + return realx3(n_.x_*t + p.x_, n_.y_*t + p.y_, n_.z_*t + p.z_); + } + + INLINE_FUNCTION_HD static + bool makeWall( + const realx3& p1, + const realx3& p2, + const realx3& p3, + realx3& n, real& offset) + { + n = cross(p2 - p1, p3 - p1); + real len = length(n); + + if (len < 0.00000000001) return false; + n /= len; + offset = -dot(n, p1); + return true; + } + + +}; + +} + +#endif diff --git a/src/Interaction/grainInteraction/grainInteractionsLinearModels.cpp b/src/Interaction/grainInteraction/grainInteractionsLinearModels.cpp new file mode 100755 index 00000000..6fa77730 --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteractionsLinearModels.cpp @@ -0,0 +1,62 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#include "grainInteraction.hpp" +#include "geometryMotions.hpp" +#include "grainContactForceModels.hpp" +#include "unsortedContactList.hpp" +#include "sortedContactList.hpp" +#include "createBoundaryGrainInteraction.hpp" + + + +#define createInteraction(ForceModel,GeomModel) \ + \ + template class pFlow::grainInteraction< \ + ForceModel, \ + GeomModel, \ + pFlow::unsortedContactList>; \ + \ + template class pFlow::grainInteraction< \ + ForceModel, \ + GeomModel, \ + pFlow::sortedContactList>; \ + createBoundaryGrainInteraction(ForceModel, GeomModel) + + +createInteraction(pFlow::cfModels::grainRolling>, pFlow::rotationAxisMotionGeometry); +createInteraction(pFlow::cfModels::grainRolling>, pFlow::rotationAxisMotionGeometry); + +createInteraction(pFlow::cfModels::grainRolling>, pFlow::rotationAxisMotionGeometry); +createInteraction(pFlow::cfModels::grainRolling>, pFlow::rotationAxisMotionGeometry); + + +createInteraction(pFlow::cfModels::grainRolling>, pFlow::stationaryGeometry); +createInteraction(pFlow::cfModels::grainRolling>, pFlow::stationaryGeometry); + +createInteraction(pFlow::cfModels::grainRolling>, pFlow::stationaryGeometry); +createInteraction(pFlow::cfModels::grainRolling>, pFlow::stationaryGeometry); + + +createInteraction(pFlow::cfModels::grainRolling>, pFlow::vibratingMotionGeometry); +createInteraction(pFlow::cfModels::grainRolling>, pFlow::vibratingMotionGeometry); + +createInteraction(pFlow::cfModels::grainRolling>, pFlow::vibratingMotionGeometry); +createInteraction(pFlow::cfModels::grainRolling>, pFlow::vibratingMotionGeometry); \ No newline at end of file diff --git a/src/Interaction/grainInteraction/grainInteractionsNonLinearModModels.cpp b/src/Interaction/grainInteraction/grainInteractionsNonLinearModModels.cpp new file mode 100755 index 00000000..462b5eb3 --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteractionsNonLinearModModels.cpp @@ -0,0 +1,43 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#include "grainInteraction.hpp" +#include "geometryMotions.hpp" +#include "grainContactForceModels.hpp" +#include "unsortedContactList.hpp" +#include "sortedContactList.hpp" +#include "createBoundaryGrainInteraction.hpp" + + + +#define createInteraction(ForceModel,GeomModel) \ + \ + template class pFlow::grainInteraction< \ + ForceModel, \ + GeomModel, \ + pFlow::unsortedContactList>; \ + \ + template class pFlow::grainInteraction< \ + ForceModel, \ + GeomModel, \ + pFlow::sortedContactList>; \ + createBoundaryGrainInteraction(ForceModel, GeomModel) + + diff --git a/src/Interaction/grainInteraction/grainInteractionsNonLinearModels.cpp b/src/Interaction/grainInteraction/grainInteractionsNonLinearModels.cpp new file mode 100755 index 00000000..462b5eb3 --- /dev/null +++ b/src/Interaction/grainInteraction/grainInteractionsNonLinearModels.cpp @@ -0,0 +1,43 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#include "grainInteraction.hpp" +#include "geometryMotions.hpp" +#include "grainContactForceModels.hpp" +#include "unsortedContactList.hpp" +#include "sortedContactList.hpp" +#include "createBoundaryGrainInteraction.hpp" + + + +#define createInteraction(ForceModel,GeomModel) \ + \ + template class pFlow::grainInteraction< \ + ForceModel, \ + GeomModel, \ + pFlow::unsortedContactList>; \ + \ + template class pFlow::grainInteraction< \ + ForceModel, \ + GeomModel, \ + pFlow::sortedContactList>; \ + createBoundaryGrainInteraction(ForceModel, GeomModel) + + diff --git a/src/Particles/CMakeLists.txt b/src/Particles/CMakeLists.txt index b7f5ddc6..7cc91295 100644 --- a/src/Particles/CMakeLists.txt +++ b/src/Particles/CMakeLists.txt @@ -9,8 +9,17 @@ particles/regularParticleIdHandler/regularParticleIdHandler.cpp SphereParticles/sphereShape/sphereShape.cpp SphereParticles/sphereParticles/sphereParticles.cpp SphereParticles/sphereParticles/sphereParticlesKernels.cpp + +GrainParticles/grainShape/grainShape.cpp +GrainParticles/grainParticles/grainParticles.cpp +GrainParticles/grainParticles/grainParticlesKernels.cpp + SphereParticles/boundarySphereParticles.cpp SphereParticles/boundarySphereParticlesList.cpp + +GrainParticles/boundaryGrainParticles.cpp +GrainParticles/boundaryGrainParticlesList.cpp + Insertion/collisionCheck/collisionCheck.cpp Insertion/insertionRegion/insertionRegion.cpp Insertion/insertion/insertion.cpp diff --git a/src/Particles/GrainParticles/boundaryGrainParticles.cpp b/src/Particles/GrainParticles/boundaryGrainParticles.cpp new file mode 100644 index 00000000..49c8b7b2 --- /dev/null +++ b/src/Particles/GrainParticles/boundaryGrainParticles.cpp @@ -0,0 +1,64 @@ +#include "boundaryGrainParticles.hpp" +#include "boundaryBase.hpp" +#include "grainParticles.hpp" + + +pFlow::boundaryGrainParticles::boundaryGrainParticles( + const boundaryBase &boundary, + grainParticles &prtcls +) +: + generalBoundary(boundary, prtcls.pStruct(), "", ""), + particles_(prtcls) +{ + +} + +pFlow::grainParticles &pFlow::boundaryGrainParticles::Particles() +{ + return particles_; +} + +const pFlow::grainParticles &pFlow::boundaryGrainParticles::Particles() const +{ + return particles_; +} + +pFlow::uniquePtr pFlow::boundaryGrainParticles::create( + const boundaryBase &boundary, + grainParticles &prtcls +) +{ + + word bType = angleBracketsNames2( + "boundaryGrainParticles", + pFlowProcessors().localRunTypeName(), + boundary.type()); + + word altBType{"boundaryGrainParticles"}; + + if( boundaryBasevCtorSelector_.search(bType) ) + { + pOutput.space(4)<<"Creating boundary "<< Green_Text(bType)<< + " for "<"); + + boundaryGrainParticles( + const boundaryBase &boundary, + grainParticles& prtcls + ); + + create_vCtor( + boundaryGrainParticles, + boundaryBase, + ( + const boundaryBase &boundary, + grainParticles& prtcls + ), + (boundary, prtcls) + ); + + add_vCtor( + boundaryGrainParticles, + boundaryGrainParticles, + boundaryBase + ); + + grainParticles& Particles(); + + const grainParticles& Particles()const; + + bool hearChanges( + real t, + real dt, + uint32 iter, + const message &msg, + const anyList &varList) override + { + return true; + } + + virtual + bool acceleration(const timeInfo& ti, const realx3& g) + { + return true; + } + + static + uniquePtr create( + const boundaryBase &boundary, + grainParticles& prtcls); + +}; + + +} + + + +#endif diff --git a/src/Particles/GrainParticles/boundaryGrainParticlesList.cpp b/src/Particles/GrainParticles/boundaryGrainParticlesList.cpp new file mode 100644 index 00000000..4cd941bd --- /dev/null +++ b/src/Particles/GrainParticles/boundaryGrainParticlesList.cpp @@ -0,0 +1,19 @@ +#include "boundaryGrainParticlesList.hpp" + +pFlow::boundaryGrainParticlesList::boundaryGrainParticlesList( + const boundaryList &bndrs, + grainParticles &prtcls +) +: + ListPtr(bndrs.size()), + boundaries_(bndrs) +{ + for(auto i=0; iset + ( + i, + boundaryGrainParticles::create(boundaries_[i], prtcls) + ); + } +} \ No newline at end of file diff --git a/src/Particles/GrainParticles/boundaryGrainParticlesList.hpp b/src/Particles/GrainParticles/boundaryGrainParticlesList.hpp new file mode 100644 index 00000000..4fe22ad8 --- /dev/null +++ b/src/Particles/GrainParticles/boundaryGrainParticlesList.hpp @@ -0,0 +1,36 @@ + + +#ifndef __boundaryGrainParticlesList_hpp__ +#define __boundaryGrainParticlesList_hpp__ + +#include "ListPtr.hpp" +#include "boundaryList.hpp" +#include "boundaryGrainParticles.hpp" + +namespace pFlow +{ + +class boundaryGrainParticlesList +: + public ListPtr +{ +private: + + const boundaryList& boundaries_; + +public: + + boundaryGrainParticlesList( + const boundaryList& bndrs, + grainParticles& prtcls + ); + + ~boundaryGrainParticlesList()=default; + +}; + +} + + + +#endif \ No newline at end of file diff --git a/src/Particles/GrainParticles/grainParticles/grainParticles.cpp b/src/Particles/GrainParticles/grainParticles/grainParticles.cpp new file mode 100644 index 00000000..8293a510 --- /dev/null +++ b/src/Particles/GrainParticles/grainParticles/grainParticles.cpp @@ -0,0 +1,422 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#include "grainParticles.hpp" +#include "systemControl.hpp" +#include "vocabs.hpp" +#include "grainParticlesKernels.hpp" + +bool pFlow::grainParticles::initializeParticles() +{ + + using exeSpace = typename realPointField_D::execution_space; + using policy = Kokkos::RangePolicy< + exeSpace, + Kokkos::IndexType>; + + auto [minIndex, maxIndex] = minMax(shapeIndex().internal()); + + if( !grains_.indexValid(maxIndex) ) + { + fatalErrorInFunction<< + "the maximum value of shapeIndex is "<< maxIndex << + " which is not valid."<(shapeNames.size()); + + propIds.clear(); + propIds.reserve(numNew); + + diams.clear(); + diams.reserve(numNew); + + coarseGrainFactors.clear(); + coarseGrainFactors.reserve(numNew); + + m.clear(); + m.reserve(numNew); + + Is.clear(); + Is.reserve(numNew); + + shIndex.clear(); + shIndex.reserve(numNew); + + + for(const auto& name:shapeNames) + { + uint32 indx; + if(grains_.shapeNameToIndex(name,indx)) + { + shIndex.push_back(indx); + Is.push_back( grains_.Inertia(indx)); + m.push_back(grains_.mass(indx)); + diams.push_back(grains_.boundingDiameter(indx)); + coarseGrainFactors.push_back(grains_.coarseGrainFactor(indx)); + propIds.push_back( grains_.propertyId(indx)); + } + else + { + fatalErrorInFunction<<"Shape name "<< name << + "does not exist. The list is "<(0.0000000001) + ), + rVelocity_ + ( + objectFile + ( + "rVelocity", + "", + objectFile::READ_IF_PRESENT, + objectFile::WRITE_ALWAYS + ), + dynPointStruct(), + zero3 + ), + rAcceleration_ + ( + objectFile( + "rAcceleration", + "", + objectFile::READ_IF_PRESENT, + objectFile::WRITE_ALWAYS + ), + dynPointStruct(), + zero3 + ), + boundaryGrainParticles_ + ( + dynPointStruct().boundaries(), + *this + ), + accelerationTimer_( + "Acceleration", &this->timers() ), + intPredictTimer_( + "Integration-predict", &this->timers() ), + intCorrectTimer_( + "Integration-correct", &this->timers() ), + fieldUpdateTimer_( + "fieldUpdate", &this->timers() ) +{ + + auto intMethod = control.settingsDict().getVal("integrationMethod"); + REPORT(1)<<"Creating integration method "<dt(); + dynPointStruct().predict(dt, accelertion()); + rVelIntegration_().predict(dt,rVelocity_, rAcceleration_); + intPredictTimer_.end(); + + fieldUpdateTimer_.start(); + propertyId_.updateBoundariesSlaveToMasterIfRequested(); + grainDiameter_.updateBoundariesSlaveToMasterIfRequested(); + coarseGrainFactor_.updateBoundariesSlaveToMasterIfRequested(); + mass_.updateBoundariesSlaveToMasterIfRequested(); + I_.updateBoundariesSlaveToMasterIfRequested(); + rVelocity_.updateBoundariesSlaveToMasterIfRequested(); + rAcceleration_.updateBoundariesSlaveToMasterIfRequested(); + rVelIntegration_().updateBoundariesSlaveToMasterIfRequested(); + fieldUpdateTimer_.end(); + + return true; +} + +bool pFlow::grainParticles::iterate() +{ + + timeInfo ti = TimeInfo(); + realx3 g = control().g(); + + particles::iterate(); + accelerationTimer_.start(); + pFlow::grainParticlesKernels::acceleration( + g, + mass().deviceViewAll(), + contactForce().deviceViewAll(), + I().deviceViewAll(), + contactTorque().deviceViewAll(), + dynPointStruct().activePointsMaskDevice(), + accelertion().deviceViewAll(), + rAcceleration().deviceViewAll() + ); + for(auto& bndry:boundaryGrainParticles_) + { + bndry->acceleration(ti, g); + } + accelerationTimer_.end(); + + intCorrectTimer_.start(); + + if(!dynPointStruct().correct(dt(), accelertion())) + { + return false; + } + if(!rVelIntegration_().correct( + dt(), + rVelocity_, + rAcceleration_)) + { + return false; + } + + intCorrectTimer_.end(); + + return true; +} + +bool pFlow::grainParticles::insertParticles +( + const realx3Vector &position, + const wordVector &shapesNames, + const anyList &setVarList +) +{ + anyList newVarList(setVarList); + + realVector mass("mass"); + realVector I("I"); + realVector diameter("diameter"); + realVector coarseGrainFactor("coarseGrainFactor"); + uint32Vector propId("propId"); + uint32Vector shapeIdx("shapeIdx"); + + if(!getParticlesInfoFromShape( + shapesNames, + propId, + diameter, + coarseGrainFactor, + mass, + I, + shapeIdx)) + { + return false; + } + + newVarList.emplaceBack( + mass_.name()+"Vector", + std::move(mass)); + + newVarList.emplaceBack( + I_.name()+"Vector", + std::move(I)); + + newVarList.emplaceBack( + grainDiameter_.name()+"Vector", + std::move(diameter)); + + newVarList.emplaceBack( + coarseGrainFactor_.name()+"Vector", + std::move(coarseGrainFactor)); + + newVarList.emplaceBack( + propertyId_.name()+"Vector", + std::move(propId)); + + newVarList.emplaceBack( + shapeIndex().name()+"Vector", + std::move(shapeIdx)); + + if(!dynPointStruct().insertPoints(position, newVarList)) + { + return false; + } + + return true; +} + +pFlow::word pFlow::grainParticles::shapeTypeName()const +{ + return "grain"; +} + +const pFlow::shape &pFlow::grainParticles::getShapes() const +{ + return grains_; +} + +void pFlow::grainParticles::boundingSphereMinMax +( + real & minDiam, + real& maxDiam +)const +{ + minDiam = grains_.minBoundingSphere(); + maxDiam = grains_.maxBoundingSphere(); +} diff --git a/src/Particles/GrainParticles/grainParticles/grainParticles.hpp b/src/Particles/GrainParticles/grainParticles/grainParticles.hpp new file mode 100644 index 00000000..9a0a35ac --- /dev/null +++ b/src/Particles/GrainParticles/grainParticles/grainParticles.hpp @@ -0,0 +1,236 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ +/** + * @class pFlow::sphereParticles + * + * @brief Class for managing spherical particles + * + * This is a top-level class that contains the essential components for + * defining spherical prticles in a DEM simulation. + */ + +#ifndef __grainParticles_hpp__ +#define __grainParticles_hpp__ + +#include "indexContainer.hpp" +#include "particles.hpp" +#include "property.hpp" +#include "grainShape.hpp" +#include "boundaryGrainParticlesList.hpp" +#include "systemControl.hpp" + +namespace pFlow +{ + +class grainParticles : public particles +{ +public: + + using ShapeType = grainShape; + +private: + + /// reference to shapes + ShapeType grains_; + + /// property id on device + uint32PointField_D propertyId_; + + /// diameter / boundig sphere size of particles on device + realPointField_D grainDiameter_; + + realPointField_D coarseGrainFactor_; + + + /// mass of particles field + realPointField_D mass_; + + /// pointField of inertial of particles + realPointField_D I_; + + /// pointField of rotational Velocity of particles on device + realx3PointField_D rVelocity_; + + /// pointField of rotational acceleration of particles on device + realx3PointField_D rAcceleration_; + + /// boundaries + boundaryGrainParticlesList boundaryGrainParticles_; + + /// rotational velocity integrator + uniquePtr rVelIntegration_ = nullptr; + + /// timer for acceleration computations + Timer accelerationTimer_; + + /// timer for integration computations (prediction step) + Timer intPredictTimer_; + + /// timer for integration computations (correction step) + Timer intCorrectTimer_; + + Timer fieldUpdateTimer_; + +private: + + + bool getParticlesInfoFromShape( + const wordVector& shapeNames, + uint32Vector& propIds, + realVector& diams, + realVector& coarseGrainFactors, + realVector& m, + realVector& Is, + uint32Vector& shIndex + ); + /*bool initializeParticles(); + + bool insertSphereParticles( + const wordVector& names, + const int32IndexContainer& indices, + bool setId = true); + + virtual uniquePtr> getFieldObjectList()const override; + */ + +public: + + /// construct from systemControl and property + grainParticles(systemControl& control, const property& prop); + + ~grainParticles() override = default; + + /** + * Insert new particles in position with specified shapes + * + * This function is involked by inserted object to insert new set of + * particles into the simulation. \param position position of new particles + * \param shape shape of new particles + * \param setField initial value of the selected fields for new particles + */ + /*bool insertParticles + ( + const realx3Vector& position, + const wordVector& shapes, + const setFieldList& setField + ) override ;*/ + + // TODO: make this method private later + bool initializeParticles(); + + /// const reference to shapes object + const auto& grains() const + { + return grains_; + } + + /// const reference to inertia pointField + const auto& I() const + { + return I_; + } + + /// reference to inertia pointField + auto& I() + { + return I_; + } + + const auto& rVelocity() const + { + return rVelocity_; + } + + auto& rVelocity() + { + return rVelocity_; + } + + bool hearChanges( + real t, + real dt, + uint32 iter, + const message& msg, + const anyList& varList + ) override + { + notImplementedFunction; + return false; + } + + const uint32PointField_D& propertyId() const override + { + return propertyId_; + } + + const realPointField_D& diameter() const override + { + return grainDiameter_; + } + + const realPointField_D& coarseGrainFactor() const + { + return coarseGrainFactor_; + } + + + const realPointField_D& mass() const override + { + return mass_; + } + + /// before iteration step + bool beforeIteration() override; + + /// iterate particles + bool iterate() override; + + bool insertParticles( + const realx3Vector& position, + const wordVector& shapesNames, + const anyList& setVarList + ) override; + + realx3PointField_D& rAcceleration() override + { + return rAcceleration_; + } + + const realx3PointField_D& rAcceleration() const override + { + return rAcceleration_; + } + + const realPointField_D& boundingSphere() const override + { + return diameter(); + } + + word shapeTypeName() const override; + + const shape& getShapes() const override; + + void boundingSphereMinMax(real& minDiam, real& maxDiam) const override; + +};// grainParticles + +} // pFlow + +#endif //__sphereParticles_hpp__ diff --git a/src/Particles/GrainParticles/grainParticles/grainParticlesKernels.cpp b/src/Particles/GrainParticles/grainParticles/grainParticlesKernels.cpp new file mode 100644 index 00000000..51891205 --- /dev/null +++ b/src/Particles/GrainParticles/grainParticles/grainParticlesKernels.cpp @@ -0,0 +1,101 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +-----------------------------------------------------------------------------*/ + +#include "grainParticlesKernels.hpp" + +using policy = Kokkos::RangePolicy< + pFlow::DefaultExecutionSpace, + Kokkos::Schedule, + Kokkos::IndexType>; + +void pFlow::grainParticlesKernels::addMassDiamInertiaProp +( + deviceViewType1D shapeIndex, + deviceViewType1D mass, + deviceViewType1D diameter, + deviceViewType1D coarseGrainFactor, + deviceViewType1D I, + deviceViewType1D propertyId, + pFlagTypeDevice incld, + deviceViewType1D src_mass, + deviceViewType1D src_diameter, + deviceViewType1D src_I, + deviceViewType1D src_propertyId +) +{ + auto aRange = incld.activeRange(); + + Kokkos::parallel_for( + "particles::initInertia", + policy(aRange.start(), aRange.end()), + LAMBDA_HD(uint32 i) + { + if(incld(i)) + { + uint32 index = shapeIndex[i]; + I[i] = src_I[index]; + diameter[i] = src_diameter[index]; + mass[i] = src_mass[index]; + propertyId[i] = src_propertyId[index]; + } + }); + +} + +void pFlow::grainParticlesKernels::acceleration +( + const realx3& g, + const deviceViewType1D& mass, + const deviceViewType1D& force, + const deviceViewType1D& I, + const deviceViewType1D& torque, + const pFlagTypeDevice& incld, + deviceViewType1D lAcc, + deviceViewType1D rAcc +) +{ + + auto activeRange = incld.activeRange(); + if(incld.isAllActive()) + { + Kokkos::parallel_for( + "pFlow::grainParticlesKernels::acceleration", + policy(activeRange.start(), activeRange.end()), + LAMBDA_HD(uint32 i){ + lAcc[i] = force[i]/mass[i] + g; + rAcc[i] = torque[i]/I[i]; + }); + } + else + { + Kokkos::parallel_for( + "pFlow::grainParticlesKernels::acceleration", + policy(activeRange.start(), activeRange.end()), + LAMBDA_HD(uint32 i){ + if(incld(i)) + { + lAcc[i] = force[i]/mass[i] + g; + rAcc[i] = torque[i]/I[i]; + } + }); + + } + + Kokkos::fence(); +} diff --git a/src/Particles/GrainParticles/grainParticles/grainParticlesKernels.hpp b/src/Particles/GrainParticles/grainParticles/grainParticlesKernels.hpp new file mode 100644 index 00000000..daed7808 --- /dev/null +++ b/src/Particles/GrainParticles/grainParticles/grainParticlesKernels.hpp @@ -0,0 +1,59 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#ifndef __grainParticlesKernels_hpp__ +#define __grainParticlesKernels_hpp__ + +#include "types.hpp" +#include "pointFlag.hpp" + +namespace pFlow::grainParticlesKernels +{ + +void addMassDiamInertiaProp( + deviceViewType1D shapeIndex, + deviceViewType1D mass, + deviceViewType1D diameter, + deviceViewType1D coarseGrainFactor, + + deviceViewType1D I, + deviceViewType1D propertyId, + pFlagTypeDevice incld, + deviceViewType1D src_mass, + deviceViewType1D src_grainDiameter, + deviceViewType1D src_I, + deviceViewType1D src_propertyId +); + +void acceleration( + const realx3& g, + const deviceViewType1D& mass, + const deviceViewType1D& force, + const deviceViewType1D& I, + const deviceViewType1D& torque, + const pFlagTypeDevice& incld, + deviceViewType1D lAcc, + deviceViewType1D rAcc +); + + +} + +#endif diff --git a/src/Particles/GrainParticles/grainShape/grainShape.cpp b/src/Particles/GrainParticles/grainShape/grainShape.cpp new file mode 100644 index 00000000..4558940b --- /dev/null +++ b/src/Particles/GrainParticles/grainShape/grainShape.cpp @@ -0,0 +1,242 @@ +/*------------------------------- phasicFlow --------------------------------- + O C enter of + O O E ngineering and + O O M ultiscale modeling of + OOOOOOO F luid flow +------------------------------------------------------------------------------ + Copyright (C): www.cemf.ir + email: hamid.r.norouzi AT gmail.com +------------------------------------------------------------------------------ +Licence: + This file is part of phasicFlow code. It is a free software for simulating + granular and multiphase flows. You can redistribute it and/or modify it under + the terms of GNU General Public License v3 or any other later versions. + + phasicFlow is distributed to help others in their research in the field of + granular and multiphase flows, but WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +-----------------------------------------------------------------------------*/ + +#include "grainShape.hpp" + + +bool pFlow::grainShape::readFromDictionary3() +{ + + grainDiameters_ = getVal("grainDiameters"); + + sphereDiameters_ = getVal("sphereDiameters"); + + coarseGrainFactor_ = grainDiameters_ / sphereDiameters_ ; + + + if(grainDiameters_.size() != numShapes() ) + { + fatalErrorInFunction<< + " number of elements in grain diameters in "<< globalName()<<" is not consistent"<"); + + grainShape( + const word& fileName, + repository* owner, + const property& prop); + + + ~grainShape() override = default; + + //// - Methods + + real maxBoundingSphere()const override; + + real minBoundingSphere()const override; + + bool boundingDiameter(uint32 index, real& bDiam)const override; + + real boundingDiameter(uint32 index)const override; + + realVector boundingDiameter()const override; + + real coarseGrainFactor(uint32 index)const ; + + realVector coarseGrainFactor()const ; + + real orginalDiameter(uint32 index)const ; + + realVector orginalDiameter()const ; + + bool mass(uint32 index, real& m)const override; + + real mass(uint32 index) const override; + + realVector mass()const override; + + realVector density() const override; + + bool Inertia(uint32 index, real& I)const override; + + real Inertia(uint32 index)const override; + + realVector Inertia()const override; + + bool Inertia_xx(uint32 index, real& Ixx)const override; + + real Inertial_xx(uint32 index)const override; + + bool Inertia_yy(uint32 index, real& Iyy)const override; + + real Inertial_yy(uint32 index)const override; + + bool Inertia_zz(uint32 index, real& Izz)const override; + + real Inertial_zz(uint32 index)const override; + +}; + +} // pFlow + +#endif //__grainShape_hpp__ diff --git a/src/Particles/Insertion/Insertion/Insertions.cpp b/src/Particles/Insertion/Insertion/Insertions.cpp index 2bc3bd92..5405b3f6 100644 --- a/src/Particles/Insertion/Insertion/Insertions.cpp +++ b/src/Particles/Insertion/Insertion/Insertions.cpp @@ -21,4 +21,5 @@ Licence: #include "Insertions.hpp" -template class pFlow::Insertion; \ No newline at end of file +template class pFlow::Insertion; +template class pFlow::Insertion; \ No newline at end of file diff --git a/src/Particles/Insertion/Insertion/Insertions.hpp b/src/Particles/Insertion/Insertion/Insertions.hpp index deaafba2..b513295d 100644 --- a/src/Particles/Insertion/Insertion/Insertions.hpp +++ b/src/Particles/Insertion/Insertion/Insertions.hpp @@ -24,11 +24,15 @@ Licence: #include "Insertion.hpp" #include "sphereShape.hpp" +#include "grainShape.hpp" + namespace pFlow { using sphereInsertion = Insertion ; +using grainInsertion = Insertion ; + } diff --git a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp index 9a3d13c0..86e71b89 100644 --- a/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp +++ b/src/phasicFlow/structuredData/boundaries/boundaryBase/boundaryBase.hpp @@ -164,10 +164,12 @@ protected: return true; } - uint32 markInNegativeSide(const word& name, uint32Vector_D& markedIndices )const; public: + uint32 markInNegativeSide(const word& name, uint32Vector_D& markedIndices )const; + + TypeInfo("boundaryBase"); boundaryBase( From 192ff67bff5289442bb557be62eb1aa13015a6d9 Mon Sep 17 00:00:00 2001 From: PhasicFlow <113092888+PhasicFlow@users.noreply.github.com> Date: Sun, 17 Nov 2024 14:47:49 +0330 Subject: [PATCH 20/20] Update bashrc version is added to the end of file name --- cmake/bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/bashrc b/cmake/bashrc index d5e04cf8..277080d3 100644 --- a/cmake/bashrc +++ b/cmake/bashrc @@ -1,7 +1,7 @@ export pFlow_PROJECT_VERSION=v-1.0 -export pFlow_PROJECT=phasicFlowV-1.0 +export pFlow_PROJECT="phasicFlow-$pFlow_PROJECT_VERSION" projectDir="$HOME/PhasicFlow"