Commit 1f1b59b3 authored by Christophe Geuzaine's avatar Christophe Geuzaine

top-level interactive file

parent b144e3a3
// This script allows to choose which physical model to setup interactively:
//
// 1) Create a geometry with Gmsh, or load an existing geometry (".geo" file)
// in Gmsh with `File->Open'
// 2) Merge this file ("Interactive.pro") with `File->Merge'
// 3) You will be prompted to setup your materials, sources and boundary
// conditions for each physical group, interactively
// 4) Press "Run" to solve the model
//
// 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[
physics = {0, Choices{
0="-",
1="Electrostatics",
2="Magnetostatics"
},
Name "Model/00Physical model", ServerAction "Reset"}
_C = {0, Name "GetDP/}ModelCheck", Closed 1}
];
If(physics == 1)
Include "Interactive_Electrostatics.pro";
ElseIf(physics == 2)
Include "Interactive_Magnetostatics.pro";
EndIf
......@@ -24,7 +24,7 @@ DefineConstant[
"v: scalar electric potential (e = -grad v) [V]",
"rho: free charge density [C/m³]",
"q: free charge [C]"],
Name "GetDP/Formulation", ServerAction "ResetDatabase"},
Name "Model/01Formulation"},
modelDim = GetNumber["Gmsh/Model dimension"],
modelPath = GetString["Gmsh/Model absolute path"],
modelName = GetString["Gmsh/Model name"],
......@@ -36,8 +36,8 @@ DefineConstant[
];
numPhysicals = GetNumber["Gmsh/Number of physical groups"];
surPath = "Parameters/Boundary conditions/Physical group: ";
volPath = "Parameters/Materials and sources/Physical group: ";
surPath = "Model/Boundary conditions/Physical group: ";
volPath = "Model/Materials and sources/Physical group: ";
If(export && FileExists[exportFile])
RenameFile[exportFile, StrCat[exportFile, "_", Date["%F-%R"]]];
......@@ -103,9 +103,9 @@ Group {
DefineConstant[
Val_Rint = {1, Visible NbrRegions[Vol_Inf_Ele],
Name "Parameters/Geometry/1Internal shell radius"},
Name "Model/Geometry/1Internal shell radius"},
Val_Rext = {2, Visible NbrRegions[Vol_Inf_Ele],
Name "Parameters/Geometry/2External shell radius"}
Name "Model/Geometry/2External shell radius"}
];
If(export && NbrRegions[Vol_Inf_Ele])
Printf(Sprintf("Val_Rint = %g;", Val_Rint)) >> Str[exportFile];
......
......@@ -23,7 +23,7 @@ DefineConstant[
"b: magnetic flux density [T]",
"phi: scalar magnetic potential (h = -grad phi) [A]",
"a: vector magnetic potential (b = curl a) [T.m]"],
Name "GetDP/Formulation", ServerAction "ResetDatabase"},
Name "Model/01Formulation"},
modelDim = GetNumber["Gmsh/Model dimension"],
modelPath = GetString["Gmsh/Model absolute path"],
modelName = GetString["Gmsh/Model name"],
......@@ -35,8 +35,8 @@ DefineConstant[
];
numPhysicals = GetNumber["Gmsh/Number of physical groups"];
surPath = "Parameters/Boundary conditions/Physical group: ";
volPath = "Parameters/Materials and sources/Physical group: ";
surPath = "Model/Boundary conditions/Physical group: ";
volPath = "Model/Materials and sources/Physical group: ";
If(export && FileExists[exportFile])
RenameFile[exportFile, StrCat[exportFile, "_", Date["%F-%R"]]];
......@@ -74,7 +74,7 @@ Group {
2="Infinite air shell"
},
Name StrCat[volPath, name~{i}, "/0Material type"]}
source~{i} = {0, Choices{
source~{i} = {0, ReadOnlyRange 1, Choices{
0="None",
1="Coercive magnetic field",
formulationType ? 2="Current source"
......@@ -107,9 +107,9 @@ Group{
DefineGroup[ Vol_Inf_Mag, Vol_NL_Mag ];
DefineConstant[
Val_Rint = {1, Visible NbrRegions[Vol_Inf_Mag],
Name "Parameters/Geometry/0Internal shell radius"},
Name "Model/Geometry/0Internal shell radius"},
Val_Rext = {2, Visible NbrRegions[Vol_Inf_Mag],
Name "Parameters/Geometry/1External shell radius"}
Name "Model/Geometry/1External shell radius"}
];
If(export && NbrRegions[Vol_Inf_Mag])
Printf(Sprintf("Val_Rint = %g;", Val_Rint)) >> Str[exportFile];
......@@ -179,7 +179,8 @@ Function{
Visible (source~{i} == 2 && js_preset~{i} == 1),
Name StrCat[volPath, name~{i}, "/8js function"],
Label "js [A/m²]", Help "Current density"},
mur_preset~{i} = {0, Visible (material~{i} == 0),
mur_preset~{i} = {#linearMagneticMaterials() > 2 ? 2 : 0,
Visible (material~{i} == 0),
Choices{ 0:#linearMagneticMaterials()-1 = linearMagneticMaterials() },
Name StrCat[volPath, name~{i}, "/1mur preset"],
Label "Material choice"}
......
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