Commit 11c3f5b7 authored by Christophe Geuzaine's avatar Christophe Geuzaine

better interactive: Lib_* files are now completely clean of any interactive definition

parent 15a18b43
Pipeline #1450 passed with stage
in 11 minutes and 27 seconds
// This script allows to use Lib_EleSta_v.pro to setup an electrostatic model
// interactively:
//
// 1) Create a geometry with Gmsh
// 2) Merge this file with File->Merge
// 3) You will be prompted to setup your materials and boundary conditions for
// each physical group, interactively
// 4) Everytime you click on "Run", an "export.pro" file will be created,
// which will contain all your choices for later non-interactive use
interactive = !NbrRegions[]; // interactive mode if no region currently defined
export = !StrCmp[OnelabAction, "compute"]; // dump export file on each "Run"
modelDim = GetNumber["Gmsh/Model dimension"]; // 1D, 2D or 3D geometry
numPhysicals = GetNumber["Gmsh/Number of physical groups"];
modelPath = GetString["Gmsh/Model absolute path"];
exportFile = StrCat[modelPath, "export.pro"];
// this macro will be called in Lib_EleSta_v.pro if we are in interactive mode
Macro Lib_EleSta_v_interactive
// interactive construction of groups
Group {
If(export)
Printf('Group{') > Str[exportFile];
EndIf
For i In {1:numPhysicals}
dim~{i} = GetNumber[Sprintf["Gmsh/Physical group %g/Dimension", i]];
name~{i} = GetString[Sprintf["Gmsh/Physical group %g/Name", i]];
tag~{i} = GetNumber[Sprintf["Gmsh/Physical group %g/Number", i]];
reg = Sprintf["Region[%g]; ", tag~{i}]; str = "";
If(dim~{i} < modelDim)
DefineConstant[
bc~{i} = {0, Choices{
0="Neumann: fixed n . d",
1="Dirichlet: fixed v",
2="Floating conductor: fixed q",
3="Floating conductor: fixed v"
},
Name StrCat["Parameters/Boundary conditions/", name~{i}, "/0Type"]}
];
If(bc~{i} == 0)
str = StrCat["Sur_Neu_Ele += ", reg];
ElseIf(bc~{i} == 2 || bc~{i} == 3)
str = StrCat["Sur_C_Ele += ", reg];
EndIf
Else
DefineConstant[
material~{i} = {1, Choices{
0="Charged dielectric",
1="Linear dielectric material",
2="Infinite air shell"
},
Name StrCat["Parameters/Materials/", name~{i}, "/0Type"]}
];
If(material~{i} == 0)
str = StrCat["Vol_Q_Ele += ", reg, "Vol_Ele += ", reg];
ElseIf(material~{i} == 1)
str = StrCat["Vol_Ele += ", reg];
ElseIf(material~{i} == 2)
str = StrCat["Vol_Inf_Ele += ", reg];
EndIf
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
EndFor
If(export)
Printf('}') >> Str[exportFile];
EndIf
}
// interactive setting of material properties
Include "Lib_Materials.pro";
If(export)
Printf('Include "Lib_Materials.pro";') >> Str[exportFile];
EndIf
Function {
If(export)
Printf('Function {') >> Str[exportFile];
EndIf
For i In {1:numPhysicals}
If(dim~{i} < modelDim)
DefineConstant[
bc_val~{i} = {0.,
Name StrCat["Parameters/Boundary conditions/", name~{i}, "/1Value"]}
];
reg = Sprintf["[Region[%g]]", tag~{i}]; str = "";
If(bc~{i} == 0)
str = StrCat["dn", reg, Sprintf[" = %g; ", bc_val~{i}]];
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
Else
DefineConstant[
rho_preset~{i} = {0, Visible (material~{i} == 0),
Choices{ 0="Constant", 1="Function" },
Name StrCat["Parameters/Materials/", name~{i}, "/1rho preset"],
Label "Choice"},
rho~{i} = {1, Visible (material~{i} == 0 && rho_preset~{i} == 0),
Name StrCat["Parameters/Materials/", name~{i}, "/rho value"],
Label "ρ [C/m³]", Help "Charge density"},
rho_fct~{i} = {"1", Visible (material~{i} == 0 && rho_preset~{i} == 1),
Name StrCat["Parameters/Materials/", name~{i}, "/rho function"],
Label "ρ [C/m³]", Help "Charge density"},
epsr_preset~{i} = {#linearDielectricMaterials() > 2 ? 2 : 0,
Visible (material~{i} == 1),
Choices{ 0:#linearDielectricMaterials()-1 = linearDielectricMaterials() },
Name StrCat["Parameters/Materials/", name~{i}, "/1epsr preset"],
Label "Choice"}
epsr~{i} = {1, Visible (material~{i} == 0 && rho_preset~{i} == 0) ||
(material~{i} == 1 && epsr_preset~{i} == 0),
Name StrCat["Parameters/Materials/", name~{i}, "/epsr value"],
Label "ε_r", Help "Relative dielectric permittivity"},
epsr_fct~{i} = {"1", Visible (material~{i} == 0 && rho_preset~{i} == 1) ||
(material~{i} == 1 && epsr_preset~{i} == 1),
Name StrCat["Parameters/Materials/", name~{i}, "/epsr function"],
Label "ε_r", Help "Relative dielectric permittivity"}
];
reg = Sprintf["[Region[%g]]", tag~{i}]; str = "";
If(material~{i} == 0 && rho_preset~{i} == 0) // charged, constant
str = StrCat["rho", reg, Sprintf[" = %g; ", rho~{i}], "epsr", reg,
Sprintf[" = %g; ", epsr~{i}]];
ElseIf(material~{i} == 0 && rho_preset~{i} == 1) // charged, function
str = StrCat["rho", reg, " = ", rho_fct~{i}, ";", "epsr", reg, " = ",
epsr_fct~{i}, "; "];
ElseIf(material~{i} == 1 && epsr_preset~{i} == 0) // linear, constant
str = StrCat["epsr", reg, Sprintf[" = %g; ", epsr~{i}]];
ElseIf(material~{i} == 1 && epsr_preset~{i} == 1) // linear, function
str = StrCat["epsr", reg, " = ", epsr_fct~{i}, "; "];
ElseIf(material~{i} == 1 && epsr_preset~{i} > 1) // linear, preset
str = StrCat["epsr", reg, " = ", linearDielectricMaterials(epsr_preset~{i}),
"_epsilonr;"];
ElseIf(material~{i} == 2) // infinite air region
str = StrCat["epsr", reg, " = 1; "];
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
EndIf
EndFor
If(export)
Printf('}') >> Str[exportFile];
EndIf
}
// interactive setting of constraints
constraintNames() = Str[
"ElectricScalarPotential",
"GlobalElectricPotential",
"GlobalElectricCharge"
];
constraintNum() = {1, 3, 2};
For j In {0:#constraintNames()-1}
str = StrCat["Constraint { { Name ", constraintNames(j), "; Case { "];
For i In {1:numPhysicals}
If(dim~{i} < modelDim)
If(bc~{i} == constraintNum(j))
str = StrCat[str, Sprintf["{ Region Region[%g]; Value %g; } ",
tag~{i}, bc_val~{i}]];
EndIf
EndIf
EndFor
str = StrCat[str, "} } }"];
Parse[str];
If(export)
Printf(Str[str]) >> Str[exportFile];
EndIf
EndFor
If(export)
Printf('Include "Lib_EleSta_v.pro";') >> Str[exportFile];
EndIf
Return
Include "Lib_EleSta_v.pro";
DefineConstant[
formulationType = {0, Choices{0="Scalar potential"},
Help Str[
"Electrostatic model definitions",
"e: electric field [V/m]",
"d: electric flux density [C/m²]",
"v: scalar electric potential (e = -grad v) [V]",
"rho: charge density [C/m³]",
"q: charge [C]"],
Name "GetDP/Formulation"},
R_ = {"EleSta_v", Name "GetDP/1ResolutionChoices", Visible 0},
C_ = {"-solve -pos -v2", Name "GetDP/9ComputeCommand", Visible 0},
P_ = {"EleSta_v", Name "GetDP/2PostOperationChoices", Visible 0}
];
// This script allows to use Lib_EleSta_v.pro to setup an electrostatic model
// interactively:
//
// 1) Create a geometry with Gmsh
// 2) Merge this file with File->Merge
// 3) You will be prompted to setup your materials and boundary conditions for
// each physical group, interactively
// 4) Everytime you click on "Run", an "export.pro" file will be created,
// which will contain all your choices for later non-interactive use
DefineConstant[
formulationType = {0, Choices{0="Scalar potential"},
Help Str[
"Electrostatic model definitions",
"e: electric field [V/m]",
"d: electric flux density [C/m²]",
"v: scalar electric potential (e = -grad v) [V]",
"rho: charge density [C/m³]",
"q: charge [C]"],
Name "GetDP/Formulation"},
export = !StrCmp[OnelabAction, "compute"],
modelDim = GetNumber["Gmsh/Model dimension"],
numPhysicals = GetNumber["Gmsh/Number of physical groups"],
modelPath = GetString["Gmsh/Model absolute path"],
exportFile = StrCat[modelPath, "export.pro"],
R_ = {"EleSta_v", Name "GetDP/1ResolutionChoices", Visible 0},
C_ = {"-solve -pos -bin", Name "GetDP/9ComputeCommand", Visible 0},
P_ = {"EleSta_v", Name "GetDP/2PostOperationChoices", Visible 0}
];
// interactive definition of groups
Group {
If(export)
Printf('Group{') > Str[exportFile];
EndIf
DefineGroup[ Vol_Inf_Ele ];
For i In {1:numPhysicals}
dim~{i} = GetNumber[Sprintf["Gmsh/Physical group %g/Dimension", i]];
name~{i} = GetString[Sprintf["Gmsh/Physical group %g/Name", i]];
tag~{i} = GetNumber[Sprintf["Gmsh/Physical group %g/Number", i]];
reg = Sprintf["Region[%g]; ", tag~{i}]; str = "";
If(dim~{i} < modelDim)
DefineConstant[
bc~{i} = {0, Choices{
0="Neumann: fixed n . d",
1="Dirichlet: fixed v",
2="Floating conductor: fixed q",
3="Floating conductor: fixed v"
},
Name StrCat["Parameters/Boundary conditions/", name~{i}, "/0Type"]}
];
If(bc~{i} == 0)
str = StrCat["Sur_Neu_Ele += ", reg];
ElseIf(bc~{i} == 2 || bc~{i} == 3)
str = StrCat["Sur_C_Ele += ", reg];
EndIf
Else
DefineConstant[
material~{i} = {1, Choices{
0="Charged dielectric",
1="Linear dielectric material",
2="Infinite air shell"
},
Name StrCat["Parameters/Materials/", name~{i}, "/0Type"]}
];
If(material~{i} == 0)
str = StrCat["Vol_Q_Ele += ", reg, "Vol_Ele += ", reg];
ElseIf(material~{i} == 1)
str = StrCat["Vol_Ele += ", reg];
ElseIf(material~{i} == 2)
str = StrCat["Vol_Inf_Ele += ", reg];
EndIf
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
EndFor
If(export)
Printf('}') >> Str[exportFile];
EndIf
}
DefineConstant[
Val_Rint = {1, Visible NbrRegions[Vol_Inf_Ele],
Name "Parameters/Geometry/1Internal shell radius"},
Val_Rext = {2, Visible NbrRegions[Vol_Inf_Ele],
Name "Parameters/Geometry/2External shell radius"}
];
If(export && NbrRegions[Vol_Inf_Ele])
Printf(Sprintf("Val_Rint = %g;", Val_Rint)) >> Str[exportFile];
Printf(Sprintf("Val_Rext = %g;", Val_Rext)) >> Str[exportFile];
EndIf
// interactive definition of material properties
Include "Lib_Materials.pro";
If(export)
Printf('Include "Lib_Materials.pro";') >> Str[exportFile];
EndIf
Function {
If(export)
Printf('Function {') >> Str[exportFile];
EndIf
For i In {1:numPhysicals}
If(dim~{i} < modelDim)
DefineConstant[
bc_val~{i} = {0.,
Name StrCat["Parameters/Boundary conditions/", name~{i}, "/1Value"]}
];
reg = Sprintf["[Region[%g]]", tag~{i}]; str = "";
If(bc~{i} == 0)
str = StrCat["dn", reg, Sprintf[" = %g; ", bc_val~{i}]];
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
Else
DefineConstant[
rho_preset~{i} = {0, Visible (material~{i} == 0),
Choices{ 0="Constant", 1="Function" },
Name StrCat["Parameters/Materials/", name~{i}, "/1rho preset"],
Label "Choice"},
rho~{i} = {1, Visible (material~{i} == 0 && rho_preset~{i} == 0),
Name StrCat["Parameters/Materials/", name~{i}, "/rho value"],
Label "ρ [C/m³]", Help "Charge density"},
rho_fct~{i} = {"1", Visible (material~{i} == 0 && rho_preset~{i} == 1),
Name StrCat["Parameters/Materials/", name~{i}, "/rho function"],
Label "ρ [C/m³]", Help "Charge density"},
epsr_preset~{i} = {#linearDielectricMaterials() > 2 ? 2 : 0,
Visible (material~{i} == 1),
Choices{ 0:#linearDielectricMaterials()-1 = linearDielectricMaterials() },
Name StrCat["Parameters/Materials/", name~{i}, "/1epsr preset"],
Label "Choice"}
epsr~{i} = {1, Visible (material~{i} == 0 && rho_preset~{i} == 0) ||
(material~{i} == 1 && epsr_preset~{i} == 0),
Name StrCat["Parameters/Materials/", name~{i}, "/epsr value"],
Label "ε_r", Help "Relative dielectric permittivity"},
epsr_fct~{i} = {"1", Visible (material~{i} == 0 && rho_preset~{i} == 1) ||
(material~{i} == 1 && epsr_preset~{i} == 1),
Name StrCat["Parameters/Materials/", name~{i}, "/epsr function"],
Label "ε_r", Help "Relative dielectric permittivity"}
];
reg = Sprintf["[Region[%g]]", tag~{i}]; str = "";
If(material~{i} == 0 && rho_preset~{i} == 0) // charged, constant
str = StrCat["rho", reg, Sprintf[" = %g; ", rho~{i}], "epsr", reg,
Sprintf[" = %g; ", epsr~{i}]];
ElseIf(material~{i} == 0 && rho_preset~{i} == 1) // charged, function
str = StrCat["rho", reg, " = ", rho_fct~{i}, ";", "epsr", reg, " = ",
epsr_fct~{i}, "; "];
ElseIf(material~{i} == 1 && epsr_preset~{i} == 0) // linear, constant
str = StrCat["epsr", reg, Sprintf[" = %g; ", epsr~{i}]];
ElseIf(material~{i} == 1 && epsr_preset~{i} == 1) // linear, function
str = StrCat["epsr", reg, " = ", epsr_fct~{i}, "; "];
ElseIf(material~{i} == 1 && epsr_preset~{i} > 1) // linear, preset
str = StrCat["epsr", reg, " = ", linearDielectricMaterials(epsr_preset~{i}),
"_epsilonr;"];
ElseIf(material~{i} == 2) // infinite air region
str = StrCat["epsr", reg, " = 1; "];
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
EndIf
EndFor
If(export)
Printf('}') >> Str[exportFile];
EndIf
}
// interactive definition of constraints
constraintNames() = Str[
"ElectricScalarPotential",
"GlobalElectricPotential",
"GlobalElectricCharge"
];
constraintNum() = {1, 3, 2};
For j In {0:#constraintNames()-1}
str = StrCat["Constraint { { Name ", constraintNames(j), "; Case { "];
For i In {1:numPhysicals}
If(dim~{i} < modelDim)
If(bc~{i} == constraintNum(j))
str = StrCat[str, Sprintf["{ Region Region[%g]; Value %g; } ",
tag~{i}, bc_val~{i}]];
EndIf
EndIf
EndFor
str = StrCat[str, "} } }"];
Parse[str];
If(export)
Printf(Str[str]) >> Str[exportFile];
EndIf
EndFor
Include "Lib_EleSta_v.pro";
If(export)
Printf('Include "Lib_EleSta_v.pro";') >> Str[exportFile];
EndIf
This diff is collapsed.
......@@ -3,11 +3,18 @@
// Template library for electrostatics using a scalar electric potential (v)
// formulation, with floating potentials
// Default definitions of constants, groups and functions that can/should be
// redefined from outside the template:
DefineConstant[
modelPath = GetString["Gmsh/Model absolute path"],
resPath = StrCat[modelPath, "res/"],
eps0 = 8.854187818e-12,
interactive = 0
modelPath = "", // default path of the model
resPath = StrCat[modelPath, "res/"], // path for post-operation files
eps0 = 8.854187818e-12, // permittivity of vacuum
Val_Rint = 0, // internal radius of Vol_Inf_Ele annulus
Val_Rext = 0, // external radius of Vol_Inf_Ele annulus
Val_Cx = 0, // x-coordinate of center of Vol_Inf_Ele
Val_Cy = 0, // y-coordinate of center of Vol_Inf_Ele
Val_Cz = 0 // z-coordinate of center of Vol_Inf_Ele
];
Group {
......@@ -18,6 +25,7 @@ Group {
Sur_Neu_Ele, // Non-homogeneous Neumann boundary conditions (n.d)
Sur_C_Ele // boundary of conductors
];
Dom_Ele = Region[ {Vol_Ele, Sur_Neu_Ele} ];
}
Function{
......@@ -28,17 +36,7 @@ Function{
];
}
CallTest(interactive) Lib_EleSta_v_interactive;
DefineConstant[
Val_Rint = {1, Visible NbrRegions[Vol_Inf_Ele],
Name "Parameters/Geometry/1Internal shell radius"},
Val_Rext = {2, Visible NbrRegions[Vol_Inf_Ele],
Name "Parameters/Geometry/2External shell radius"},
Val_Cx = 0,
Val_Cy = 0,
Val_Cz = 0
];
// End of default definitions.
Jacobian {
{ Name Vol;
......@@ -80,7 +78,7 @@ FunctionSpace {
// v = v s + v s
// n n c,k c,k
{ Name sn; NameOfCoef vn; Function BF_Node;
Support Region[{Vol_Ele, Sur_Neu_Ele}]; Entity NodesOf[ All, Not Sur_C_Ele ]; }
Support Dom_Ele; Entity NodesOf[ All, Not Sur_C_Ele ]; }
{ Name sck; NameOfCoef vck; Function BF_GroupOfNodes;
Support Vol_Ele; Entity GroupsOfNodesOf[ Sur_C_Ele ]; }
}
......
......@@ -3,25 +3,36 @@
// Template library for magnetostatics using a scalar (phi) or a vector (a)
// potential formulation
// Default definitions of constants, groups and functions that can/should be
// redefined from outside the template:
DefineConstant[
modelPath = GetString["Gmsh/Model absolute path"],
resPath = StrCat[modelPath, "res/"],
exportFile = StrCat[modelPath, "export.pro"],
mu0 = 4*Pi*1e-7,
modelDim = 2,
interactive = 0
modelPath = "", // default path of the model
resPath = StrCat[modelPath, "res/"], // path for post-operation files
mu0 = 4*Pi*1e-7, // magnetic permeability of vacuum
modelDim = 2, // default model dimension (2D)
Val_Rint = 0, // internal radius of Vol_Inf_Ele annulus
Val_Rext = 0, // external radius of Vol_Inf_Ele annulus
Val_Cx = 0, // x-coordinate of center of Vol_Inf_Ele
Val_Cy = 0, // y-coordinate of center of Vol_Inf_Ele
Val_Cz = 0, // z-coordinate of center of Vol_Inf_Ele
NL_max_iter = 20, // max number of nonlinear iterations
NL_relax = 1, // nonlinear iteration relexation
NL_tol = 1e-5 // stopping criterion for nonlinear iterations
];
Group {
DefineGroup[
Vol_M_Mag, // magnets
Vol_L_Mag, // linear magnetic materials
Vol_NL_Mag, // nonlinear magnetic materials
Vol_M_Mag, // permenent magnets
Vol_S0_Mag, // imposed current density
Vol_Inf_Mag, // infinite domains
Vol_NL_Mag, // nonlinear magnetic materials
Vol_L_Mag, // linear magnetic materials
Sur_Dir_Mag // Dirichlet boundary conditions
Sur_Neu_Mag // Non-homogeneous Neumann boundary conditions
];
Vol_Mag = Region[{Vol_L_Mag, Vol_NL_Mag, Vol_M_Mag, Vol_S0_Mag, Vol_Inf_Mag}];
Dom_Mag = Region[{Vol_Mag, Sur_Neu_Mag}];
}
Function{
......@@ -30,37 +41,28 @@ Function{
nu, // magnetic reluctivity (= 1/nu)
hc, // coercive magnetic field (in magnets)
js, // source current density
dhdb_NL, dbdh_NL // nonlinear parts of the Jacobian
dhdb_NL, // nonlinar part of Jacobian for phi formulation
dbdh_NL, // nonlinear part of Jacobian for a formulation
bn, // normal magnetic flux density on Sur_Neu_Mag for phi formulation
nxh // tangential magnetic field on Sur_Neu_Mag for a formulation
];
}
CallTest(interactive) Lib_MagSta_a_phi_interactive;
DefineConstant[
Val_Rint = {1, Visible NbrRegions[Vol_Inf_Mag],
Name "Parameters/Geometry/1Internal shell radius"},
Val_Rext = {2, Visible NbrRegions[Vol_Inf_Mag],
Name "Parameters/Geometry/2External shell radius"},
Val_Cx, Val_Cy, Val_Cz,
Nb_max_iter = {30, Visible NbrRegions[Vol_NL_Mag],
Name "Parameters/Nonlinear solver/Maximum number of iterations"},
relaxation_factor = 1,
stop_criterion = {1e-5, Visible NbrRegions[Vol_NL_Mag],
Name "Parameters/Nonlinear solver/Tolerance"}
];
Group{
Vol_Mag = Region[{Vol_L_Mag, Vol_NL_Mag, Vol_M_Mag, Vol_S0_Mag, Vol_Inf_Mag}];
}
// End of default definitions.
Jacobian {
{ Name JVol;
{ Name Vol;
Case {
{ Region Vol_Inf_Mag;
Jacobian VolSphShell{Val_Rint, Val_Rext, Val_Cx, Val_Cy, Val_Cz}; }
{ Region All; Jacobian Vol; }
}
}
{ Name Sur;
Case {
{ Region All; Jacobian Sur; }
}
}
}
Integration {
......@@ -94,7 +96,7 @@ FunctionSpace {
{ Name Hgrad_phi; Type Form0;
BasisFunction {
{ Name sn; NameOfCoef phin; Function BF_Node;
Support Vol_Mag; Entity NodesOf[ All ]; }
Support Dom_Mag; Entity NodesOf[ All ]; }
}
Constraint {
{ NameOfCoef phin; EntityType NodesOf; NameOfConstraint phi; }
......@@ -103,8 +105,8 @@ FunctionSpace {
If(modelDim == 3)
{ Name Hcurl_a; Type Form1;
BasisFunction {
{ Name se; NameOfCoef ae; Function BF_Edge; Support Vol_Mag ;
Entity EdgesOf[ All ]; }
{ Name se; NameOfCoef ae; Function BF_Edge;
Support Dom_Mag ; Entity EdgesOf[ All ]; }
}
Constraint {
{ NameOfCoef ae; EntityType EdgesOf; NameOfConstraint a; }
......@@ -116,7 +118,7 @@ FunctionSpace {
{ Name Hcurl_a; Type Form1P;
BasisFunction {
{ Name se; NameOfCoef ae; Function BF_PerpendicularEdge;
Support Vol_Mag; Entity NodesOf[ All ]; }
Support Dom_Mag; Entity NodesOf[ All ]; }
}
Constraint {
{ NameOfCoef ae; EntityType NodesOf; NameOfConstraint a; }
......@@ -132,11 +134,13 @@ Formulation {
}
Equation {
Integral { [ - mu[-{d phi}] * Dof{d phi} , {d phi} ];
In Vol_Mag; Jacobian JVol; Integration I1; }
In Vol_Mag; Jacobian Vol; Integration I1; }
Integral { JacNL [ - dbdh_NL[-{d phi}] * Dof{d phi} , {d phi} ];
In Vol_NL_Mag; Jacobian JVol; Integration I1; }
In Vol_NL_Mag; Jacobian Vol; Integration I1; }
Integral { [ - mu[] * hc[] , {d phi} ];
In Vol_M_Mag; Jacobian JVol; Integration I1; }
In Vol_M_Mag; Jacobian Vol; Integration I1; }
Integral { [ bn[] , {phi} ];
In Sur_Neu_Mag; Jacobian Sur; Integration I1; }
}
}
{ Name MagSta_a; Type FemEquation;
......@@ -145,13 +149,15 @@ Formulation {
}
Equation {
Integral { [ nu[{d a}] * Dof{d a} , {d a} ];
In Vol_Mag; Jacobian JVol; Integration I1; }
In Vol_Mag; Jacobian Vol; Integration I1; }
Integral { JacNL [ dhdb_NL[{d a}] * Dof{d a} , {d a} ];
In Vol_NL_Mag; Jacobian JVol; Integration I1; }
In Vol_NL_Mag; Jacobian Vol; Integration I1; }
Integral { [ hc[] , {d a} ];
In Vol_M_Mag; Jacobian JVol; Integration I1; }
In Vol_M_Mag; Jacobian Vol; Integration I1; }
Integral { [ -js[] , {a} ];
In Vol_S0_Mag; Jacobian JVol; Integration I1; }
In Vol_S0_Mag; Jacobian Vol; Integration I1; }
Integral { [ nxh[] , {a} ];
In Sur_Neu_Mag; Jacobian Sur; Integration I1; }
}
}
}
......@@ -165,7 +171,7 @@ Resolution {
If(!NbrRegions[Vol_NL_Mag])
Generate[A]; Solve[A];
Else
IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor]{
IterativeLoop[NL_max_iter, NL_tol, NL_relax]{
GenerateJac[A]; SolveJac[A];
}
EndIf
......@@ -180,7 +186,7 @@ Resolution {
If(!NbrRegions[Vol_NL_Mag])
Generate[A]; Solve[A];
Else
IterativeLoop[Nb_max_iter, stop_criterion, relaxation_factor]{
IterativeLoop[NL_max_iter, NL_tol, NL_relax]{
GenerateJac[A]; SolveJac[A];
}
EndIf
......@@ -193,20 +199,20 @@ PostProcessing {
{ Name MagSta_phi; NameOfFormulation MagSta_phi;
Quantity {
{ Name b; Value {
Term { [ - mu[-{d phi}] * {d phi} ]; In Vol_Mag; Jacobian JVol; }
Term { [ - mu[] * hc[] ]; In Vol_M_Mag; Jacobian JVol; }
Term { [ - mu[-{d phi}] * {d phi} ]; In Vol_Mag; Jacobian Vol; }
Term { [ - mu[] * hc[] ]; In Vol_M_Mag; Jacobian Vol; }
}
}
{ Name h; Value {
Term { [ - {d phi} ]; In Vol_Mag; Jacobian JVol; }
Term { [ - {d phi} ]; In Vol_Mag; Jacobian Vol; }
}
}
{ Name hc; Value {
Term { [ hc[] ]; In Vol_M_Mag; Jacobian JVol; }
Term { [ hc[] ]; In Vol_M_Mag; Jacobian Vol; }
}
}
{ Name phi; Value {
Term { [ {phi} ]; In Vol_Mag; Jacobian JVol; }
Term { [ {phi} ]; In Vol_Mag; Jacobian Vol; }
}
}
}
......@@ -214,28 +220,28 @@ PostProcessing {
{ Name MagSta_a; NameOfFormulation MagSta_a;
Quantity {
{ Name az; Value {
Local { [ CompZ[{a}] ]; In Vol_Mag; Jacobian JVol; }
Local { [ CompZ[{a}] ]; In Vol_Mag; Jacobian Vol; }
}
}
{ Name b; Value {
Term { [ {d a} ]; In Vol_Mag; Jacobian JVol; }
Term { [ {d a} ]; In Vol_Mag; Jacobian Vol; }
}
}
{ Name a; Value {
Term { [ {a} ]; In Vol_Mag; Jacobian JVol; }
Term { [ {a} ]; In Vol_Mag; Jacobian Vol; }
}
}
{ Name h; Value {
Term { [ nu[{d a}] * {d a} ]; In Vol_Mag; Jacobian JVol; }
Term { [ hc[] ]; In Vol_M_Mag; Jacobian JVol; }
Term { [ nu[{d a}] * {d a} ]; In Vol_Mag; Jacobian Vol; }
Term { [ hc[] ]; In Vol_M_Mag; Jacobian Vol; }
}
}
{ Name hc; Value {
Term { [ hc[] ]; In Vol_M_Mag; Jacobian JVol; }
Term { [ hc[] ]; In Vol_M_Mag; Jacobian Vol; }
}
}
{ Name js; Value {
Term { [ js[] ]; In Vol_S0_Mag; Jacobian JVol; }
Term { [ js[] ]; In Vol_S0_Mag; Jacobian Vol; }
}
}
}
......@@ -246,7 +252,9 @@ PostOperation {
{ Name MagSta_phi; NameOfPostProcessing MagSta_phi;
Operation {
CreateDir[resPath];