From f6dfa76f6d3737694327209e777288e4f6de1300 Mon Sep 17 00:00:00 2001
From: Vaggelis Papoutsis <vaggelisp@gmail.com>
Date: Wed, 8 Dec 2021 16:05:59 +0200
Subject: [PATCH] TUT: updated the motorbike tutorial

to also compute smoothed sensitivity maps
---
 .../motorBike/system/faSchemes                | 47 +++++++++++++++
 .../motorBike/system/faSolution               | 33 ++++++++++
 .../motorBike/system/optimisationDict         | 60 ++++++++++++++++---
 3 files changed, 133 insertions(+), 7 deletions(-)
 create mode 100644 tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSchemes
 create mode 100644 tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSolution

diff --git a/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSchemes b/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSchemes
new file mode 100644
index 00000000000..46b178e1104
--- /dev/null
+++ b/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSchemes
@@ -0,0 +1,47 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2108                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      faSchemes;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+ddtSchemes
+{
+    default            steadyState;
+}
+
+gradSchemes
+{
+    default            Gauss linear;
+}
+
+divSchemes
+{
+    default            Gauss linear;
+}
+
+laplacianSchemes
+{
+    default            Gauss linear limited 0.333;
+}
+
+interpolationSchemes
+{
+    default            linear;
+}
+
+snGradSchemes
+{
+    default            limited 0.333;
+}
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSolution b/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSolution
new file mode 100644
index 00000000000..a939d23203d
--- /dev/null
+++ b/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/faSolution
@@ -0,0 +1,33 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+| =========                 |                                                 |
+| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
+|  \\    /   O peration     | Version:  v2108                                 |
+|   \\  /    A nd           | Website:  www.openfoam.com                      |
+|    \\/     M anipulation  |                                                 |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+    version     2.0;
+    format      ascii;
+    class       dictionary;
+    object      faSolution;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+solvers
+{
+    smoothedSens
+    {
+        solver          PCG;
+        preconditioner  DIC;
+        tolerance       1e-08;
+        relTol          0.01;
+    }
+}
+
+relaxationFactors
+{
+    smoothedSens    0.4;
+}
+
+// ************************************************************************* //
diff --git a/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/optimisationDict b/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/optimisationDict
index e48a9498d31..94effd916b9 100644
--- a/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/optimisationDict
+++ b/tutorials/incompressible/adjointOptimisationFoam/sensitivityMaps/motorBike/system/optimisationDict
@@ -108,14 +108,60 @@ optimisation
 {
     sensitivities
     {
-        type               surfacePoints;
-        patches            (motorBikeGroup);
-        includeSurfaceArea false;
-        adjointEikonalSolver
+        // Used to compute a number of variants of the sensitivity map
+        // at once
+        type            multiple;
+        patches         (motorBikeGroup);
+        sensTypes
         {
-            tolerance 1.e-5;
-            iters     1000;
-            epsilon   0.1;
+            pointBased
+            {
+                type               surfacePoints;
+                patches            (motorBikeGroup);
+                includeSurfaceArea false;
+                adjointEikonalSolver
+                {
+                    tolerance 1.e-5;
+                    iters     1000;
+                    epsilon   0.1;
+                }
+            }
+            faceBased-unsmoothed
+            {
+                type                 surface;
+                patches              (motorBikeGroup);
+                includeSurfaceArea   false;
+            }
+            faceBased-RMult_2
+            {
+                type                 surface;
+                patches              (motorBikeGroup);
+                includeSurfaceArea   false;
+                smoothSensitivities  true;
+                meanRadiusMultiplier 2;
+                suffix               Rmult2; // suffix of the sensitivity map output files
+                iters                2000;
+            }
+            faceBased-RMult_5
+            {
+                type                 surface;
+                patches              (motorBikeGroup);
+                includeSurfaceArea   false;
+                smoothSensitivities  true;
+                meanRadiusMultiplier 5;
+                suffix               Rmult5; // suffix of the sensitivity map output files
+                iters                2000;
+            }
+            faceBased-RMult_10
+            {
+                type                 surface;
+                patches              (motorBikeGroup);
+                includeSurfaceArea   false;
+                smoothSensitivities  true;
+                meanRadiusMultiplier 10;
+                suffix               Rmult10; // suffix of the sensitivity map output files
+                iters                2000;
+            }
         }
     }
 }
-- 
GitLab