From ed7175070bd5e2cbd256d00e373fc01eccd3f71c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Henrotte?= <francois.henrotte@uclouvain.be>
Date: Mon, 2 Mar 2020 15:42:37 +0100
Subject: [PATCH] Fixed some flag conditions

---
 Conductors3D/w3d.pro | 475 +------------------------------------------
 1 file changed, 3 insertions(+), 472 deletions(-)

diff --git a/Conductors3D/w3d.pro b/Conductors3D/w3d.pro
index d2fc8df..1441768 100644
--- a/Conductors3D/w3d.pro
+++ b/Conductors3D/w3d.pro
@@ -472,7 +472,7 @@ PostProcessing {
           Value { Term { [ Im[ -{Us}/{Is}/omega/Lz ] ]; In Vol_C; }}}
       EndIf
       
-      If( Flag_Corr )
+      If( (Flag_Form == 2) && Flag_Corr )
         { Name bs;
           Value { Local { [ {d as}]; In Dom_Hthin_a; Jacobian Vol; }}}
         { Name bcorry;
@@ -487,7 +487,7 @@ PostProcessing {
 PostOperation map UsingPost MagnetoDynamics {
   Print[ J, OnElementsOf Vol_C, File "j.pos"];
   Print[ b, OnElementsOf Vol_nu, File "b.pos"];
-  If( Flag_Corr )
+  If( (Flag_Form == 2) && Flag_Corr )
     Print[ bs, OnElementsOf Vol_nu, File "bs.pos"];
     PrintGroup[ EdgesOf[ Vol_nu, ConnectedTo LWIRES ],
       In Vol_nu, File "group.pos"];
@@ -531,7 +531,7 @@ PostOperation cut UsingPost MagnetoDynamics {
 				 "View[l].LineWidth = 3;",
 				 "View[l].Type = 2;"],
 	File "tmp.geo", LastTimeStepOnly];
-  If( Flag_Corr )
+  If( (Flag_Form == 2) && Flag_Corr )
     Print [ bcorry, OnLine { {-Xmax,0,0} {Xmax,0,0} }{NbPoints},
       Format Gmsh, File "by.pos" ];
     Echo[ StrCat["l=PostProcessing.NbViews-1;",
@@ -543,473 +543,4 @@ PostOperation cut UsingPost MagnetoDynamics {
   EndIf
 }
 
-/*
-
-PostProcessing {
-  { Name MagnetoDynamics_corr; NameOfFormulation MagnetoDynamics;
-    PostQuantity {
-      { Name a;
-        Value { Local { [ {a}]; In  Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name b;
-        Value { Local { [ {d a}]; In  Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name by;
-        Value { Local { [ Cart2Pol[CompY [ {d a}]]]; In  Dom_Hcurl_a; Jacobian Vol; }}}
-
-      If( Flag_Form <= 1 )
-        { Name U;
-          Value { Term { [ {U} ]; In CATHODES; }}}
-        { Name flux;
-          Value { Term { [ Im[ {U}/omega ] ]; In CATHODES; }}}
-
-        Else
-        
-        { Name bc;
-          Value { Local { [ {d ac}]; In  Dom_Hcurl_a; Jacobian Vol; }}}
-        { Name bw;
-          Value { Local { [ {d aw}]; In  Dom_Hthin_a; Jacobian Vol; }}}
-        { Name byw;
-          Value { Local { [ Cart2Pol[CompY [ {d aw}]]]; In Dom_Hthin_a; Jacobian Vol; }}}
-        
-        { Name U;
-          Value { Term { [ {Us} ]; In CATHODES; }}}
-        { Name flux;
-          Value { Term { [ Im[ {Us}/omega ] ]; In CATHODES; }}}
-
-      EndIf
-        
-    }
-  }
-}
-
-PostOperation map_corr UsingPost MagnetoDynamics {
-    
-  Print[ b, OnElementsOf Vol_nu, File "b.pos"];
-  Print[ U, OnRegion CATHODES, File > "U.dat", Format Table,
-    SendToServer Sprintf["}Voltage/Wire %g",i]];
-  Print[ flux, OnRegion CATHODES, File > "L.dat", Format Table,
-    SendToServer Sprintf["}Inductance/Wire %g",i]];
-
-  If( Flag_Form >= 2 )
-    PrintGroup[ EdgesOf[ Vol_nu, ConnectedTo lVol_C ],
-      In Vol_nu, File "group.pos"];
-    Print [bw, OnElementsOf Vol_nu, File "b.pos"];
-  EndIf
-
-}
-
-
-
-FunctionSpace {
-  { Name Hcurl_ai_3D; Type Form1;
-    BasisFunction {
-      { Name sc; NameOfCoef ac; Function BF_Edge;
-		Support Dom_Hcurl_a; Entity EdgesOf[All]; }
-      { Name sw; NameOfCoef aw; Function BF_Edge;
-	  	Support Dom_Hthin_a; Entity EdgesOf[ Vol_nu, ConnectedTo lVol_C ]; }
-    }
-    SubSpace {
-      { Name ac ; NameOfBasisFunction { sc } ; }
-      { Name aw ; NameOfBasisFunction { sw } ; }
-    }
-    Constraint {
-      { NameOfCoef ac;
-		EntityType Auto; NameOfConstraint Hcurl_a_3D_ac; }
-	  { NameOfCoef ac; EntityType EdgesOfTreeIn ; EntitySubType StartingOn ;
-		NameOfConstraint GaugeCondition_a ; }
-	  { NameOfCoef aw; EntityType EdgesOfTreeIn ; EntitySubType StartingOn ;
-	  	NameOfConstraint GaugeCondition_a ; }
-    }
-  }
-}
-
-Formulation {
-  { Name Corrected; Type FemEquation;
-    If( Flag_Form == 1) // A-v formulation
-      // Conventional A-v formulation
-      // Works with FE discretized true wires of finite radius (Flag_Thin==0)
-      // and idealized thin wires (Flag_Thin!=0)
-      Quantity {
-        { Name a;  Type Local;  NameOfSpace Hcurl_a_3D; }
-
-        { Name v;  Type Local;  NameOfSpace Hgrad_u_3D; }
-        { Name U;  Type Global; NameOfSpace Hgrad_u_3D [U]; }
-        { Name I;  Type Global; NameOfSpace Hgrad_u_3D [I]; }
-      }
-
-      Equation {   
-        Integral { [ nu[] * Dof{d a} , {d a} ];
-          In Vol_nu; Jacobian Vol; Integration I1; }
-
-        Integral { DtDof[ sigma[] * Dof{a} , {a} ];
-          In Vol_C; Jacobian Vol; Integration I1; }
-        Integral { [ sigma[] * Dof{d v} , {a} ];
-          In Vol_C; Jacobian Vol; Integration I1; }
-        Integral { DtDof[ sigma[] * Dof{a} , {d v} ];
-          In Vol_C; Jacobian Vol; Integration I1; }      
-        Integral { [ sigma[] * Dof{d v} , {d v} ];
-          In Vol_C; Jacobian Vol; Integration I1; } 
-        //GlobalTerm { [Dof{I} , {U} ]; In CATHODES; }
-        
-        Integral { DtDof[ sigma[] * Dof{a} , {a} ];
-          In lVol_C; Jacobian Vol; Integration I1; }
-        Integral { [ sigma[] * Dof{d v} , {a} ];
-          In lVol_C; Jacobian Vol; Integration I1; }
-        Integral { DtDof[ sigma[] * Dof{a} , {d v} ];
-          In lVol_C; Jacobian Vol; Integration I1; }      
-        Integral { [ sigma[] * Dof{d v} , {d v} ];
-          In lVol_C; Jacobian Vol; Integration I1; }
-        
-        GlobalTerm { [Dof{I} , {U} ]; In CATHODES; }  
-      }
-    Else // A-I formulation    
-      Quantity {
-        { Name a;  Type Local;  NameOfSpace Hcurl_ai_3D; }
-        { Name ac; Type Local;  NameOfSpace Hcurl_ai_3D[ac]; }
-        { Name aw; Type Local;  NameOfSpace Hcurl_ai_3D[aw]; }
-
-        { Name i; Type Local;  NameOfSpace Hregion_i_3D; }
-        { Name Is;  Type Global; NameOfSpace Hregion_i_3D [Is]; }
-        { Name Us;  Type Global; NameOfSpace Hregion_i_3D [Us]; }
-      }
-      
-      Equation {
-        Integral { [ nu[] * Dof{d ac} , {d ac} ];
-          In Vol_nu; Jacobian Vol; Integration I1; }
-        Integral { [ nu[] * Dof{d aw} , {d aw} ];
-          In Vol_nu; Jacobian Vol; Integration I1; }
-  
-        If( 0 ) // impose current density
-          Integral { [ -J[], {ac} ];
-            In lVol_C; Jacobian Vol; Integration I1; }
-          Integral { [ -J[] , {aw} ];
-            In lVol_C; Jacobian Vol; Integration I1; }
-          Integral { [ -J[] , {a} ];
-            In Vol_C; Jacobian Vol; Integration I1; }
-
-          Else
-        
-          Integral { [ -Dof{i}/A_c , {ac} ];
-            In lVol_C; Jacobian Vol; Integration I1; }
-          Integral { [ -Dof{i}/A_c , {aw} ];
-            In lVol_C; Jacobian Vol; Integration I1; }
-
-          GlobalTerm { [ Dof{Us} , {Is} ]; In lVol_C; }
-          GlobalTerm { [ Analytic_R[] * Dof{Is} , {Is} ]; In lVol_C;}
-          Integral { DtDof [ Dof{ac}/A_c , {i} ];
-            In lVol_C; Jacobian Vol; Integration I1; }
-          If( Flag_Form != 2)
-            Integral { DtDof [ -Dof{aw}/A_c , {i} ];
-              In lVol_C; Jacobian Vol; Integration I1;}
-            GlobalTerm { DtDof [ Analytic_L[] * Dof{Is} , {Is} ]; 
-              In lVol_C;}
-          EndIf
-        EndIf
-      }
-    EndIf
-  }
-}
-
-*/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-// ################################
-
-/*
-
-NbPoints = 1000;
-Xmax = 0.15*box;
-PostOperation cut UsingPost PostProcessings {
-  // cut of by displayed in GUI
-  If( Flag_Thin == 0 )
-    Print [ by, OnLine { {-Xmax,0,0} {Xmax,0,0} }{NbPoints},
-			Format Gmsh, File "Cut_az.pos" ];
-    Echo[ StrCat["l=PostProcessing.NbViews-1;",
-				 "View[l].Name = 'cut |by|';",
-				 "View[l].Axes = 3;",
-				 "View[l].LineWidth = 3;",
-				 "View[l].Type = 2;"],
-	File "tmp.geo", LastTimeStepOnly];
-
-  Else
-
-	Print [ acz, OnLine { {-Xmax,0,0} {Xmax,0,0} }{NbPoints},
-			Format Gmsh, File "Cut_az.pos" ];
-    Echo[ StrCat["l=PostProcessing.NbViews-1;",
-				 "View[l].Name = 'cut az not corrected';",
-				 "View[l].Axes = 3;",
-				 "View[l].LineWidth = 3;",
-				 "View[l].Type = 2;"],
-		  File "tmp.geo", LastTimeStepOnly];
-
-    Print [ az, OnLine { {-Xmax,0,0} {Xmax,0,0} }{NbPoints},
-			Format Gmsh, File "Cut_az.pos" ];
-    Echo[ StrCat["l=PostProcessing.NbViews-1;",
-				 "View[l].Name = 'cut az corrected';",
-				 "View[l].Axes = 3;",
-				 "View[l].LineWidth = 3;",
-				 "View[l].Type = 2;"],
-	File "tmp.geo", LastTimeStepOnly];
-  EndIf
-
-  // cuts in txt format for Gnuplot
-  Print [ exact, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	  Format SimpleTable, File "Cut_analytic.txt" ];
-
-  If( Flag_Thin == 0 )
-    Print [ az, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	    Format SimpleTable, File "Cut_fullfem.txt" ];
-  Else
-    Print [ az, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	    Format SimpleTable, File "Cut_thinfem.txt" ];
-    Print [ acz, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	    Format SimpleTable, File "Cut_ac.txt" ];
-    Print [ awz, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	    Format SimpleTable, File "Cut_aw.txt" ];
-    Print [ acwz, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	    Format SimpleTable, File "Cut_acw.txt" ];
-    Print [ corr, OnLine { {0,0,0} {Xmax,0,0} } {NbPoints},
-	    Format SimpleTable, File "Cut_correction.txt" ];
-  EndIf
-}
-
-PostProcessing {
-  { Name PostProcessings; NameOfFormulation MagnetoDynamics;
-    PostQuantity {
-	  If( Flag_3D)
-        { Name a;
-		  Value { Local { [ {a}];
-			  In  Dom_Hcurl_a; Jacobian Vol; }}}
-	    // { Name ac;
-		//   Value { Local { [ {ac} ];
-		// 	  In  Dom_Hcurl_a; Jacobian Vol; }}}
-        // { Name aw;
-		//   Value { Local { [ {aw} ];
-		// 	  In Dom_Hthin_a; Jacobian Vol; }}}
-        { Name b;
-		  Value { Local { [ {d a}];
-			  In  Dom_Hcurl_a; Jacobian Vol; }}}
-		{ Name U;
-		  Value { Term { [ {U} ]; In CATHODES; }}}
-		{ Name L;
-		  Value { Term { [ Im[ {U}/{I}/omega ] ]; In CATHODES; }}}
-
-
-	 Else  ## 2D
-      { Name az;
-		Value { Local { [ CompZ[{ac}] - (Flag_Thin!=0)*(CompZ[{aw}]-Correction_A[])];
-			In  Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name acz;
-		Value { Local { [ CompZ[ {ac}] ];
-			In  Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name awz;
-		Value { Local { [ CompZ[ {aw}] ];
-			In Dom_Hthin_a; Jacobian Vol; }}}
-      { Name acwz;
-		Value { Local { [ CompZ[ {ac} - {aw} ] ];
-			In Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name exact;
-		Value { Local { [ Exact_A[] ] ;
-			In Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name corr;
-		Value { Local { [ Correction_A[] ] ;
-			In Dom_Hcurl_a; Jacobian Vol; }}}
-      { Name bcw;
-	   	Value { Local { [ {d ac} - {d aw} ];
-	   		In Dom_Hcurl_a; Jacobian Vol; }}}
-
-	  { Name j;
-		Value { Local { [ -sigma[] * ( Dt[{a}] + {dv} ) ]; 
-			In Vol_C; Jacobian Vol; }}}
-
-	  { Name un;
-		Value{ Local { [ 1 ] ;
-			In Vol_nu; Integration I1 ; Jacobian Vol; }}}  
-	  { Name surf;
-		Value{ Integral{ [ 1 ] ;
-			In Vol_nu; Integration I1 ; Jacobian Vol; }}}
-
-
-	  If( Flag_Thin == 0 )
-		{ Name flux;
-		  Value { Integral { [ CompZ[ {a} ] / A_c  ]; 
-			  In Vol_C; Integration I1 ; Jacobian Vol; }}}
-        { Name JouleLosses;
-		  Value { Integral { [ sigma[]*SquNorm[ Dt[{a}] + {dv} ] ] ;
-			  In Vol_C ; Integration I1 ; Jacobian Vol ; }}}
-		// { Name U;
-		//   Value { Term { [  Cart2Pol [ {U} ] ]; In Vol_C; }}}
-
-		{ Name U;
-		  Value { Term { [  Im [ {U}/omega ] ]; In Vol_C; }}}
-
-	  Else
-		{ Name flux; // naive flux
-		  Value { Integral { [ CompZ[ {ac} ] ]; 
-			  In lVol_C; Integration I1 ; Jacobian Vol; }}}
-
-	    { Name JouleLosses; 
-		  Value { Term { [ Analytic_R[]*{Is}*{Is} ] ; In lVol_C; }}}
-
-		// { Name U;
-		//   Value { Term { [ Cart2Pol [ {Us} ] ] ; In lVol_C; }}}
-
-		{ Name U;
-		  Value { Term { [ Im [ {Us}/omega ] ] ; In lVol_C; }}}
-
-	    For i In {1:NumWires}
-		  { Name area~{i};
-		    Value{ Integral{ [ 1 ] ;
-				In SWIRE~{i}; Integration I1 ; Jacobian Vol; }}}
-		  { Name intbx~{i}; // integral of b, 1st step for computing b average 
-			 Value { Integral { [ Norm [ CompX[ {d ac} - {d aw} ] ] ] ; 
-				 In SWIRE~{i}; Integration I1 ; Jacobian Vol; }}}
-		  { Name intby~{i}; // integral of b, 1st step for computing b average 
-			 Value { Integral { [ Norm [ CompY[ {d ac} - {d aw} ] ] ] ; 
-				 In SWIRE~{i}; Integration I1 ; Jacobian Vol; }}}
-	    EndFor
-		
-	  EndIf
-   EndIf
-    }
-  }
-}
-
-PostOperation map UsingPost PostProcessings {
-  Print [az, OnElementsOf Vol_nu, File "az.pos"];
-  Echo[ StrCat["l=PostProcessing.NbViews-1;",
-			   "View[l].IntervalsType = 3;",
-			   "View[l].NbIso = 30;",
-			   "View[l].RaiseZ = 15000;",
-			   "View[l].NormalRaise = 0;"],
-		File "tmp.geo", LastTimeStepOnly];
- 
-  If(Flag_Thin != 0)
-    Print [bcw, OnElementsOf Vol_Sleeve, File "b.pos"];
-
-    Print [acwz, OnElementsOf Vol_nu, File "acz.pos"];
-	Echo[ StrCat["l=PostProcessing.NbViews-1;",
-				 "View[l].IntervalsType = 3;",
-				 "View[l].NbIso = 30;",
-				 "View[l].RaiseZ = 15000;",
-				 "View[l].NormalRaise = 0;"],
-		   File "tmp.geo", LastTimeStepOnly] ;
-  EndIf
-}
-
-PostOperation integaz UsingPost PostProcessings {
-  For i In {1:NumWires}
-
-    If( Flag_Thin == 0 )
-	  Print[ U, OnRegion Vol_C, File > "U_full.dat", Format Table,
-			 SendToServer Sprintf["}Voltage/Wire %g/1Full",i]];
-	  Print[ JouleLosses[ VWIRE~{i}], OnGlobal,
-			 Format Table, File > "joule_full.dat", 
-	 		 SendToServer Sprintf["}Joule Losses/Wire %g/1Full",i]];
-    EndIf
-	If( Flag_Thin == 1 )
-	  Print[ U, OnRegion lVol_C, File > "U_raw.dat", Format Table,
-			 SendToServer Sprintf["}Voltage/Wire %g/2Raw",i]];
-	  Print[ JouleLosses, OnRegion LWIRE~{i},
-			Format Table, File > "joule_raw.dat", 
-			SendToServer Sprintf["}Joule Losses/Wire %g/2Raw",i]];
-    EndIf
-	If( Flag_Thin == 2 )
-	  Print[ U, OnRegion lVol_C, File > "U_reg.dat", Format Table,
-			 SendToServer Sprintf["}Voltage/Wire %g/3Reg",i]];
-  	  Print[ JouleLosses, OnRegion LWIRE~{i},
-			 Format Table, File > "joule_reg.dat", 
-			 SendToServer Sprintf["}Joule Losses/Wire %g/3Reg",i]];
-    EndIf
-	If( Flag_Thin == 3 )
-	  Print[ U, OnRegion lVol_C, File > "U_naive.dat", Format Table,
-			 SendToServer Sprintf["}Voltage/Wire %g/4Naive",i]];
-  	  Print[ JouleLosses, OnRegion LWIRE~{i},
-			 Format Table, File > "joule_naive.dat", 
-			 SendToServer Sprintf["}Joule Losses/Wire %g/4Naiv",i]];
-    EndIf
-
-	If( Flag_Thin != 0 )
-      Print[ area~{i}[SWIRE~{i}], OnGlobal,
-			 Format Table, File >"zzz",
-			 StoreInVariable $sarea~{i}];
-      Print[ intby~{i}[SWIRE~{i}], OnGlobal,
-	  		 Format Table, File > "zzz",
-	  		 StoreInVariable $intby~{i}];	  
-	EndIf
-
-  EndFor
-}
-
- 
-*/
-
-      /* 2D case
-    Quantity {
-      { Name a;  Type Local;  NameOfSpace Hcurl_a_2D; }
-      { Name ac; Type Local;  NameOfSpace Hcurl_a_2D[ac]; }
-      { Name aw; Type Local;  NameOfSpace Hcurl_a_2D[aw]; }
-
-      { Name dv;  Type Local;  NameOfSpace Hgrad_u_2D; }
-      { Name U;  Type Global; NameOfSpace Hgrad_u_2D [U]; }
-      { Name I;  Type Global; NameOfSpace Hgrad_u_2D [I]; }
-
-      { Name i; Type Local;  NameOfSpace Hregion_i_2D; }
-      { Name Is;  Type Global; NameOfSpace Hregion_i_2D [Is]; }
-      { Name Us;  Type Global; NameOfSpace Hregion_i_2D [Us]; }
-    }
-
-    Equation {
-
-      Integral { [ nu[] * Dof{d ac} , {d ac} ];
-        In Vol_nu; Jacobian Vol; Integration I1; }
-      Integral { [ -Dof{i}/A_c , {ac} ];
-        In lVol_C; Jacobian Vol; Integration I1; }
-
-      Integral { [ nu[] * Dof{d aw} , {d aw} ];
-        In Vol_nu; Jacobian Vol; Integration I1; }
-      Integral { [-Dof{i}/A_c , {aw} ];
-        In lVol_C; Jacobian Vol; Integration I1; }
-
-      
-      Integral { [ -J[] , {a} ];
-        In Vol_C; Jacobian Vol; Integration I1; }
-      
-      Integral { DtDof[ sigma[] * Dof{a} , {a} ];
-        In Vol_C; Jacobian Vol; Integration I1; }
-      Integral { [ sigma[] * Dof{dv} , {a} ];
-        In Vol_C; Jacobian Vol; Integration I1; }
-
-      Integral { DtDof[ sigma[] * Dof{a} , {dv} ];
-        In Vol_C; Jacobian Vol; Integration I1; }      
-      Integral { [ sigma[] * Dof{dv} , {dv} ];
-        In Vol_C; Jacobian Vol; Integration I1; }   
-      GlobalTerm { [ Dof{I} , {U} ]; In Vol_C; }
-
-      GlobalTerm { [ Dof{Us} , {Is} ]; 
-		In lVol_C; }
-	  GlobalTerm { [ Analytic_R[] * Dof{Is} , {Is} ]; 
-	  	In lVol_C;}
-      Integral { DtDof [ Dof{ac}/A_c , {i} ];
-        In lVol_C; Jacobian Vol; Integration I1; }
-      If( Flag_Thin != 3)
-        Integral { DtDof [ -Dof{aw}/A_c , {i} ];
-		  In lVol_C; Jacobian Vol; Integration I1;}
-	    GlobalTerm { DtDof [ Analytic_L[] * Dof{Is} , {Is} ]; 
-	  	  In lVol_C;}
-      EndIf
-    }
-    */
 
-- 
GitLab