[FEM] Elmer: add support for 2D magnetodynamics
- adds the corresponding Elmer equation (it is now possible to do Elmer's tutorial example no. 16)
This commit is contained in:
@@ -1344,6 +1344,136 @@ bool CmdFemCompEmConstraints::isActive()
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// FEM_CompEmEquations (dropdown toolbar button for Electromagnetic equations)
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_ACL(CmdFEMCompEmEquations)
|
||||
|
||||
CmdFEMCompEmEquations::CmdFEMCompEmEquations()
|
||||
: Command("FEM_CompEmEquations")
|
||||
{
|
||||
sAppModule = "Fem";
|
||||
sGroup = QT_TR_NOOP("Fem");
|
||||
sMenuText = QT_TR_NOOP("Electromagnetic equations...");
|
||||
sToolTipText = QT_TR_NOOP(
|
||||
"Electromagnetic equations for the Elmer solver");
|
||||
sWhatsThis = "FEM_CompEmEquations";
|
||||
sStatusTip = sToolTipText;
|
||||
}
|
||||
|
||||
void CmdFEMCompEmEquations::activated(int iMsg)
|
||||
{
|
||||
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
if (iMsg == 0)
|
||||
rcCmdMgr.runCommandByName("FEM_EquationElectricforce");
|
||||
else if (iMsg == 1)
|
||||
rcCmdMgr.runCommandByName("FEM_EquationElectrostatic");
|
||||
else if (iMsg == 2)
|
||||
rcCmdMgr.runCommandByName("FEM_EquationMagnetodynamic2D");
|
||||
else
|
||||
return;
|
||||
|
||||
// Since the default icon is reset when enabling/disabling the command we have
|
||||
// to explicitly set the icon of the used command.
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
assert(iMsg < a.size());
|
||||
pcAction->setIcon(a[iMsg]->icon());
|
||||
}
|
||||
|
||||
Gui::Action* CmdFEMCompEmEquations::createAction()
|
||||
{
|
||||
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
QAction* cmd0 = pcAction->addAction(QString());
|
||||
cmd0->setIcon(Gui::BitmapFactory().iconFromTheme("FEM_EquationElectricforce"));
|
||||
QAction* cmd1 = pcAction->addAction(QString());
|
||||
cmd1->setIcon(Gui::BitmapFactory().iconFromTheme("FEM_EquationElectrostatic"));
|
||||
QAction* cmd2 = pcAction->addAction(QString());
|
||||
cmd2->setIcon(Gui::BitmapFactory().iconFromTheme("FEM_EquationMagnetodynamic2D"));
|
||||
|
||||
_pcAction = pcAction;
|
||||
languageChange();
|
||||
|
||||
pcAction->setIcon(cmd0->icon());
|
||||
int defaultId = 0;
|
||||
pcAction->setProperty("defaultAction", QVariant(defaultId));
|
||||
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
void CmdFEMCompEmEquations::languageChange()
|
||||
{
|
||||
Command::languageChange();
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
|
||||
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
Gui::Command* EquationElectricforce = rcCmdMgr.getCommandByName("FEM_EquationElectricforce");
|
||||
if (EquationElectricforce) {
|
||||
QAction* cmd0 = a[0];
|
||||
cmd0->setText(QApplication::translate("FEM_EquationElectricforce",
|
||||
EquationElectricforce->getMenuText()));
|
||||
cmd0->setToolTip(QApplication::translate("FEM_EquationElectricforce",
|
||||
EquationElectricforce->getToolTipText()));
|
||||
cmd0->setStatusTip(QApplication::translate("FEM_EquationElectricforce",
|
||||
EquationElectricforce->getStatusTip()));
|
||||
}
|
||||
|
||||
Gui::Command* EquationElectrostatic = rcCmdMgr.getCommandByName("FEM_EquationElectrostatic");
|
||||
if (EquationElectrostatic) {
|
||||
QAction* cmd1 = a[1];
|
||||
cmd1->setText(QApplication::translate("FEM_EquationElectrostatic",
|
||||
EquationElectrostatic->getMenuText()));
|
||||
cmd1->setToolTip(QApplication::translate("FEM_EquationElectrostatic",
|
||||
EquationElectrostatic->getToolTipText()));
|
||||
cmd1->setStatusTip(QApplication::translate("FEM_EquationElectrostatic",
|
||||
EquationElectrostatic->getStatusTip()));
|
||||
}
|
||||
|
||||
Gui::Command* EquationMagnetodynamic2D =
|
||||
rcCmdMgr.getCommandByName("FEM_EquationMagnetodynamic2D");
|
||||
if (EquationMagnetodynamic2D) {
|
||||
QAction* cmd2 = a[2];
|
||||
cmd2->setText(QApplication::translate("FEM_EquationMagnetodynamic2D",
|
||||
EquationMagnetodynamic2D->getMenuText()));
|
||||
cmd2->setToolTip(QApplication::translate("FEM_EquationMagnetodynamic2D",
|
||||
EquationMagnetodynamic2D->getToolTipText()));
|
||||
cmd2->setStatusTip(QApplication::translate("FEM_EquationMagnetodynamic2D",
|
||||
EquationMagnetodynamic2D->getStatusTip()));
|
||||
}
|
||||
}
|
||||
|
||||
bool CmdFEMCompEmEquations::isActive()
|
||||
{
|
||||
// only if there is an active analysis
|
||||
Fem::FemAnalysis* ActiveAnalysis =
|
||||
FemGui::ActiveAnalysisObserver::instance()->getActiveObject();
|
||||
if (!ActiveAnalysis
|
||||
|| !ActiveAnalysis->getTypeId().isDerivedFrom(Fem::FemAnalysis::getClassTypeId()))
|
||||
return false;
|
||||
|
||||
// only activate if a single Elmer object is selected
|
||||
auto results = getSelection().getSelectionEx(nullptr, App::DocumentObject::getClassTypeId(), Gui::ResolveMode::FollowLink); //.getObjectsOfType<femsolver.elmer.solver.Proxy>();
|
||||
if (results.size() == 1) {
|
||||
auto object = results.begin()->getObject();
|
||||
// FIXME: this is not unique since the Ccx solver object has the same type
|
||||
std::string Type = "Fem::FemSolverObjectPython";
|
||||
if (Type.compare(object->getTypeId().getName()) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//================================================================================================
|
||||
//================================================================================================
|
||||
// commands vtk post processing
|
||||
@@ -2203,6 +2333,9 @@ void CreateFemCommands()
|
||||
rcCmdMgr.addCommand(new CmdFemCreateNodesSet());
|
||||
rcCmdMgr.addCommand(new CmdFemDefineNodesSet());
|
||||
|
||||
// equations
|
||||
rcCmdMgr.addCommand(new CmdFEMCompEmEquations());
|
||||
|
||||
// vtk post processing
|
||||
#ifdef FC_USE_VTK
|
||||
rcCmdMgr.addCommand(new CmdFemPostClipFilter);
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
<file>icons/FEM_EquationFlow.svg</file>
|
||||
<file>icons/FEM_EquationFlux.svg</file>
|
||||
<file>icons/FEM_EquationHeat.svg</file>
|
||||
<file>icons/FEM_EquationMagnetodynamic2D.svg</file>
|
||||
|
||||
<!-- gui command icons: meshes -->
|
||||
<file>icons/FEM_CreateNodesSet.svg</file>
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg version="1.1" id="svg2" height="64" width="64" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs id="defs4">
|
||||
<linearGradient id="linearGradient959">
|
||||
<stop style="stop-color:#cc0000;stop-opacity:1" offset="0" id="stop957" />
|
||||
<stop id="stop955" offset="1" style="stop-color:#729fcf;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient940">
|
||||
<stop style="stop-color:#000000;stop-opacity:1" offset="0" id="stop936" />
|
||||
<stop style="stop-color:#000000;stop-opacity:0" offset="1" id="stop938" />
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient882">
|
||||
<stop id="stop876" offset="0" style="stop-color:#73d216;stop-opacity:1" />
|
||||
<stop style="stop-color:#729fcf;stop-opacity:1" offset="1" id="stop878" />
|
||||
</linearGradient>
|
||||
<linearGradient id="linearGradient3802">
|
||||
<stop id="stop3804" offset="0" style="stop-color:#2e3436;stop-opacity:1" />
|
||||
<stop id="stop3806" offset="1" style="stop-color:#555753;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient gradientUnits="userSpaceOnUse" y2="42" x2="47" y1="58" x1="49" id="linearGradient3808" xlink:href="#linearGradient3802" />
|
||||
<linearGradient id="linearGradient3767">
|
||||
<stop style="stop-color:#edd400;stop-opacity:1" offset="0" id="stop3769" />
|
||||
<stop style="stop-color:#fce94f;stop-opacity:1" offset="1" id="stop3771" />
|
||||
</linearGradient>
|
||||
<linearGradient xlink:href="#linearGradient3767" id="linearGradient985" gradientUnits="userSpaceOnUse" gradientTransform="translate(0,-4)" x1="32.567314" y1="41.431564" x2="5.3436856" y2="34.638504" />
|
||||
<linearGradient gradientTransform="translate(-48.762712,7.1864407)" xlink:href="#linearGradient882" id="linearGradient4039" x1="89.610168" y1="46.389832" x2="91.338982" y2="32.542374" gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient id="linearGradient4033">
|
||||
<stop style="stop-color:#73d216;stop-opacity:1" offset="0" id="stop4035" />
|
||||
<stop id="stop4041" offset="0.5" style="stop-color:#729fcf;stop-opacity:1" />
|
||||
<stop style="stop-color:#cc0000;stop-opacity:1" offset="1" id="stop4037" />
|
||||
</linearGradient>
|
||||
<linearGradient xlink:href="#linearGradient940" id="linearGradient942" x1="14.474576" y1="24.519833" x2="32" y2="28.99441" gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient xlink:href="#linearGradient959" id="linearGradient951" gradientUnits="userSpaceOnUse" x1="14.474576" y1="22.892714" x2="23.237288" y2="26.757122" />
|
||||
<linearGradient xlink:href="#linearGradient959" id="linearGradient968" gradientUnits="userSpaceOnUse" x1="12.863206" y1="12.118106" x2="12.863206" y2="46.133854" gradientTransform="matrix(0.94458924,0,0,0.94225828,21.548537,4.555805)" />
|
||||
</defs>
|
||||
<metadata id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>[Alexander Gryson]</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:date>2017-03-11</dc:date>
|
||||
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier>FreeCAD/src/Mod/</dc:identifier>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD LGPL2+</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>[agryson] Alexander Gryson</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<path style="fill:url(#linearGradient968);fill-opacity:1;stroke:#302b00;stroke-width:2.00001;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1" d="M 47.979387,15.97419 H 15.848478 V 48.025811 H 47.979387 Z" id="path987" />
|
||||
<g id="g1227" transform="matrix(0.94458924,0,0,0.94225826,1.5680741,1.7290257)" style="stroke-width:1.05998">
|
||||
<path style="fill:none;stroke:black;stroke-width:1.05998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 30.23622,15.11811 C 30.23622,15.11811 14.253491,-15.11811 0,-15.11811 C -14.253491,-15.11811 -24.781645,1.9496015 -30.23622,15.11811 C -34.575308,25.593594 -34.575308,38.658374 -30.23622,49.133858 C -24.781645,62.302367 -14.253491,79.370079 0,79.370079 C 14.253491,79.370079 30.23622,49.133858 30.23622,49.133858" id="path556" />
|
||||
<path style="fill:none;stroke:black;stroke-width:1.05998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 22.677165,15.11811 C 22.677165,15.11811 20.752297,0 15.11811,0 C 3.8497361,0 0.25590134,19.929541 0,31.195009 C -0.28178213,43.599819 2.7132999,63.970187 15.11811,64.251969 C 20.750844,64.37992 22.677165,49.133858 22.677165,49.133858" id="path621" />
|
||||
<path style="fill:none;stroke:black;stroke-width:1.05998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 15.11811,15.11811 C 15.11811,15.11811 7.7932043,25.51775 7.5590551,31.147069 C 7.2771021,37.925667 15.11811,49.133858 15.11811,49.133858" id="path623" />
|
||||
</g>
|
||||
<g id="g1227-3" transform="matrix(-0.94458924,0,0,-0.94225826,62.259791,62.270969)" style="stroke-width:1.05998">
|
||||
<path style="fill:none;stroke:black;stroke-width:1.05998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 30.23622,15.11811 C 30.23622,15.11811 14.253491,-15.11811 0,-15.11811 C -14.253491,-15.11811 -24.781645,1.9496015 -30.23622,15.11811 C -34.575308,25.593594 -34.575308,38.658374 -30.23622,49.133858 C -24.781645,62.302367 -14.253491,79.370079 0,79.370079 C 14.253491,79.370079 30.23622,49.133858 30.23622,49.133858" id="path556-9" />
|
||||
<path style="fill:none;stroke:black;stroke-width:1.05998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 22.677165,15.11811 C 22.677165,15.11811 20.752297,0 15.11811,0 C 3.8497361,0 0.25590134,19.929541 0,31.195009 C -0.28178213,43.599819 2.7132999,63.970187 15.11811,64.251969 C 20.750844,64.37992 22.677165,49.133858 22.677165,49.133858" id="path621-3" />
|
||||
<path style="fill:none;stroke:black;stroke-width:1.05998px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" d="M 15.11811,15.11811 C 15.11811,15.11811 7.7932043,25.51775 7.5590551,31.147069 C 7.2771021,37.925667 15.11811,49.133858 15.11811,49.133858" id="path623-3" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
@@ -180,8 +180,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "FEM_SolverZ88"
|
||||
<< "Separator"
|
||||
<< "FEM_EquationElasticity"
|
||||
<< "FEM_EquationElectricforce"
|
||||
<< "FEM_EquationElectrostatic"
|
||||
<< "FEM_CompEmEquations"
|
||||
<< "FEM_EquationFlow"
|
||||
<< "FEM_EquationFlux"
|
||||
<< "FEM_EquationHeat"
|
||||
@@ -347,8 +346,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
<< "FEM_SolverZ88"
|
||||
<< "Separator"
|
||||
<< "FEM_EquationElasticity"
|
||||
<< "FEM_EquationElectricforce"
|
||||
<< "FEM_EquationElectrostatic"
|
||||
<< "FEM_CompEmEquations"
|
||||
<< "FEM_EquationFlow"
|
||||
<< "FEM_EquationFlux"
|
||||
<< "FEM_EquationHeat"
|
||||
|
||||
Reference in New Issue
Block a user