From e33fb8d0dbeb7edb4b255e5259897d6baf254d85 Mon Sep 17 00:00:00 2001
From: Mattijs Janssens <ext-mjanssens@esi-group.com>
Date: Wed, 18 Dec 2024 17:05:54 +0000
Subject: [PATCH] Feature moving source

---
 .../scalarTransportFoam/moving_source/0/T     | 56 ++++++++++++
 .../scalarTransportFoam/moving_source/0/U     | 45 ++++++++++
 .../moving_source/README.txt                  |  4 +
 .../moving_source/constant/fvOptions          | 61 +++++++++++++
 .../moving_source/constant/meshMotion.dat     | 18 ++++
 .../constant/transportProperties              | 20 +++++
 .../moving_source/system/blockMeshDict        | 86 +++++++++++++++++++
 .../moving_source/system/controlDict          | 48 +++++++++++
 .../moving_source/system/fvSchemes            | 50 +++++++++++
 .../moving_source/system/fvSolution           | 35 ++++++++
 10 files changed, 423 insertions(+)
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/0/T
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/0/U
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/README.txt
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/constant/fvOptions
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/constant/meshMotion.dat
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/constant/transportProperties
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/system/blockMeshDict
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/system/controlDict
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/system/fvSchemes
 create mode 100644 tutorials/basic/scalarTransportFoam/moving_source/system/fvSolution

diff --git a/tutorials/basic/scalarTransportFoam/moving_source/0/T b/tutorials/basic/scalarTransportFoam/moving_source/0/T
new file mode 100644
index 00000000000..1d4e75d0bf9
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/0/T
@@ -0,0 +1,56 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volScalarField;
+    object      T;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 0 0 1 0 0 0];
+
+internalField   uniform 0;
+
+boundaryField
+{
+    inlet
+    {
+        type    uniformFixedValue;
+
+        uniformValue
+        {
+            type    constant;
+            value   0.0;
+        }
+    }
+
+    outlet
+    {
+        type    zeroGradient;
+    }
+
+    upperWall
+    {
+        type    zeroGradient;
+    }
+
+    lowerWall
+    {
+        type    zeroGradient;
+    }
+
+    frontAndBack
+    {
+        type    empty;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/0/U b/tutorials/basic/scalarTransportFoam/moving_source/0/U
new file mode 100644
index 00000000000..62ea7a1cbc0
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/0/U
@@ -0,0 +1,45 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       volVectorField;
+    object      U;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+dimensions      [0 1 -1 0 0 0 0];
+
+internalField   uniform (0.1 0 0);
+
+boundaryField
+{
+    #includeEtc "caseDicts/setConstraintTypes"
+
+    inlet
+    {
+        type            fixedValue;
+        value           $internalField;
+    }
+    outlet
+    {
+        type            zeroGradient;
+    }
+    upperWall
+    {
+        type            noSlip;
+    }
+    lowerWall
+    {
+        type            noSlip;
+    }
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/README.txt b/tutorials/basic/scalarTransportFoam/moving_source/README.txt
new file mode 100644
index 00000000000..8ed6b6aa0cd
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/README.txt
@@ -0,0 +1,4 @@
+- demo for using moving 'geometric' fvOption selection
+- flow left to right
+- scalar transport with zero (non-numerical) diffusion
+- still too many invocations of selection update
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/constant/fvOptions b/tutorials/basic/scalarTransportFoam/moving_source/constant/fvOptions
new file mode 100644
index 00000000000..03a3daaf84c
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/constant/fvOptions
@@ -0,0 +1,61 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      fvOptions;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+scalarSource1
+{
+    type            scalarSemiImplicitSource;
+
+    volumeMode      absolute;
+
+    selectionMode   geometric;
+    selection
+    {
+        cylinder
+        {
+            action  use;
+            source  cylinder;
+
+            point1  (0.05 0.03 -1); // beg point on cylinder axis
+            point2  (0.05 0.03  1); // end point on cylinder axis
+            radius  0.003;
+
+            solidBodyMotionFunction oscillatingLinearMotion;
+            oscillatingLinearMotionCoeffs
+            {
+                // coefficients
+                amplitude       (0 0.02 0);
+                omega           0.628318530718; // rad/s
+            }
+
+            /*
+            solidBodyMotionFunction tabulated6DoFMotion;
+            tabulated6DoFMotionCoeffs
+            {
+                // coefficients
+                timeDataFileName    "<constant>/meshMotion.dat";
+                CofG                (0 0 0);
+            }
+            */
+        }
+    }
+
+    sources
+    {
+        T           (1e-4 0);
+    }
+}
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/constant/meshMotion.dat b/tutorials/basic/scalarTransportFoam/moving_source/constant/meshMotion.dat
new file mode 100644
index 00000000000..696f47854f2
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/constant/meshMotion.dat
@@ -0,0 +1,18 @@
+4
+(
+    // Time Linear (xyz) Rotation (xyz)
+    (0      ((0 0   0)    (0 0 0)))
+    (1      ((0 0.02 0) (0 0 0)))
+    (2      ((0 -0.02 0) (0 0 0)))
+    (3      ((0 0 0) (0 0 0)))
+    (4      ((0 -0.02 0) (0 0 0)))
+    (5      ((0 0.02 0) (0 0 0)))
+    (6      ((0 0 0) (0 0 0)))
+    (7      ((0 0.02 0) (0 0 0)))
+    (8      ((0 -0.02 0) (0 0 0)))
+    (9      ((0 0 0) (0 0 0)))
+    (10     ((0 -0.02 0) (0 0 0)))
+    (11     ((0 0.02 0) (0 0 0)))
+    (12     ((0 0 0) (0 0 0)))
+)
+
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/constant/transportProperties b/tutorials/basic/scalarTransportFoam/moving_source/constant/transportProperties
new file mode 100644
index 00000000000..f9b02fe4c45
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/constant/transportProperties
@@ -0,0 +1,20 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      transportProperties;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+DT              0;  //0.01;
+
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/system/blockMeshDict b/tutorials/basic/scalarTransportFoam/moving_source/system/blockMeshDict
new file mode 100644
index 00000000000..002a46d69db
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/system/blockMeshDict
@@ -0,0 +1,86 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      blockMeshDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+scale   0.001;
+
+vertices
+(
+    (  0  0 0)
+    (100  0 0)
+    (100 60 0)
+    (  0 60 0)
+    (  0  0 1)
+    (100  0 1)
+    (100 60 1)
+    (  0 60 1)
+);
+
+blocks
+(
+    hex (0 1 2 3 4 5 6 7) (100 60 1) simpleGrading (1 1 1)
+);
+
+edges
+(
+);
+
+boundary
+(
+    inlet
+    {
+        type patch;
+        faces
+        (
+            (0 4 7 3)
+        );
+    }
+    outlet
+    {
+        type patch;
+        faces
+        (
+            (2 6 5 1)
+        );
+    }
+
+    upperWall
+    {
+        type wall;
+        faces
+        (
+            (3 7 6 2)
+        );
+    }
+    lowerWall
+    {
+        type wall;
+        faces
+        (
+            (1 5 4 0)
+        );
+    }
+    frontAndBack
+    {
+        type empty;
+        faces
+        (
+            (0 3 2 1)
+            (4 5 6 7)
+        );
+    }
+);
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/system/controlDict b/tutorials/basic/scalarTransportFoam/moving_source/system/controlDict
new file mode 100644
index 00000000000..72395bd1730
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/system/controlDict
@@ -0,0 +1,48 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      controlDict;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+application     scalarTransportFoam;
+
+startFrom       startTime;
+
+startTime       0;
+
+stopAt          endTime;
+
+endTime         10;
+
+deltaT          0.01;
+
+writeControl    timeStep;
+
+writeInterval   10;
+
+purgeWrite      0;
+
+writeFormat     ascii;
+
+writePrecision  6;
+
+writeCompression off;
+
+timeFormat      general;
+
+timePrecision   6;
+
+runTimeModifiable true;
+
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/system/fvSchemes b/tutorials/basic/scalarTransportFoam/moving_source/system/fvSchemes
new file mode 100644
index 00000000000..80048e5cee1
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/system/fvSchemes
@@ -0,0 +1,50 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      fvSchemes;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ddtSchemes
+{
+    default         Euler;  //CrankNicolson 0.9; //Euler;
+}
+
+gradSchemes
+{
+    default         Gauss linear;
+}
+
+divSchemes
+{
+    default         none;
+    div(phi,T)      Gauss linearUpwind grad(T);
+}
+
+laplacianSchemes
+{
+    default         none;
+    laplacian(DT,T) Gauss linear corrected;
+}
+
+interpolationSchemes
+{
+    default         linear;
+}
+
+snGradSchemes
+{
+    default         corrected;
+}
+
+
+// ************************************************************************* //
diff --git a/tutorials/basic/scalarTransportFoam/moving_source/system/fvSolution b/tutorials/basic/scalarTransportFoam/moving_source/system/fvSolution
new file mode 100644
index 00000000000..b258c9b1b6d
--- /dev/null
+++ b/tutorials/basic/scalarTransportFoam/moving_source/system/fvSolution
@@ -0,0 +1,35 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2312                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      fvSolution;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+solvers
+{
+    T
+    {
+        solver          PBiCGStab;
+        preconditioner  DILU;
+        tolerance       1e-6;
+        relTol          0;
+        norm            default;
+    }
+}
+
+SIMPLE
+{
+    nNonOrthogonalCorrectors 0;
+}
+
+
+// ************************************************************************* //
-- 
GitLab