From b6c519717c66e46656a4b45a76deaf5f62257781 Mon Sep 17 00:00:00 2001
From: mattijs <m.janssens@opencfd.co.uk>
Date: Thu, 15 May 2008 11:24:33 +0100
Subject: [PATCH] Dambreak with mesh refinement / unrefinement update.

---
 .../dynamicRefineFvMesh/dynamicRefineFvMesh.C |  40 +-
 .../interDyMFoam/damBreakWithObstacle/0/U     |   2 +-
 .../interDyMFoam/damBreakWithObstacle/0/gamma | 516 +++++++++++++++++-
 .../damBreakWithObstacle/0/gamma.org          |  38 +-
 .../interDyMFoam/damBreakWithObstacle/0/pd    |  40 +-
 .../pRefProbe/0.162094/pd                     |   1 -
 .../pRefProbe/0.215403/pd                     |   1 -
 .../damBreakWithObstacle/pRefProbe/0/pd       |   1 -
 .../damBreakWithObstacle/system/controlDict   |   2 +-
 .../system/decomposeParDict                   |   6 +-
 10 files changed, 597 insertions(+), 50 deletions(-)
 delete mode 100644 tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.162094/pd
 delete mode 100644 tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.215403/pd
 delete mode 100644 tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0/pd

diff --git a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
index aea12f59874..f15503f0a23 100644
--- a/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
+++ b/src/dynamicFvMesh/dynamicRefineFvMesh/dynamicRefineFvMesh.C
@@ -742,16 +742,21 @@ labelList dynamicRefineFvMesh::selectRefineCells
         }
     }
 
-    Info<< "Selected " << returnReduce(candidates.size(), sumOp<label>())
+    // Guarantee 2:1 refinement after refinement
+    labelList consistentSet
+    (
+        meshCutter_.consistentRefinement
+        (
+            candidates.shrink(),
+            true               // Add to set to guarantee 2:1
+        )
+    );
+
+    Info<< "Selected " << returnReduce(consistentSet.size(), sumOp<label>())
         << " cells for refinement out of " << globalData().nTotalCells()
         << "." << endl;
 
-    // Guarantee 2:1 refinement across processor patches.
-    return meshCutter_.consistentRefinement
-    (
-        candidates.shrink(),
-        true               // Add to set to guarantee 2:1
-    );
+    return consistentSet;
 }
 
 
@@ -795,18 +800,23 @@ labelList dynamicRefineFvMesh::selectUnrefinePoints
     }
 
 
-    Info<< "Selected " << returnReduce(newSplitPoints.size(), sumOp<label>())
-        << " split points out of a possible "
-        << returnReduce(splitPoints.size(), sumOp<label>())
-        << "." << endl;
-
     newSplitPoints.shrink();
 
-    return meshCutter_.consistentUnrefinement
+    // Guarantee 2:1 refinement after unrefinement
+    labelList consistentSet
     (
-        newSplitPoints,
-        false
+        meshCutter_.consistentUnrefinement
+        (
+            newSplitPoints,
+            false
+        )
     );
+    Info<< "Selected " << returnReduce(consistentSet.size(), sumOp<label>())
+        << " split points out of a possible "
+        << returnReduce(splitPoints.size(), sumOp<label>())
+        << "." << endl;
+
+    return consistentSet;
 }
 
 
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/0/U b/tutorials/interDyMFoam/damBreakWithObstacle/0/U
index dcfa645e62e..ee7d7034b30 100644
--- a/tutorials/interDyMFoam/damBreakWithObstacle/0/U
+++ b/tutorials/interDyMFoam/damBreakWithObstacle/0/U
@@ -1,7 +1,7 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  1.4.2                                 |
+|  \\    /   O peration     | Version:  dev                                   |
 |   \\  /    A nd           | Web:      http://www.openfoam.org               |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma b/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma
index 0836ad8cb18..6c15d6e3d52 100644
--- a/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma
+++ b/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma
@@ -1,7 +1,7 @@
 /*--------------------------------*- C++ -*----------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  1.4.2                                 |
+|  \\    /   O peration     | Version:  dev                                   |
 |   \\  /    A nd           | Web:      http://www.openfoam.org               |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
@@ -18,7 +18,7 @@ FoamFile
 dimensions      [0 0 0 0 0 0 0];
 
 internalField   nonuniform List<scalar> 
-32256
+32768
 (
 1
 1
@@ -980,6 +980,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -1940,6 +2004,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -2900,6 +3028,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -3860,6 +4052,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -4820,6 +5076,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -5780,6 +6100,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -6740,6 +7124,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
@@ -7700,6 +8148,70 @@ internalField   nonuniform List<scalar>
 0
 0
 0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
 1
 1
 1
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma.org b/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma.org
index d464dc7f1ee..eb2019aa850 100644
--- a/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma.org
+++ b/tutorials/interDyMFoam/damBreakWithObstacle/0/gamma.org
@@ -1,36 +1,50 @@
-/*--------------------------------*- C++ -*----------------------------------*\
+/*---------------------------------------------------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  1.4.2                                 |
+|  \\    /   O peration     | Version:  1.4                                   |
 |   \\  /    A nd           | Web:      http://www.openfoam.org               |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
+
 FoamFile
 {
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    object      gamma.org;
-    location    "0.001";
+    version         2.0;
+    format          ascii;
+
+    root            "";
+    case            "";
+    instance        "";
+    local           "";
+
+    class           volScalarField;
+    object          gamma;
 }
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+
 dimensions      [0 0 0 0 0 0 0];
 
 internalField   uniform 0;
 
 boundaryField
 {
-    atmosphere
+    walls        
     {
-        type            inletOutlet;
-        inletValue      uniform 0;
-        value           uniform 0;
+        type            zeroGradient;
     }
-    walls
+
+    obstacle       
     {
         type            zeroGradient;
     }
+
+    atmosphere      
+    {
+        type            inletOutlet;
+        inletValue      uniform 0;
+        value           uniform 0;
+    }
 }
 
 
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/0/pd b/tutorials/interDyMFoam/damBreakWithObstacle/0/pd
index cbdcfe68426..dd2a141b742 100644
--- a/tutorials/interDyMFoam/damBreakWithObstacle/0/pd
+++ b/tutorials/interDyMFoam/damBreakWithObstacle/0/pd
@@ -1,41 +1,55 @@
-/*--------------------------------*- C++ -*----------------------------------*\
+/*---------------------------------------------------------------------------*\
 | =========                 |                                                 |
 | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
-|  \\    /   O peration     | Version:  1.4.2                                 |
+|  \\    /   O peration     | Version:  1.4                                   |
 |   \\  /    A nd           | Web:      http://www.openfoam.org               |
 |    \\/     M anipulation  |                                                 |
 \*---------------------------------------------------------------------------*/
+
 FoamFile
 {
-    version     2.0;
-    format      ascii;
-    class       volScalarField;
-    object      pd;
-    location    "0.001";
+    version         2.0;
+    format          ascii;
+
+    root            "";
+    case            "";
+    instance        "";
+    local           "";
+
+    class           volScalarField;
+    object          pd;
 }
+
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
+
 dimensions      [1 -1 -2 0 0 0 0];
 
 internalField   uniform 0;
 
 boundaryField
 {
-    atmosphere
+    walls        
+    {
+        type            zeroGradient;
+    }
+
+    obstacle       
+    {
+        type            zeroGradient;
+    }
+
+    atmosphere      
     {
         type            totalPressure;
+        p0              uniform 0;
         U               U;
         phi             phi;
         rho             none;
         psi             none;
         gamma           1;
-        p0              uniform 0;
         value           uniform 0;
     }
-    walls
-    {
-        type            zeroGradient;
-    }
 }
 
 
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.162094/pd b/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.162094/pd
deleted file mode 100644
index a152eccd3b2..00000000000
--- a/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.162094/pd
+++ /dev/null
@@ -1 +0,0 @@
-#        Time (0.51 0.51 0.51)
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.215403/pd b/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.215403/pd
deleted file mode 100644
index a152eccd3b2..00000000000
--- a/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0.215403/pd
+++ /dev/null
@@ -1 +0,0 @@
-#        Time (0.51 0.51 0.51)
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0/pd b/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0/pd
deleted file mode 100644
index a152eccd3b2..00000000000
--- a/tutorials/interDyMFoam/damBreakWithObstacle/pRefProbe/0/pd
+++ /dev/null
@@ -1 +0,0 @@
-#        Time (0.51 0.51 0.51)
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/system/controlDict b/tutorials/interDyMFoam/damBreakWithObstacle/system/controlDict
index e1313279fd0..7e5d9001346 100644
--- a/tutorials/interDyMFoam/damBreakWithObstacle/system/controlDict
+++ b/tutorials/interDyMFoam/damBreakWithObstacle/system/controlDict
@@ -54,7 +54,7 @@ runTimeModifiable yes;
 
 adjustTimeStep  yes;
 
-maxCo           0.5;
+maxCo           0.1;
 
 maxDeltaT       1;
 
diff --git a/tutorials/interDyMFoam/damBreakWithObstacle/system/decomposeParDict b/tutorials/interDyMFoam/damBreakWithObstacle/system/decomposeParDict
index 88569a8784a..3843cd93db7 100644
--- a/tutorials/interDyMFoam/damBreakWithObstacle/system/decomposeParDict
+++ b/tutorials/interDyMFoam/damBreakWithObstacle/system/decomposeParDict
@@ -23,10 +23,10 @@ FoamFile
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
 
 
-numberOfSubdomains 4;
+numberOfSubdomains 6;
 
-//method          metis;
-method          hierarchical;
+method          metis;
+//method          hierarchical;
 
 simpleCoeffs
 {
-- 
GitLab