From 3449f4a503d87439c2a5711ed3b5c2cf29b7cf75 Mon Sep 17 00:00:00 2001
From: Chris Greenshields <http://cfd.direct>
Date: Tue, 11 Aug 2015 14:48:58 +0100
Subject: [PATCH] Template explicitPorositySource fvOption with a set of
 template coordinate systems for the porous media

---
 .../general/coordinateSystem/cartesianXY      | 26 ++++++++
 .../general/coordinateSystem/cartesianXZ      | 26 ++++++++
 .../general/coordinateSystem/cartesianYZ      | 26 ++++++++
 .../general/coordinateSystem/cylindrical      | 24 ++++++++
 .../general/fvOptions/porosity/porousZone     | 60 +++++++++++++++++++
 5 files changed, 162 insertions(+)
 create mode 100644 etc/caseDicts/general/coordinateSystem/cartesianXY
 create mode 100644 etc/caseDicts/general/coordinateSystem/cartesianXZ
 create mode 100644 etc/caseDicts/general/coordinateSystem/cartesianYZ
 create mode 100644 etc/caseDicts/general/coordinateSystem/cylindrical
 create mode 100644 etc/caseDicts/general/fvOptions/porosity/porousZone

diff --git a/etc/caseDicts/general/coordinateSystem/cartesianXY b/etc/caseDicts/general/coordinateSystem/cartesianXY
new file mode 100644
index 00000000000..020366c10f4
--- /dev/null
+++ b/etc/caseDicts/general/coordinateSystem/cartesianXY
@@ -0,0 +1,26 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      cartesianXY;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+type      cartesian;
+origin    (0 0 0);
+coordinateRotation
+{
+    type  axesRotation;
+    e1    $x;
+    e2    $y;
+}
+
+//************************************************************************* //
diff --git a/etc/caseDicts/general/coordinateSystem/cartesianXZ b/etc/caseDicts/general/coordinateSystem/cartesianXZ
new file mode 100644
index 00000000000..e1be4c9dd49
--- /dev/null
+++ b/etc/caseDicts/general/coordinateSystem/cartesianXZ
@@ -0,0 +1,26 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      cartesianXZ;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+type      cartesian;
+origin    (0 0 0);
+coordinateRotation
+{
+    type  axesRotation;
+    e1    $x;
+    e3    $z;
+}
+
+//************************************************************************* //
diff --git a/etc/caseDicts/general/coordinateSystem/cartesianYZ b/etc/caseDicts/general/coordinateSystem/cartesianYZ
new file mode 100644
index 00000000000..e2def70c321
--- /dev/null
+++ b/etc/caseDicts/general/coordinateSystem/cartesianYZ
@@ -0,0 +1,26 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      cartesianYZ;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+type      cartesian;
+origin    (0 0 0);
+coordinateRotation
+{
+    type  axesRotation;
+    e2    $y;
+    e3    $z
+}
+
+//************************************************************************* //
diff --git a/etc/caseDicts/general/coordinateSystem/cylindrical b/etc/caseDicts/general/coordinateSystem/cylindrical
new file mode 100644
index 00000000000..ff5b3559d3c
--- /dev/null
+++ b/etc/caseDicts/general/coordinateSystem/cylindrical
@@ -0,0 +1,24 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      cylindrical;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+type      cartesian;
+coordinateRotation
+{
+    type  localAxesRotation;
+    e3    $axis;
+}
+
+//************************************************************************* //
diff --git a/etc/caseDicts/general/fvOptions/porosity/porousZone b/etc/caseDicts/general/fvOptions/porosity/porousZone
new file mode 100644
index 00000000000..393edc63464
--- /dev/null
+++ b/etc/caseDicts/general/fvOptions/porosity/porousZone
@@ -0,0 +1,60 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  dev                                   |
+|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      porousZone;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+porousZone // Change to something more descriptive
+{
+    type           explicitPorositySource;
+    active         true;
+    selectionMode  cellZone;
+    cellZone       <cellZoneName>; // Specify the name of the cellZone
+
+    explicitPorositySourceCoeffs
+    {
+        type           DarcyForchheimer;
+
+        DarcyForchheimerCoeffs
+        {
+            // Negative coeffs are multiplied by largest positive coeff,
+            // taking the magnitude, e.g. for -1000, coeff = |1e7*-1000| = 1e10
+
+            d          d [0 -2 0 0 0 0 0] (1e7 -1000 -1000);
+            f          f [0 -1 0 0 0 0 0] (0 0 0);
+
+            coordinateSystem // Cartesian coordinates for the cellZone
+            {
+                x          (1 0 0);
+                y          (0 1 0);
+                #includeEtc "caseDicts/general/coordinateSystem/cartesianXY"
+            }
+        }
+
+        fixedCoeffCoeffs
+        {
+            alpha      alpha [0 0 -1 0 0 0 0] (100 -1000 -1000);
+            beta       beta  [0 -1 0 0 0 0 0] (0 0 0);
+            rhoRef     1.205;
+
+            coordinateSystem // Cylindrical coordinates for the cellZone
+            {
+                origin     (0 0 0);
+                axis       (0 0 1);
+                #includeEtc "caseDicts/general/coordinateSystem/cylindrical"
+            }
+        }
+    }
+}
+
+//************************************************************************** //
-- 
GitLab