Skip to content

Commit

Permalink
FEM: Add ElectricInfinity- and CapacitanceMatrix- boundary condition …
Browse files Browse the repository at this point in the history
…for Elmer
  • Loading branch information
HoWilgh authored and berndhahnebach committed Feb 20, 2020
1 parent 325b31a commit de517b6
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 11 deletions.
73 changes: 66 additions & 7 deletions src/Mod/Fem/Gui/Resources/ui/ElectrostaticPotential.ui
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<height>154</height>
</rect>
</property>
<property name="windowTitle">
Expand All @@ -17,15 +17,74 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<item row="0" column="0">
<widget class="QLabel" name="potentialLbl">
<property name="text">
<string>Potential:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="potentialConstantBox">
<property name="text">
<string>Potential Constant</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="electricInfinityBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Farfield / Electric infinity</string>
</property>
</widget>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="capacitanceBodyBox">
<property name="text">
<string>unspecified</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="capacitanceBody_spinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="maximumSize">
<size>
<width>55</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>1</width>
<height>0</height>
</size>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="value">
<number>1</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="Gui::InputField" name="potentialTxt">
<property name="enabled">
Expand All @@ -51,10 +110,10 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="potentialConstantBox">
<item row="4" column="0">
<widget class="QLabel" name="capacityBody_label">
<property name="text">
<string>Potential Constant</string>
<string extracomment="Enabled by 'Calculate Capacity Matrix' in Electrostatic equation">Capacity Body: </string>
</property>
</widget>
</item>
Expand Down
Expand Up @@ -120,6 +120,14 @@ def _initParamWidget(self):
self._paramWidget.potentialConstantBox.setChecked(
self._obj.PotentialConstant)

self._paramWidget.electricInfinityBox.setChecked(
self._obj.ElectricInfinity)

self._paramWidget.capacitanceBodyBox.setChecked(
not self._obj.CapacitanceBodyEnabled)
self._paramWidget.capacitanceBody_spinBox.setValue(
self._obj.CapacitanceBody)

def _applyWidgetChanges(self):
unit = "V"
self._obj.PotentialEnabled = \
Expand Down
13 changes: 12 additions & 1 deletion src/Mod/Fem/femobjects/_FemConstraintElectrostaticPotential.py
Expand Up @@ -44,4 +44,15 @@ def __init__(self, obj):
"Parameter", "Potential Enabled"),
obj.addProperty(
"App::PropertyBool", "PotentialConstant",
"Parameter", "Potential Constant")
"Parameter", "Potential Constant"),
obj.addProperty( # Howil added
"App::PropertyBool", "ElectricInfinity",
"Parameter", "Electric Infinity")
obj.addProperty(
"App::PropertyInteger", "CapacitanceBody",
"Parameter", "Capacitance Body")
obj.addProperty(
"App::PropertyBool", "CapacitanceBodyEnabled",
"Parameter", "Capacitance Body Enabled")


6 changes: 3 additions & 3 deletions src/Mod/Fem/femsolver/elmer/equations/electrostatic.py
Expand Up @@ -54,10 +54,10 @@ def __init__(self, obj):
obj.addProperty(
"App::PropertyBool", "CalculateSurfaceCharge",
"Electrostatic", "Select type of solver for linear system")
obj.addProperty(
"App::PropertyBool", "CalculateCapacitanceMatrix",
"Electrostatic", "Select type of solver for linear system")
"""
#obj.addProperty(
#"App::PropertyBool", "CalculateCapacitanceMatrix",
#"Electrostatic", "Select type of solver for linear system")
#obj.addProperty(
#"App::PropertyInteger", "CapacitanceBodies",
#"Electrostatic", "Select type of solver for linear system")
Expand Down
5 changes: 5 additions & 0 deletions src/Mod/Fem/femsolver/elmer/writer.py
Expand Up @@ -362,6 +362,11 @@ def _handleElectrostaticBndConditions(self):
self._boundary(name, "Potential", potential)
if obj.PotentialConstant:
self._boundary(name, "Potential Constant", True)
if obj.ElectricInfinity:
self._boundary(name, "Electric Infinity BC", True)
if obj.CapacitanceBodyEnabled:
if hasattr(obj, 'CapacitanceBody'):
self._boundary(name, "Capacitance Body", obj.CapacitanceBody)
self._handled(obj)

def _handleFluxsolver(self):
Expand Down

0 comments on commit de517b6

Please sign in to comment.