Skip to content

Commit

Permalink
[FEM] add initial pressure constraint (#7364)
Browse files Browse the repository at this point in the history
* [FEM] add initial pressure constraint

- this is needed for fluids
  • Loading branch information
donovaly committed Aug 14, 2022
1 parent 32d7663 commit 27f50ad
Show file tree
Hide file tree
Showing 13 changed files with 512 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Mod/Fem/CMakeLists.txt
Expand Up @@ -172,6 +172,7 @@ SET(FemObjects_SRCS
femobjects/constraint_electrostaticpotential.py
femobjects/constraint_flowvelocity.py
femobjects/constraint_initialflowvelocity.py
femobjects/constraint_initialpressure.py
femobjects/constraint_sectionprint.py
femobjects/constraint_selfweight.py
femobjects/constraint_tie.py
Expand Down Expand Up @@ -566,6 +567,7 @@ SET(FemGuiTaskPanels_SRCS
femtaskpanels/task_constraint_electrostaticpotential.py
femtaskpanels/task_constraint_flowvelocity.py
femtaskpanels/task_constraint_initialflowvelocity.py
femtaskpanels/task_constraint_initialpressure.py
femtaskpanels/task_constraint_sectionprint.py
femtaskpanels/task_constraint_tie.py
femtaskpanels/task_element_fluid1D.py
Expand Down Expand Up @@ -603,6 +605,7 @@ SET(FemGuiViewProvider_SRCS
femviewprovider/view_constraint_electrostaticpotential.py
femviewprovider/view_constraint_flowvelocity.py
femviewprovider/view_constraint_initialflowvelocity.py
femviewprovider/view_constraint_initialpressure.py
femviewprovider/view_constraint_sectionprint.py
femviewprovider/view_constraint_selfweight.py
femviewprovider/view_constraint_tie.py
Expand Down
1 change: 1 addition & 0 deletions src/Mod/Fem/Gui/CMakeLists.txt
Expand Up @@ -394,6 +394,7 @@ SET(FemGuiPythonUI_SRCS
Resources/ui/ElementRotation1D.ui
Resources/ui/FlowVelocity.ui
Resources/ui/InitialFlowVelocity.ui
Resources/ui/InitialPressure.ui
Resources/ui/Material.ui
Resources/ui/MaterialReinforcement.ui
Resources/ui/MeshBoundaryLayer.ui
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Fem/Gui/Resources/Fem.qrc
Expand Up @@ -22,6 +22,7 @@
<file>icons/FEM_ConstraintGear.svg</file>
<file>icons/FEM_ConstraintHeatflux.svg</file>
<file>icons/FEM_ConstraintInitialFlowVelocity.svg</file>
<file>icons/FEM_ConstraintInitialPressure.svg</file>
<file>icons/FEM_ConstraintInitialTemperature.svg</file>
<file>icons/FEM_ConstraintPlaneRotation.svg</file>
<file>icons/FEM_ConstraintPressure.svg</file>
Expand Down Expand Up @@ -161,6 +162,7 @@
<file>ui/ElementRotation1D.ui</file>
<file>ui/FlowVelocity.ui</file>
<file>ui/InitialFlowVelocity.ui</file>
<file>ui/InitialPressure.ui</file>
<file>ui/Material.ui</file>
<file>ui/MaterialReinforcement.ui</file>
<file>ui/MeshBoundaryLayer.ui</file>
Expand Down
112 changes: 112 additions & 0 deletions src/Mod/Fem/Gui/Resources/icons/FEM_ConstraintInitialPressure.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions src/Mod/Fem/Gui/Resources/ui/InitialPressure.ui
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<height>40</height>
</rect>
</property>
<property name="windowTitle">
<string>Constraint Properties</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="pressureLbl">
<property name="text">
<string>Pressure:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>130</width>
<height>19</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="Gui::QuantitySpinBox" name="pressureQSB">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>true</bool>
</property>
<property name="unit" stdset="0">
<string notr="true">kPa</string>
</property>
<property name="minimum">
<double>-1000000000000000000000.000000000000000</double>
</property>
<property name="maximum">
<double>1000000000000000000000.000000000000000</double>
</property>
<property name="singleStep">
<double>50.000000000000000</double>
</property>
<property name="value">
<double>100.000000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
2 changes: 2 additions & 0 deletions src/Mod/Fem/Gui/Workbench.cpp
Expand Up @@ -144,6 +144,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
<< "Separator"
<< "FEM_ConstraintForce"
<< "FEM_ConstraintPressure"
<< "FEM_ConstraintInitialPressure"
<< "FEM_ConstraintCentrif"
<< "FEM_ConstraintSelfWeight";

Expand Down Expand Up @@ -272,6 +273,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "Separator"
<< "FEM_ConstraintForce"
<< "FEM_ConstraintPressure"
<< "FEM_ConstraintInitialPressure"
<< "FEM_ConstraintCentrif"
<< "FEM_ConstraintSelfWeight";

Expand Down
15 changes: 15 additions & 0 deletions src/Mod/Fem/ObjectsFem.py
Expand Up @@ -228,6 +228,21 @@ def makeConstraintInitialFlowVelocity(
return obj


def makeConstraintInitialPressure(
doc,
name="ConstraintInitialPressure"
):
"""makeConstraintInitialPressure(document, [name]):
makes a Fem ConstraintInitialPressure object"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import constraint_initialpressure
constraint_initialpressure.ConstraintInitialPressure(obj)
if FreeCAD.GuiUp:
from femviewprovider import view_constraint_initialpressure
view_constraint_initialpressure.VPConstraintInitialPressure(obj.ViewObject)
return obj


def makeConstraintInitialTemperature(
doc,
name="ConstraintInitialTemperature"
Expand Down
21 changes: 21 additions & 0 deletions src/Mod/Fem/femcommands/commands.py
Expand Up @@ -258,6 +258,23 @@ def __init__(self):
self.do_activated = "add_obj_on_gui_set_edit"


class _ConstraintInitialPressure(CommandManager):
"The FEM_ConstraintInitialPressure command definition"

def __init__(self):
super(_ConstraintInitialPressure, self).__init__()
self.menutext = Qt.QT_TRANSLATE_NOOP(
"FEM_ConstraintInitialPressure",
"Constraint initial pressure"
)
self.tooltip = Qt.QT_TRANSLATE_NOOP(
"FEM_ConstraintInitialPressure",
"Creates a FEM constraint initial pressure"
)
self.is_active = "with_analysis"
self.do_activated = "add_obj_on_gui_set_edit"


class _ConstraintSectionPrint(CommandManager):
"The FEM_ConstraintSectionPrint command definition"

Expand Down Expand Up @@ -1104,6 +1121,10 @@ def __init__(self):
"FEM_ConstraintInitialFlowVelocity",
_ConstraintInitialFlowVelocity()
)
FreeCADGui.addCommand(
"FEM_ConstraintInitialPressure",
_ConstraintInitialPressure()
)
FreeCADGui.addCommand(
"FEM_ConstraintSectionPrint",
_ConstraintSectionPrint()
Expand Down

0 comments on commit 27f50ad

Please sign in to comment.