From 5d571b51dcebc5075925a2a36e7ef2ff305ed036 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Mon, 25 Nov 2019 10:43:31 +0100
Subject: [PATCH] postoperation to debug the tree

---
 SlidingSurface3D/rfpm.pro | 73 ++++++++++++++++++++-------------------
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/SlidingSurface3D/rfpm.pro b/SlidingSurface3D/rfpm.pro
index 25c8379..c7fc558 100644
--- a/SlidingSurface3D/rfpm.pro
+++ b/SlidingSurface3D/rfpm.pro
@@ -1,6 +1,6 @@
 /*
-  3D Magnetostatics with 
-  - OpenCascade solid modelling 
+  3D Magnetostatics with
+  - OpenCascade solid modelling
   - geometrical identfication of faces
   - antiperiodic boundary conditions
   - sliding surface
@@ -23,14 +23,14 @@ RotorPosition = deg*
 AngularStep = deg*
   DefineNumber[1, Name "Options/1Angular step [deg]",
                Visible Flag_QuasiStatic];
-NumStep = 
+NumStep =
   DefineNumber[20, Name "Options/1Number of steps",
                Visible Flag_QuasiStatic];
 
-rpm = 2.*Pi/60. ; 
+rpm = 2.*Pi/60. ;
 w1 = 1000*rpm ;
 Mag_DTime = AngularStep/Fabs[w1] ;
-Mag_TimeMax = Mag_DTime*NumStep; 
+Mag_TimeMax = Mag_DTime*NumStep;
 
 
 Group {
@@ -67,9 +67,9 @@ Group {
 
   Sur_Dirichlet = Region[ { Outer, Top, Bottom } ];
 
-  Sur_Link = Region[ {Sur_SlidingMaster, Sur_SlidingSlave, 
+  Sur_Link = Region[ {Sur_SlidingMaster, Sur_SlidingSlave,
                       Sur_StatorPerMaster, Sur_StatorPerSlave,
-                      Sur_RotorPerMaster, Sur_RotorPerSlave} ] ; 
+                      Sur_RotorPerMaster, Sur_RotorPerSlave} ] ;
   Dom_Hcurl_a = Region[ { Vol_Mag, Sur_Link } ]; // No Neumann surface
 
 
@@ -95,14 +95,14 @@ Function{
 
 Function {
   // Sliding surface:
-  // a1 is the angular span of Region and RegionRef. 
-  // a0 is the mesh step of the meshes of 
+  // 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 
+  // 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). 
+  // 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
@@ -111,9 +111,9 @@ Function {
 
   Periodicity = -1. ;  // -1 for antiperiodicity, 1 for periodicity
   RotatePZ[] = Rotate[ XYZ[], 0, 0, $1 ] ;
-  Tol = 1e-8 ; fFloor[] = Floor[ $1 + Tol ] ; fRem[] = $1 - fFloor[ $1 / $2 ] * $2; 
+  Tol = 1e-8 ; fFloor[] = Floor[ $1 + Tol ] ; fRem[] = $1 - fFloor[ $1 / $2 ] * $2;
   deg = Pi/180;
-  a1 = (ModelAngleMax-ModelAngleMin)*deg ; 
+  a1 = (ModelAngleMax-ModelAngleMin)*deg ;
   a0 = a1/NbrDiv ; // angular span of one moving band element
   a2[] = $RotorPosition ;
   a3[] = ( ( fRem[ a2[], a0 ]#2 <= 0.5*a0 ) ? #2 : #2-a0 ) ;
@@ -162,20 +162,20 @@ Constraint {
       { Region Sur_Dirichlet ; Value 0. ; }
 
       // Periodicity condition on lateral faces
-      { Type Link ; Region Sur_StatorPerSlave ; RegionRef Sur_StatorPerMaster ; 
-      	ToleranceFactor 1e-8; 
+      { Type Link ; Region Sur_StatorPerSlave ; RegionRef Sur_StatorPerMaster ;
+      	ToleranceFactor 1e-8;
       	Coefficient Periodicity ; Function RotatePZ[ -a1 ] ; }
-      { Type Link ; Region Sur_RotorPerSlave ; RegionRef Sur_RotorPerMaster ; 
-      	ToleranceFactor 1e-8; 
+      { Type Link ; Region Sur_RotorPerSlave ; RegionRef Sur_RotorPerMaster ;
+      	ToleranceFactor 1e-8;
       	Coefficient Periodicity ; Function RotatePZ[ -a1 ] ; }
 
       // Sliding surface
-      { Type Link ; Region Sur_SlidingSlave ; SubRegion Lin_SlidingSubslave ; 
-      	RegionRef Sur_SlidingMaster ; SubRegionRef Lin_SlidingSubmaster ; 
-      	ToleranceFactor 1e-8; 
-      	Coefficient Coef[] ; Function AlignWithMaster[] ; 
+      { Type Link ; Region Sur_SlidingSlave ; SubRegion Lin_SlidingSubslave ;
+      	RegionRef Sur_SlidingMaster ; SubRegionRef Lin_SlidingSubmaster ;
+      	ToleranceFactor 1e-8;
+      	Coefficient Coef[] ; Function AlignWithMaster[] ;
 		FunctionRef RestoreRef[] ;
-      } 
+      }
     }
   }
   { Name GaugeCondition_a ; Type Assign ;
@@ -191,7 +191,7 @@ Constraint {
 FunctionSpace {
   { Name Hcurl_a; Type Form1;
     BasisFunction {
-      { Name se;  NameOfCoef ae;  Function BF_Edge; 
+      { Name se;  NameOfCoef ae;  Function BF_Edge;
 	Support Dom_Hcurl_a ; Entity EdgesOf[ All ]; }
     }
     Constraint {
@@ -235,7 +235,7 @@ Resolution {
       Evaluate[ $a3 = a3[] ];
       Evaluate[ $aa = Fmod[ a2[], a0 ] ];
       Evaluate[ $bb = fRem[ a2[], a0 ] ];
-      Print[ {$RotorPosition/deg, $a2/deg, $a3/deg, $aa/deg, $bb/deg}, 
+      Print[ {$RotorPosition/deg, $a2/deg, $a3/deg, $aa/deg, $bb/deg},
 	     Format "wt=%e a2=%e a3=%e %e %e"] ;
 
       UpdateConstraint[Sys_Mag] ;
@@ -271,15 +271,15 @@ Resolution {
 PostProcessing {
   { Name MagSta_a ; NameOfFormulation MagSta_a ;
     PostQuantity {
-      { Name b ; Value { Local { [ {d a} ]; 
+      { Name b ; Value { Local { [ {d a} ];
 	    In Vol_Mag ; Jacobian Vol; } } }
-      { Name bsurf ; Value { Local { [ {d a} ]; 
+      { Name bsurf ; Value { Local { [ {d a} ];
 	    In Sur_Link ; Jacobian Sur; } } }
-      { Name asurf ; Value { Local { [ {a} ]; 
+      { Name asurf ; Value { Local { [ {a} ];
 	    In Sur_Link ; Jacobian Sur; } } }
-      { Name br ; Value { Local { [ br[] ]; 
+      { Name br ; Value { Local { [ br[] ];
 	    In Vol_Magnets ; Jacobian Vol; } } }
-      { Name a ; Value { Local { [ {a} ]; 
+      { Name a ; Value { Local { [ {a} ];
 	    In Vol_Mag ; Jacobian Vol; } } }
     }
   }
@@ -287,7 +287,7 @@ PostProcessing {
 
 
 PostOperation Fields UsingPost MagSta_a {
-  Print[ b, OnElementsOf Region[ {Vol_Mag} ], 
+  Print[ b, OnElementsOf Region[ {Vol_Mag} ],
 	 LastTimeStepOnly, File "b.pos"] ;
   Echo[ Str["l=PostProcessing.NbViews-1;",
 	    "View[l].ArrowSizeMax = 100;",
@@ -318,14 +318,15 @@ PostOperation {
 }
 
 PostOperation Check_Periodicity UsingPost MagSta_a {
-  PrintGroup[ EdgesOfTreeIn[ { Vol_Tree }, StartingOn { Sur_Tree } ], 
-			  In Vol_Tree, File "Tree.pos"];
+  // Print the tree for debugging purposes (the group name
+  PrintGroup[ _CO_Entity_39 , In Vol_Tree, File "Tree.pos"];
+
   Echo[ Str["l=PostProcessing.NbViews-1;",
 			"View[l].ColorTable = { DarkRed };",
 			"View[l].LineWidth = 5;"] ,
 		File "tmp.geo", LastTimeStepOnly] ;
 
-  Print[ bsurf, OnElementsOf Region[ {Sur_SlidingMaster} ], 
+  Print[ bsurf, OnElementsOf Region[ {Sur_SlidingMaster} ],
 	 LastTimeStepOnly, File "bsm.pos"] ;
   Echo[ Str["l=PostProcessing.NbViews-1;",
 	    "View[l].ArrowSizeMax = 100;",
@@ -340,7 +341,7 @@ PostOperation Check_Periodicity UsingPost MagSta_a {
 	    "View[l].VectorType = 4;" ] ,
   	File "tmp.geo", LastTimeStepOnly] ;
 
-  Print[ bsurf, OnElementsOf Region[ {Sur_SlidingSlave} ], 
+  Print[ bsurf, OnElementsOf Region[ {Sur_SlidingSlave} ],
 	 LastTimeStepOnly, File "bss.pos"] ;
   Echo[ Str["l=PostProcessing.NbViews-1;",
 	    "View[l].ArrowSizeMax = 100;",
@@ -355,7 +356,7 @@ PostOperation Check_Periodicity UsingPost MagSta_a {
 	    "View[l].VectorType = 4;" ] ,
   	File "tmp.geo", LastTimeStepOnly] ;
 
-  Print[ bsurf, OnElementsOf Region[ Sur_Link ], 
+  Print[ bsurf, OnElementsOf Region[ Sur_Link ],
   	 LastTimeStepOnly, File "bsl.pos"] ;
   Echo[ Str["l=PostProcessing.NbViews-1;",
   	    "View[l].ArrowSizeMax = 100;",
-- 
GitLab