Commit 9f774414 by Christophe Geuzaine

unify naming

parent 1ea80e5d
Pipeline #1501 passed with stage
in 9 minutes 27 seconds
/*
To solve the problem
with scalar potential, type 'getdp test -solve MagSta_phi -pos phi'
with vector potential, type 'getdp test -solve MagSta_a -pos a'
with scalar potential, type 'getdp test -solve Magnetostatics_phi -pos phi'
with vector potential, type 'getdp test -solve Magnetostatics_a -pos a'
*/
Include "magnet_data.pro";
......@@ -26,7 +26,7 @@ Group {
];
// These are the generic group names that are used in the
// "Lib_MagSta_a_phi.pro" template included below
// "Lib_Magnatostatics_a_phi.pro" template included below
Vol_Mag = Region[ {Air, AirInf, Core, AirGap, Magnet} ] ;
If(Flag_NL)
Vol_NL_Mag = Region[ {Core} ] ;
......@@ -73,12 +73,12 @@ Constraint {
}
modelPath = CurrentDirectory;
Include "../templates/Lib_MagSta_a_phi.pro"
Include "../templates/Lib_Magnetostatics_a_phi.pro"
eps = 1.e-5;
PostOperation {
{ Name phi ; NameOfPostProcessing MagSta_phi;
{ Name phi ; NameOfPostProcessing Magnetostatics_phi;
Operation {
Print[ phi, OnElementsOf Vol_Mag, File "phi.pos" ] ;
Print[ hc, OnElementsOf Vol_Mag, File "hc.pos" ] ;
......@@ -86,7 +86,7 @@ PostOperation {
Print[ b, OnLine {{-0.07,eps,0}{0.09,eps,0}} {500}, File "b_phi.txt", Format Table ] ;
}
}
{ Name a ; NameOfPostProcessing MagSta_a;
{ Name a ; NameOfPostProcessing Magnetostatics_a;
Operation {
Print[ az, OnElementsOf Vol_Mag, File "az.pos"] ;
Print[ b, OnElementsOf Vol_Mag, File "b_a.pos" ] ;
......
......@@ -10,10 +10,10 @@
// How does it work?
//
// This file interactively proposes choices for all the constants, functions,
// groups and constraints needed by the "Lib_EleSta_v.pro" template. In addition,
// everytime "Run" is pressed a ".pro" file is created (with the same prefix as
// the geometry file) with all the choices made interactively, for later non-
// interactive use.
// groups and constraints needed by the "Lib_Electrostatics_v.pro" template. In
// addition, everytime "Run" is pressed a ".pro" file is created (with the same
// prefix as the geometry file) with all the choices made interactively, for
// later non- interactive use.
DefineConstant[
formulationType = {0, Choices{0="Scalar potential"},
......@@ -30,9 +30,9 @@ DefineConstant[
modelName = GetString["Gmsh/Model name"],
export = !StrCmp[OnelabAction, "compute"],
exportFile = StrCat[modelPath, StrPrefix[StrRelative[modelName]], ".pro"],
R_ = {"EleSta_v", Name "GetDP/1ResolutionChoices", Visible 0},
R_ = {"Electrostatics_v", Name "GetDP/1ResolutionChoices", Visible 0},
C_ = {"-solve -pos -bin", Name "GetDP/9ComputeCommand", Visible 0},
P_ = {"EleSta_v", Name "GetDP/2PostOperationChoices", Visible 0}
P_ = {"Electrostatics_v", Name "GetDP/2PostOperationChoices", Visible 0}
];
numPhysicals = GetNumber["Gmsh/Number of physical groups"];
......@@ -123,7 +123,8 @@ EndIf
// import material library
Include "Lib_Materials.pro";
If(export)
Printf(StrCat['Include "', CurrentDirectory, 'Lib_Materials.pro";']) >> Str[exportFile];
Printf(StrCat['Include "', CurrentDirectory, 'Lib_Materials.pro";'])
>> Str[exportFile];
EndIf
// interactive definition of materials and sources
......@@ -219,7 +220,8 @@ For j In {0:#constraintNames()-1}
EndFor
// import electrostatic template
Include "Lib_EleSta_v.pro";
Include "Lib_Electrostatics_v.pro";
If(export)
Printf(StrCat['Include "', CurrentDirectory, 'Lib_EleSta_v.pro";']) >> Str[exportFile];
Printf(StrCat['Include "', CurrentDirectory, 'Lib_Electrostatics_v.pro";'])
>> Str[exportFile];
EndIf
......@@ -10,10 +10,10 @@
// How does it work?
//
// This file interactively proposes choices for all the constants, functions,
// groups and constraints needed by the "Lib_MagSta_a_phi.pro" template. In
// addition, everytime "Run" is pressed a ".pro" file is created (with the same
// prefix as the geometry file) with all the choices made interactively, for
// later non-interactive use.
// groups and constraints needed by the "Lib_Magnetostatics_a_phi.pro"
// template. In addition, everytime "Run" is pressed a ".pro" file is created
// (with the same prefix as the geometry file) with all the choices made
// interactively, for later non-interactive use.
DefineConstant[
formulationType = {1, Choices{0="Scalar potential", 1="Vector potential"},
......@@ -311,9 +311,9 @@ For j In {0:#constraintNames()-1}
EndFor
// import magnetostatics template
Include "Lib_MagSta_a_phi.pro";
Include "Lib_Magnetostatics_a_phi.pro";
If(export)
Printf(StrCat['Include "', CurrentDirectory, 'Lib_MagSta_a_phi.pro";'])
Printf(StrCat['Include "', CurrentDirectory, 'Lib_Magnetostatics_a_phi.pro";'])
>> Str[exportFile];
EndIf
......@@ -321,9 +321,9 @@ Resolution{
{ Name Analysis;
System {
If(formulationType == 0)
{ Name A; NameOfFormulation MagSta_phi; }
{ Name A; NameOfFormulation Magnetostatics_phi; }
Else
{ Name A; NameOfFormulation MagSta_a; }
{ Name A; NameOfFormulation Magnetostatics_a; }
EndIf
}
Operation {
......@@ -344,9 +344,9 @@ Resolution{
EndIf
SaveSolution[A];
If(formulationType == 0)
PostOperation[MagSta_phi];
PostOperation[Magnetostatics_phi];
Else
PostOperation[MagSta_a];
PostOperation[Magnetostatics_a];
EndIf
}
}
......
// Lib_EleSta_v.pro
// Lib_Electrostatics_v.pro
//
// Template library for electrostatics using a scalar electric potential (v)
// formulation, with floating potentials.
......@@ -145,18 +145,18 @@ Formulation {
}
Resolution {
{ Name EleSta_v;
{ Name Electrostatics_v;
System {
{ Name Sys_Ele; NameOfFormulation Electrostatics_vf; }
{ Name A; NameOfFormulation Electrostatics_vf; }
}
Operation {
Generate[Sys_Ele]; Solve[Sys_Ele]; SaveSolution[Sys_Ele];
Generate[A]; Solve[A]; SaveSolution[A];
}
}
}
PostProcessing {
{ Name EleSta_v; NameOfFormulation Electrostatics_vf;
{ Name Electrostatics_v; NameOfFormulation Electrostatics_vf;
PostQuantity {
{ Name v; Value {
Term { [ {v} ]; In Vol_Ele; Jacobian Vol; }
......@@ -205,15 +205,15 @@ PostProcessing {
}
PostOperation {
{ Name EleSta_v; NameOfPostProcessing EleSta_v;
{ Name Electrostatics_v; NameOfPostProcessing Electrostatics_v;
Operation {
CreateDir[resPath];
Print[ e, OnElementsOf Vol_Ele, File StrCat[resPath, "EleSta_v_e.pos"] ];
Print[ v, OnElementsOf Vol_Ele, File StrCat[resPath, "EleSta_v_v.pos"] ];
Print[ e, OnElementsOf Vol_Ele, File StrCat[resPath, "e.pos"] ];
Print[ v, OnElementsOf Vol_Ele, File StrCat[resPath, "v.pos"] ];
If(NbrRegions[Sur_C_Ele])
Print[ Q, OnRegion Sur_C_Ele, File StrCat[resPath, "EleSta_v_q.txt"],
Print[ Q, OnRegion Sur_C_Ele, File StrCat[resPath, "q.txt"],
Format Table, SendToServer "}Output/Floating charge [C]" ];
Print[ V, OnRegion Sur_C_Ele, File StrCat[resPath, "EleSta_v_q.txt"],
Print[ V, OnRegion Sur_C_Ele, File StrCat[resPath, "q.txt"],
Format Table, SendToServer "}Output/Floating potential [V]" ];
EndIf
}
......
// Lib_MagDyn_av_2D_Cir.pro
// Lib_Magnetodynamics2D_av_Cir.pro
//
// Template library for 2D magnetostatic and magnetodynamic problems in terms
// of the magnetic vector potential a (potentially coupled with the electric
......@@ -248,7 +248,7 @@ EndIf
// Static Formulation
Formulation {
{ Name MagSta_a_2D; Type FemEquation;
{ Name Magnetostatics2D_a; Type FemEquation;
Quantity {
{ Name a; Type Local; NameOfSpace Hcurl_a_2D; }
{ Name ir; Type Local; NameOfSpace Hregion_i_2D; }
......@@ -286,7 +286,7 @@ Formulation {
// Dynamic Formulation (eddy currents)
Formulation {
{ Name MagDyn_a_2D; Type FemEquation;
{ Name Magnetodynamics2D_av; Type FemEquation;
Quantity {
{ Name a; Type Local; NameOfSpace Hcurl_a_2D; }
{ Name A_floating; Type Global; NameOfSpace Hcurl_a_2D [A]; }
......@@ -399,9 +399,9 @@ Formulation {
}
Resolution {
{ Name MagDyn_a_2D;
{ Name Magnetodynamics2D_av;
System {
{ Name Sys; NameOfFormulation MagDyn_a_2D;
{ Name A; NameOfFormulation Magnetodynamics2D_av;
If(Flag_FrequencyDomain)
Type ComplexValue; Frequency Freq;
EndIf
......@@ -409,51 +409,51 @@ Resolution {
}
Operation {
If(Flag_FrequencyDomain)
Generate[Sys]; Solve[Sys]; SaveSolution[Sys];
Generate[A]; Solve[A]; SaveSolution[A];
Else
InitSolution[Sys]; // provide initial condition
InitSolution[A]; // provide initial condition
TimeLoopTheta[TimeInit, TimeFinal, DeltaTime, 1.]{
// Euler implicit (1) -- Crank-Nicolson (0.5)
Generate[Sys]; Solve[Sys];
Generate[A]; Solve[A];
If(NbrRegions[Vol_NL_Mag])
Generate[Sys]; GetResidual[Sys, $res0];
Generate[A]; GetResidual[A, $res0];
Evaluate[ $res = $res0, $iter = 0 ];
Print[{$iter, $res, $res / $res0},
Format "Residual %03g: abs %14.12e rel %14.12e"];
While[$res > NL_tol_abs && $res / $res0 > NL_tol_rel &&
$res / $res0 <= 1 && $iter < NL_iter_max]{
Solve[Sys]; Generate[Sys]; GetResidual[Sys, $res];
Solve[A]; Generate[A]; GetResidual[A, $res];
Evaluate[ $iter = $iter + 1 ];
Print[{$iter, $res, $res / $res0},
Format "Residual %03g: abs %14.12e rel %14.12e"];
}
EndIf
SaveSolution[Sys];
SaveSolution[A];
}
EndIf
}
}
{ Name MagSta_a_2D;
{ Name Magnetostatics2D_a;
System {
{ Name Sys; NameOfFormulation MagSta_a_2D; }
{ Name A; NameOfFormulation Magnetostatics2D_a; }
}
Operation {
InitSolution[Sys];
Generate[Sys]; Solve[Sys];
InitSolution[A];
Generate[A]; Solve[A];
If(NbrRegions[Vol_NL_Mag])
Generate[Sys]; GetResidual[Sys, $res0];
Generate[A]; GetResidual[A, $res0];
Evaluate[ $res = $res0, $iter = 0 ];
Print[{$iter, $res, $res / $res0},
Format "Residual %03g: abs %14.12e rel %14.12e"];
While[$res > NL_tol_abs && $res / $res0 > NL_tol_rel &&
$res / $res0 <= 1 && $iter < NL_iter_max]{
Solve[Sys]; Generate[Sys]; GetResidual[Sys, $res];
Solve[A]; Generate[A]; GetResidual[A, $res];
Evaluate[ $iter = $iter + 1 ];
Print[{$iter, $res, $res / $res0},
Format "Residual %03g: abs %14.12e rel %14.12e"];
}
EndIf
SaveSolution[Sys];
SaveSolution[A];
}
}
}
......@@ -461,7 +461,7 @@ Resolution {
// Same PostProcessing for both static and dynamic formulations (both refer to
// the same FunctionSpace from which the solution is obtained)
PostProcessing {
{ Name MagDyn_a_2D; NameOfFormulation MagDyn_a_2D;
{ Name Magnetodynamics2D_av; NameOfFormulation Magnetodynamics2D_av;
PostQuantity {
// In 2D, a is a vector with only a z-component: (0,0,az)
{ Name a; Value {
......@@ -532,7 +532,7 @@ PostProcessing {
}
}
{ Name MagSta_a_2D; NameOfFormulation MagSta_a_2D;
{ Name Magnetostatics2D_a; NameOfFormulation Magnetostatics2D_a;
PostQuantity {
{ Name a; Value {
Term { [ {a} ]; In Vol_Mag; Jacobian Vol; }
......
// Lib_MagSta_a_phi.pro
// Lib_Magnetostatics_a_phi.pro
//
// Template library for magnetostatics using a scalar (phi) or a vector (a)
// potential formulation.
......@@ -149,7 +149,7 @@ FunctionSpace {
}
Formulation {
{ Name MagSta_phi; Type FemEquation;
{ Name Magnetostatics_phi; Type FemEquation;
Quantity {
{ Name phi; Type Local; NameOfSpace Hgrad_phi; }
}
......@@ -176,7 +176,7 @@ Formulation {
In Sur_Neu_Mag; Jacobian Sur; Integration Int; }
}
}
{ Name MagSta_a; Type FemEquation;
{ Name Magnetostatics_a; Type FemEquation;
Quantity {
{ Name a; Type Local; NameOfSpace Hcurl_a; }
}
......@@ -209,9 +209,9 @@ Formulation {
}
Resolution {
{ Name MagSta_phi;
{ Name Magnetostatics_phi;
System {
{ Name A; NameOfFormulation MagSta_phi; }
{ Name A; NameOfFormulation Magnetostatics_phi; }
}
Operation {
InitSolution[A];
......@@ -232,9 +232,9 @@ Resolution {
SaveSolution[A];
}
}
{ Name MagSta_a;
{ Name Magnetostatics_a;
System {
{ Name A; NameOfFormulation MagSta_a; }
{ Name A; NameOfFormulation Magnetostatics_a; }
}
Operation {
InitSolution[A];
......@@ -258,7 +258,7 @@ Resolution {
}
PostProcessing {
{ Name MagSta_phi; NameOfFormulation MagSta_phi;
{ Name Magnetostatics_phi; NameOfFormulation Magnetostatics_phi;
Quantity {
{ Name b; Value {
Term { [ - mu[-{d phi}] * {d phi} ]; In Vol_Mag; Jacobian Vol; }
......@@ -279,7 +279,7 @@ PostProcessing {
}
}
}
{ Name MagSta_a; NameOfFormulation MagSta_a;
{ Name Magnetostatics_a; NameOfFormulation Magnetostatics_a;
Quantity {
{ Name az; Value {
Local { [ CompZ[{a}] ]; In Vol_Mag; Jacobian Vol; }
......@@ -311,31 +311,31 @@ PostProcessing {
}
PostOperation {
{ Name MagSta_phi; NameOfPostProcessing MagSta_phi;
{ Name Magnetostatics_phi; NameOfPostProcessing Magnetostatics_phi;
Operation {
CreateDir[resPath];
If(NbrRegions[Vol_M_Mag])
Print[ hc, OnElementsOf Vol_M_Mag, File StrCat[resPath, "MagSta_phi_hc.pos"] ];
Print[ hc, OnElementsOf Vol_M_Mag, File StrCat[resPath, "hc.pos"] ];
EndIf
Print[ phi, OnElementsOf Vol_Mag, File StrCat[resPath, "MagSta_phi_phi.pos"] ];
Print[ h, OnElementsOf Vol_Mag, File StrCat[resPath, "MagSta_phi_h.pos"] ];
Print[ b, OnElementsOf Vol_Mag, File StrCat[resPath, "MagSta_phi_b.pos"] ];
Print[ phi, OnElementsOf Vol_Mag, File StrCat[resPath, "phi.pos"] ];
Print[ h, OnElementsOf Vol_Mag, File StrCat[resPath, "h.pos"] ];
Print[ b, OnElementsOf Vol_Mag, File StrCat[resPath, "b.pos"] ];
}
}
{ Name MagSta_a; NameOfPostProcessing MagSta_a;
{ Name Magnetostatics_a; NameOfPostProcessing Magnetostatics_a;
Operation {
CreateDir[resPath];
If(NbrRegions[Vol_M_Mag])
Print[ hc, OnElementsOf Vol_M_Mag, File StrCat[resPath, "MagSta_a_hc.pos"] ];
Print[ hc, OnElementsOf Vol_M_Mag, File StrCat[resPath, "hc.pos"] ];
EndIf
If(NbrRegions[Vol_S0_Mag])
Print[ js, OnElementsOf Vol_S0_Mag, File StrCat[resPath, "MagSta_a_js.pos"] ];
Print[ js, OnElementsOf Vol_S0_Mag, File StrCat[resPath, "js.pos"] ];
EndIf
If(modelDim == 2)
Print[ az, OnElementsOf Vol_Mag, File StrCat[resPath, "MagSta_a_az.pos"] ];
Print[ az, OnElementsOf Vol_Mag, File StrCat[resPath, "az.pos"] ];
EndIf
Print[ h, OnElementsOf Vol_Mag, File StrCat[resPath, "MagSta_a_h.pos"] ];
Print[ b, OnElementsOf Vol_Mag, File StrCat[resPath, "MagSta_a_b.pos"] ];
Print[ h, OnElementsOf Vol_Mag, File StrCat[resPath, "h.pos"] ];
Print[ b, OnElementsOf Vol_Mag, File StrCat[resPath, "b.pos"] ];
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment