Skip to content

Commit

Permalink
FEM: code formating, max line length < 100, fem objects
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed May 20, 2019
1 parent 5ca75ca commit 7171d20
Show file tree
Hide file tree
Showing 13 changed files with 869 additions and 143 deletions.
21 changes: 18 additions & 3 deletions src/Mod/Fem/femobjects/_FemConstraintSelfWeight.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,24 @@
class _FemConstraintSelfWeight:
"The FemConstraintSelfWeight object"
def __init__(self, obj):
obj.addProperty("App::PropertyFloat", "Gravity_x", "Gravity", "set the gravity component in the x direction")
obj.addProperty("App::PropertyFloat", "Gravity_y", "Gravity", "set the gravity component in the y direction")
obj.addProperty("App::PropertyFloat", "Gravity_z", "Gravity", "set the gravity component in the z direction")
obj.addProperty(
"App::PropertyFloat",
"Gravity_x",
"Gravity",
"set the gravity component in the x direction"
)
obj.addProperty(
"App::PropertyFloat",
"Gravity_y",
"Gravity",
"set the gravity component in the y direction"
)
obj.addProperty(
"App::PropertyFloat",
"Gravity_z",
"Gravity",
"set the gravity component in the z direction"
)
obj.Gravity_x = 0.0
obj.Gravity_y = 0.0
obj.Gravity_z = -1.0
Expand Down
265 changes: 227 additions & 38 deletions src/Mod/Fem/femobjects/_FemElementFluid1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,49 +35,238 @@ class _FemElementFluid1D:

known_fluid_types = ['Liquid', 'Gas', 'Open Channel']
known_liquid_types = [
'PIPE MANNING', 'PIPE ENLARGEMENT', 'PIPE CONTRACTION', 'PIPE INLET', 'PIPE OUTLET', 'PIPE ENTRANCE',
'PIPE DIAPHRAGM', 'PIPE BEND', 'PIPE GATE VALVE', 'LIQUID PUMP', 'PIPE WHITE-COLEBROOK'
'PIPE MANNING',
'PIPE ENLARGEMENT',
'PIPE CONTRACTION',
'PIPE INLET',
'PIPE OUTLET',
'PIPE ENTRANCE',
'PIPE DIAPHRAGM',
'PIPE BEND',
'PIPE GATE VALVE',
'LIQUID PUMP',
'PIPE WHITE-COLEBROOK'
]
known_gas_types = ['NONE']
known_channel_types = ['NONE']

def __init__(self, obj):
obj.addProperty("App::PropertyLinkSubList", "References", "FluidSection", "List of fluid section shapes")
obj.addProperty("App::PropertyEnumeration", "SectionType", "FluidSection", "select fluid section type")
obj.addProperty("App::PropertyEnumeration", "LiquidSectionType", "LiquidSection", "select liquid section type")
obj.addProperty("App::PropertyArea", "ManningArea", "LiquidManning", "set area of the manning fluid section")
obj.addProperty("App::PropertyLength", "ManningRadius", "LiquidManning", "set hydraulic radius of manning fluid section")
obj.addProperty("App::PropertyFloat", "ManningCoefficient", "LiquidManning", "set coefficient of manning fluid section")
obj.addProperty("App::PropertyArea", "EnlargeArea1", "LiquidEnlargement", "set initial area of the enlargement fluid section")
obj.addProperty("App::PropertyArea", "EnlargeArea2", "LiquidEnlargement", "set enlarged area of enlargement fluid section")
obj.addProperty("App::PropertyArea", "ContractArea1", "LiquidContraction", "set initial area of the contraction fluid section")
obj.addProperty("App::PropertyArea", "ContractArea2", "LiquidContraction", "set contracted area of contraction fluid section")
obj.addProperty("App::PropertyFloat", "InletPressure", "LiquidInlet", "set inlet pressure for fluid section")
obj.addProperty("App::PropertyFloat", "OutletPressure", "LiquidOutlet", "set outlet pressure for fluid section")
obj.addProperty("App::PropertyFloat", "InletFlowRate", "LiquidInlet", "set inlet mass flow rate for fluid section")
obj.addProperty("App::PropertyFloat", "OutletFlowRate", "LiquidOutlet", "set outlet mass flow rate for fluid section")
obj.addProperty("App::PropertyBool", "InletPressureActive", "LiquidInlet", "activates or deactivates inlet pressure for fluid section")
obj.addProperty("App::PropertyBool", "OutletPressureActive", "LiquidOutlet", "activates or deactivates outlet pressure for fluid section")
obj.addProperty("App::PropertyBool", "InletFlowRateActive", "LiquidInlet", "activates or deactivates inlet flow rate for fluid section")
obj.addProperty("App::PropertyBool", "OutletFlowRateActive", "LiquidOutlet", "activates or deactivates outlet flow rate for fluid section")
obj.addProperty("App::PropertyArea", "EntrancePipeArea", "LiquidEntrance", "set the pipe area of the entrance fluid section")
obj.addProperty("App::PropertyArea", "EntranceArea", "LiquidEntrance", "set the entrance area of the entrance fluid section")
obj.addProperty("App::PropertyArea", "DiaphragmPipeArea", "LiquidDiaphragm", "set the pipe area of the diaphragm fluid section")
obj.addProperty("App::PropertyArea", "DiaphragmArea", "LiquidDiaphragm", "set the diaphragm area of the diaphragm fluid section")
obj.addProperty("App::PropertyArea", "BendPipeArea", "LiquidBend", "set pipe area of the bend fluid section")
obj.addProperty("App::PropertyFloat", "BendRadiusDiameter", "LiquidBend", "set ratio of bend radius over pipe diameter of the bend fluid section")
obj.addProperty("App::PropertyFloat", "BendAngle", "LiquidBend", "set bend angle of the bend fluid section")
obj.addProperty("App::PropertyFloat", "BendLossCoefficient", "LiquidBend", "set loss coefficient of the bend fluid section")
obj.addProperty("App::PropertyArea", "GateValvePipeArea", "LiquidGateValve", "set pipe area of the gate valve fluid section")
obj.addProperty("App::PropertyFloat", "GateValveClosingCoeff", "LiquidGateValve", "set closing coefficient of the gate valve fluid section")
obj.addProperty("App::PropertyFloatList", "PumpFlowRate", "LiquidPump", "set the pump characteristic flow rate of the pump fluid section")
obj.addProperty("App::PropertyFloatList", "PumpHeadLoss", "LiquidPump", "set the pump characteristic head loss of the pump fluid section")
obj.addProperty("App::PropertyArea", "ColebrookeArea", "LiquidColebrooke", "set pipe area of the colebrooke fluid section")
obj.addProperty("App::PropertyLength", "ColebrookeRadius", "LiquidColebrooke", "set hydraulic radius of the colebrooke fluid section")
obj.addProperty("App::PropertyLength", "ColebrookeGrainDiameter", "LiquidColebrooke", "set grain diameter of the colebrooke fluid section")
obj.addProperty("App::PropertyFloat", "ColebrookeFormFactor", "LiquidColebrooke", "set coefficient of the colebrooke fluid section")
obj.addProperty("App::PropertyEnumeration", "GasSectionType", "GasSection", "select gas section type")
obj.addProperty("App::PropertyEnumeration", "ChannelSectionType", "ChannelSection", "select channel section type")
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"FluidSection",
"List of fluid section shapes"
)
obj.addProperty(
"App::PropertyEnumeration",
"SectionType",
"FluidSection",
"select fluid section type"
)
obj.addProperty(
"App::PropertyEnumeration",
"LiquidSectionType",
"LiquidSection",
"select liquid section type"
)
obj.addProperty(
"App::PropertyArea",
"ManningArea",
"LiquidManning",
"set area of the manning fluid section"
)
obj.addProperty(
"App::PropertyLength",
"ManningRadius",
"LiquidManning",
"set hydraulic radius of manning fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"ManningCoefficient",
"LiquidManning",
"set coefficient of manning fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EnlargeArea1",
"LiquidEnlargement",
"set initial area of the enlargement fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EnlargeArea2",
"LiquidEnlargement",
"set enlarged area of enlargement fluid section"
)
obj.addProperty(
"App::PropertyArea",
"ContractArea1",
"LiquidContraction",
"set initial area of the contraction fluid section"
)
obj.addProperty(
"App::PropertyArea",
"ContractArea2",
"LiquidContraction",
"set contracted area of contraction fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"InletPressure",
"LiquidInlet",
"set inlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"OutletPressure",
"LiquidOutlet",
"set outlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"InletFlowRate",
"LiquidInlet",
"set inlet mass flow rate for fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"OutletFlowRate",
"LiquidOutlet",
"set outlet mass flow rate for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"InletPressureActive",
"LiquidInlet",
"activates or deactivates inlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"OutletPressureActive",
"LiquidOutlet",
"activates or deactivates outlet pressure for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"InletFlowRateActive",
"LiquidInlet",
"activates or deactivates inlet flow rate for fluid section"
)
obj.addProperty(
"App::PropertyBool",
"OutletFlowRateActive",
"LiquidOutlet",
"activates or deactivates outlet flow rate for fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EntrancePipeArea",
"LiquidEntrance",
"set the pipe area of the entrance fluid section"
)
obj.addProperty(
"App::PropertyArea",
"EntranceArea",
"LiquidEntrance",
"set the entrance area of the entrance fluid section"
)
obj.addProperty(
"App::PropertyArea",
"DiaphragmPipeArea",
"LiquidDiaphragm",
"set the pipe area of the diaphragm fluid section"
)
obj.addProperty(
"App::PropertyArea",
"DiaphragmArea",
"LiquidDiaphragm",
"set the diaphragm area of the diaphragm fluid section"
)
obj.addProperty(
"App::PropertyArea",
"BendPipeArea",
"LiquidBend",
"set pipe area of the bend fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"BendRadiusDiameter",
"LiquidBend",
"set ratio of bend radius over pipe diameter of the bend fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"BendAngle",
"LiquidBend",
"set bend angle of the bend fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"BendLossCoefficient",
"LiquidBend",
"set loss coefficient of the bend fluid section"
)
obj.addProperty(
"App::PropertyArea",
"GateValvePipeArea",
"LiquidGateValve",
"set pipe area of the gate valve fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"GateValveClosingCoeff",
"LiquidGateValve",
"set closing coefficient of the gate valve fluid section"
)
obj.addProperty(
"App::PropertyFloatList",
"PumpFlowRate",
"LiquidPump",
"set the pump characteristic flow rate of the pump fluid section"
)
obj.addProperty(
"App::PropertyFloatList",
"PumpHeadLoss",
"LiquidPump",
"set the pump characteristic head loss of the pump fluid section"
)
obj.addProperty(
"App::PropertyArea",
"ColebrookeArea",
"LiquidColebrooke",
"set pipe area of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyLength",
"ColebrookeRadius",
"LiquidColebrooke",
"set hydraulic radius of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyLength",
"ColebrookeGrainDiameter",
"LiquidColebrooke",
"set grain diameter of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyFloat",
"ColebrookeFormFactor",
"LiquidColebrooke",
"set coefficient of the colebrooke fluid section"
)
obj.addProperty(
"App::PropertyEnumeration",
"GasSectionType",
"GasSection",
"select gas section type"
)
obj.addProperty(
"App::PropertyEnumeration",
"ChannelSectionType",
"ChannelSection",
"select channel section type"
)

# set property default values
obj.SectionType = _FemElementFluid1D.known_fluid_types
Expand Down
49 changes: 42 additions & 7 deletions src/Mod/Fem/femobjects/_FemElementGeometry1D.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,48 @@ class _FemElementGeometry1D:
known_beam_types = ['Rectangular', 'Circular', 'Pipe']

def __init__(self, obj):
obj.addProperty("App::PropertyLength", "RectWidth", "RectBeamSection", "set width of the rectangular beam elements")
obj.addProperty("App::PropertyLength", "RectHeight", "RectBeamSection", "set height of therectangular beam elements")
obj.addProperty("App::PropertyLength", "CircDiameter", "CircBeamSection", "set diameter of the circular beam elements")
obj.addProperty("App::PropertyLength", "PipeDiameter", "PipeBeamSection", "set outer diameter of the pipe beam elements")
obj.addProperty("App::PropertyLength", "PipeThickness", "PipeBeamSection", "set thickness of the pipe beam elements")
obj.addProperty("App::PropertyEnumeration", "SectionType", "BeamSection", "select beam section type")
obj.addProperty("App::PropertyLinkSubList", "References", "BeamSection", "List of beam section shapes")
obj.addProperty(
"App::PropertyLength",
"RectWidth",
"RectBeamSection",
"set width of the rectangular beam elements"
)
obj.addProperty(
"App::PropertyLength",
"RectHeight",
"RectBeamSection",
"set height of therectangular beam elements"
)
obj.addProperty(
"App::PropertyLength",
"CircDiameter",
"CircBeamSection",
"set diameter of the circular beam elements"
)
obj.addProperty(
"App::PropertyLength",
"PipeDiameter",
"PipeBeamSection",
"set outer diameter of the pipe beam elements"
)
obj.addProperty(
"App::PropertyLength",
"PipeThickness",
"PipeBeamSection",
"set thickness of the pipe beam elements"
)
obj.addProperty(
"App::PropertyEnumeration",
"SectionType",
"BeamSection",
"select beam section type"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"BeamSection",
"List of beam section shapes"
)
obj.SectionType = _FemElementGeometry1D.known_beam_types
obj.SectionType = 'Rectangular'
obj.Proxy = self
Expand Down
14 changes: 12 additions & 2 deletions src/Mod/Fem/femobjects/_FemElementGeometry2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,18 @@
class _FemElementGeometry2D:
"The FemElementGeometry2D object"
def __init__(self, obj):
obj.addProperty("App::PropertyLength", "Thickness", "ShellThickness", "set thickness of the shell elements")
obj.addProperty("App::PropertyLinkSubList", "References", "ShellThickness", "List of shell thickness shapes")
obj.addProperty(
"App::PropertyLength",
"Thickness",
"ShellThickness",
"set thickness of the shell elements"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"ShellThickness",
"List of shell thickness shapes"
)
obj.Proxy = self
self.Type = "Fem::FemElementGeometry2D"

Expand Down
Loading

0 comments on commit 7171d20

Please sign in to comment.