From ac3abe445abc92b8a83dbf98a92433bafa08e637 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Henrotte?= <francois.henrotte@uclouvain.be>
Date: Wed, 27 Nov 2019 11:47:15 +0100
Subject: [PATCH] added comments, removed transfinite feature for AirRing and
 all its surfaces, except SlidingMaster

---
 SlidingSurface3D/rfpm.geo        |  4 +-
 SlidingSurface3D/rfpm.pro        | 79 ++++++++++++++++----------------
 SlidingSurface3D/rfpm_common.pro |  2 -
 3 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/SlidingSurface3D/rfpm.geo b/SlidingSurface3D/rfpm.geo
index 83c7691..52d98f4 100644
--- a/SlidingSurface3D/rfpm.geo
+++ b/SlidingSurface3D/rfpm.geo
@@ -235,9 +235,9 @@ For num In { 0:#lines()-1 }
   EndIf
 EndFor
 
-Transfinite Surface{ surfaces() } ;
+// Transfinite Surface{ surfaces() } ;
+Transfinite Surface{ SlidingMaster() } ;
 Transfinite Surface{ SlidingSlave() };
-Transfinite Volume{ 10 };
 
 // Identify 'SlidingSubmaster' Curve
 
diff --git a/SlidingSurface3D/rfpm.pro b/SlidingSurface3D/rfpm.pro
index eef5946..851dafa 100644
--- a/SlidingSurface3D/rfpm.pro
+++ b/SlidingSurface3D/rfpm.pro
@@ -1,9 +1,15 @@
 /*
-  3D Magnetostatics with
+  Tutorial: 3D Magnetostatics with rotation and periodic boundary conditions
+
+  Features:
   - OpenCascade solid modelling
-  - geometrical identfication of faces
+  - geometrical identification of faces
   - antiperiodic boundary conditions
-  - sliding surface
+  - sliding surface to account for rotor rotation
+
+  To compute the solution interactively from the Gmsh GUI:
+      File > Open > microstrip.pro
+      Run (button at the bottom of the left panel)
 */
 
 Include "rfpm_common.pro";
@@ -25,6 +31,8 @@ AngularStep = deg * DefineNumber[2, Name "Options/1Angular step [deg]",
   Visible Flag_QuasiStatic];
 NumStep = DefineNumber[20, Name "Options/1Number of steps",
   Visible Flag_QuasiStatic];
+Gauge = DefineNumber[1, Name "Options/Gauging", 
+					 Choices{ 0="MUMPS", 1="Tree"}];
 
 rpm = 2. * Pi / 60. ;
 w1 = 1000 * rpm ;
@@ -90,20 +98,24 @@ Function{
 }
 
 Function {
-  // Sliding surface:
-  // a1 is the angular span of Region and RegionRef.
-  // a0 is the mesh step of the meshes of
-  // a2[] is the angular position (in radian) of the rotor
-  // relative to its reference position (as in the msh file)
-  // assumed to be aligned with the stator.
-  // a3[] is the shear angle of region AIRBM
-  // (smaller than half the discretization step of the sliding surface
-  // to adapt to a2[] values that are not multiple of this step).
-  // AlignWithMaster[] maps a point of coordinates {X[], Y[], Z[]} onto
-  // its image in the open set RegionRef-SubRegionRef by the symmetry mapping.
-  // Coef[] is evaluated on Master nodes
-  // fFloor[] is a safe version of Floor[] for real represented int variables
-  // fRem[a,b] substracts from a multiple of b so that the result is in [0,1[
+  // Functions for the Sliding surface technique:
+  // - a1 is the angular span (in radian) of the sliding regions SlidingMaster 
+  //   and SlidingSlave.
+  // - a0 is the mesh step of the sliding region in the direction of rotation.
+  // - a2[] is the angular position (in radian) of the rotor relative to its 
+  //   reference position (that in the msh file) assumed to be aligned with the
+  //   stator.
+  // - a3[] is the shear angle of the AirRing region to adapt to a2[] values 
+  //   that are not multiple of a0. On has fabs(a3[]) < a0/2.
+  // - AlignWithMaster[] maps a point of coordinates {X[], Y[], Z[]} onto its
+  //   image by periodicity in the open set SlidingMaster - SlidingSubMaster.
+  // - Coef[] = -1 or 1 is the coefficient of (anti-)periodicity condition.
+  //   This function is evaluated on SlidingMaster nodes
+  // - fFloor[] is a robust version of Floor[] for float-represented integer 
+  //   variables.
+  // - fRem[a,b] substracts from a multiple of b so that the result is in [0,b[
+  //   It is a robust version of the remainder of the integer division for 
+  //   float-represented integer variables.
 
   Periodicity = -1. ;  // -1 for antiperiodicity, 1 for periodicity
   RotatePZ[] = Rotate[ XYZ[], 0, 0, $1 ] ;
@@ -174,6 +186,11 @@ Constraint {
       }
     }
   }
+  // A correct spanning-tree is essential to the validity of the model.
+  // The spanning-tree must be autosimilar by rotation on the sliding surfaces
+  // (SubRegion2 clause, only the edges aligned with the Z axis are placed in 
+  // the tree), and be also a spanning-tree and Dirichlet and Link surfaces and
+  // their boundaries (SubRegion clause).
   { Name GaugeCondition_a ; Type Assign ;
     Case {
       { Region Vol_Tree ; Value 0. ;
@@ -296,22 +313,12 @@ PostOperation Fields UsingPost MagSta_a {
   	File "tmp.geo", LastTimeStepOnly] ;
 }
 
-PostOperation {
-  { Name pos; NameOfPostProcessing MagSta_a;
-    Operation {
-      Print[ b, OnElementsOf Dom_Hcurl_a, File "b.pos" ];
-
-      // Print[W_mag_Airgap[AIRGAP], OnGlobal, Format TimeTable,
-      // 	    File StrCat[resPath, "Energy_airgap.pos"]];
-      // Print[Flux[PM], OnGlobal, Format TimeTable,
-      // 	    File >> StrCat[resPath, "Flux.pos"]];
-    }
-  }
-}
-
 PostOperation Check_Periodicity UsingPost MagSta_a {
   If(Gauge == 1)
-    // Print the tree for debugging purposes (the group name
+    // Print the tree for debugging purposes.
+	// The group to print is the ExtendedGroup of type EdgesOfTreeIn 
+	// automatically generated by getDP at Pre-Processing.
+	// The group name name (here '_CO_Entity_39') is indicated in the message console.
     PrintGroup[ _CO_Entity_39 , In Vol_Tree, File "Tree.pos"];
 
     Echo[ Str["l=PostProcessing.NbViews-1;",
@@ -326,10 +333,6 @@ PostOperation Check_Periodicity UsingPost MagSta_a {
 	    "View[l].ArrowSizeMax = 100;",
 	    "View[l].CenterGlyphs = 0;",
 	    "View[l].GlyphLocation = 1;",
-	    "View[l].RangeType = 1;",
-	    "View[l].SaturateValues = 1;",
-	    "View[l].CustomMax = 2;",
-	    "View[l].CustomMin = 0;",
 	    "View[l].ScaleType = 1;",
 	    "View[l].LineWidth = 3;",
 	    "View[l].VectorType = 4;" ] ,
@@ -341,10 +344,6 @@ PostOperation Check_Periodicity UsingPost MagSta_a {
 	    "View[l].ArrowSizeMax = 100;",
 	    "View[l].CenterGlyphs = 0;",
 	    "View[l].GlyphLocation = 1;",
-	    "View[l].RangeType = 1;",
-	    "View[l].SaturateValues = 1;",
-	    "View[l].CustomMax = 2;",
-	    "View[l].CustomMin = 0;",
 	    "View[l].ScaleType = 1;",
 	    "View[l].LineWidth = 3;",
 	    "View[l].VectorType = 4;" ] ,
@@ -361,3 +360,5 @@ PostOperation Check_Periodicity UsingPost MagSta_a {
   	    "View[l].VectorType = 4;" ] ,
   	File "tmp.geo", LastTimeStepOnly] ;
 }
+
+
diff --git a/SlidingSurface3D/rfpm_common.pro b/SlidingSurface3D/rfpm_common.pro
index 76b3f4f..7eacae2 100644
--- a/SlidingSurface3D/rfpm_common.pro
+++ b/SlidingSurface3D/rfpm_common.pro
@@ -10,8 +10,6 @@ EndIf
 // Number of elements on the sliding surface in rotation direction
 NbrDiv = 50*mm/lc;
 
-Gauge = DefineNumber[1, Name "Options/Gauging", Choices{ 0="MUMPS", 1="Tree"}];
-
 ModelAngleMin = 0. ;
 ModelAngleMax = 60. ;
 
-- 
GitLab