Commit dcfdc12e by Christophe Geuzaine

up

parent 11c3f5b7
Pipeline #1451 passed with stage
in 13 minutes 53 seconds
......@@ -18,16 +18,17 @@ DefineConstant[
"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"],
export = !StrCmp[OnelabAction, "compute"],
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}
];
numPhysicals = GetNumber["Gmsh/Number of physical groups"];
// interactive definition of groups
Group {
If(export)
......@@ -52,7 +53,7 @@ Group {
If(bc~{i} == 0)
str = StrCat["Sur_Neu_Ele += ", reg];
ElseIf(bc~{i} == 2 || bc~{i} == 3)
str = StrCat["Sur_C_Ele += ", reg];
str = StrCat["Sur_C_Ele += ", reg];
EndIf
Else
DefineConstant[
......@@ -102,19 +103,15 @@ Function {
Printf('Function {') >> Str[exportFile];
EndIf
For i In {1:numPhysicals}
reg = Sprintf["[Region[%g]]", tag~{i}]; str = "";
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),
......@@ -141,7 +138,6 @@ Function {
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}]];
......@@ -158,10 +154,10 @@ Function {
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
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
EndFor
If(export)
......
......@@ -17,16 +17,17 @@ DefineConstant[
"phi: scalar magnetic potential (h = -grad phi) [A]",
"a: vector magnetic potential (b = curl a) [T.m]"],
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"],
export = !StrCmp[OnelabAction, "compute"],
exportFile = StrCat[modelPath, "export.pro"],
R_ = {"Analysis", Name "GetDP/1ResolutionChoices", Visible 0},
C_ = {"-solve -bin", Name "GetDP/9ComputeCommand", Visible 0},
P_ = {"", Name "GetDP/2PostOperationChoices", Visible 0}
];
numPhysicals = GetNumber["Gmsh/Number of physical groups"];
// interactive definition of groups
Group {
If(export)
......@@ -107,21 +108,17 @@ Function{
Printf('Function {') >> Str[exportFile];
EndIf
For i In {1:numPhysicals}
reg = Sprintf["[Region[%g]]", tag~{i}]; str = ""; str2 = "";
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 && formulationType == 0)
str = StrCat["bn", reg, Sprintf[" = %g; ", bc_val~{i}]];
ElseIf(bc~{i} == 0 && formulationType == 1)
str = StrCat["nxh", reg, Sprintf[" = %g; ", bc_val~{i}]];
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
Else
DefineConstant[
hc_preset~{i} = {#permanentMagnetMaterials() > 2 ? 2 : 0,
......@@ -196,7 +193,6 @@ Function{
Name StrCat["Parameters/Materials/", name~{i}, "/5dmudh2 function"],
Label "dμ/dh²"}
];
reg = Sprintf["[Region[%g]]", tag~{i}]; str = ""; str2 = "";
If(material~{i} == 0 && hc_preset~{i} == 0) // magnet, constant
str = StrCat["hc", reg, Sprintf[" = Vector[%g, %g, %g]; ", hcx~{i},
hcy~{i}, hcz~{i}], "mu", reg, " = mu0; ", "nu", reg, " = 1/mu0; "];
......@@ -244,14 +240,14 @@ Function{
ElseIf(material~{i} == 4) // infinite regions
str = StrCat["mu", reg, " = mu0; ", "nu", reg, " = 1/mu0; "];
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
Parse[str2];
If(export && StrLen[str2])
Printf(StrCat[" ", str2]) >> Str[exportFile];
EndIf
EndIf
Parse[str];
If(export && StrLen[str])
Printf(StrCat[" ", str]) >> Str[exportFile];
EndIf
Parse[str2];
If(export && StrLen[str2])
Printf(StrCat[" ", str2]) >> Str[exportFile];
EndIf
EndFor
If(export)
......
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