FEM: code formating, max line length < 100, fem objects

This commit is contained in:
Bernd Hahnebach
2019-05-20 12:31:24 +02:00
parent a847ac39a4
commit 783e063de7
13 changed files with 869 additions and 143 deletions

View File

@@ -32,9 +32,24 @@ __url__ = "http://www.freecadweb.org"
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

View File

@@ -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

View File

@@ -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

View File

@@ -32,8 +32,18 @@ __url__ = "https://www.freecadweb.org"
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"

View File

@@ -33,8 +33,18 @@ class _FemElementRotation1D:
"The FemElementRotation1D object"
def __init__(self, obj):
obj.addProperty("App::PropertyAngle", "Rotation", "BeamRotation", "Set the rotation of beam elements")
obj.addProperty("App::PropertyLinkSubList", "References", "BeamRotation", "List of beam rotation shapes")
obj.addProperty(
"App::PropertyAngle",
"Rotation",
"BeamRotation",
"Set the rotation of beam elements"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"BeamRotation",
"List of beam rotation shapes"
)
obj.Proxy = self
self.Type = "Fem::FemElementRotation1D"

View File

@@ -32,8 +32,18 @@ __url__ = "http://www.freecadweb.org"
class _FemMaterial:
"The FEM Material object"
def __init__(self, obj):
obj.addProperty("App::PropertyLinkSubList", "References", "Material", "List of material shapes")
obj.addProperty("App::PropertyEnumeration", "Category", "Material", "Material type: fluid or solid")
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"Material",
"List of material shapes"
)
obj.addProperty(
"App::PropertyEnumeration",
"Category",
"Material",
"Material type: fluid or solid"
)
obj.Category = ['Solid', 'Fluid'] # used in TaskPanel
obj.Proxy = self
self.Type = "Fem::Material"

View File

@@ -35,20 +35,45 @@ class _FemMaterialMechanicalNonlinear:
obj.Proxy = self
self.Type = "Fem::MaterialMechanicalNonlinear"
obj.addProperty("App::PropertyLink", "LinearBaseMaterial", "Base", "Set the linear material the nonlinear builds upon.")
obj.addProperty(
"App::PropertyLink",
"LinearBaseMaterial",
"Base",
"Set the linear material the nonlinear builds upon."
)
choices_nonlinear_material_models = ["simple hardening"]
obj.addProperty("App::PropertyEnumeration", "MaterialModelNonlinearity", "Fem", "Set the type on nonlinear material model")
obj.addProperty(
"App::PropertyEnumeration",
"MaterialModelNonlinearity",
"Fem",
"Set the type on nonlinear material model"
)
obj.MaterialModelNonlinearity = choices_nonlinear_material_models
obj.MaterialModelNonlinearity = choices_nonlinear_material_models[0]
obj.addProperty("App::PropertyString", "YieldPoint1", "Fem", "Set stress and strain for yield point one, separated by a comma.")
obj.addProperty(
"App::PropertyString",
"YieldPoint1",
"Fem",
"Set stress and strain for yield point one, separated by a comma."
)
obj.YieldPoint1 = "235.0, 0.0"
obj.addProperty("App::PropertyString", "YieldPoint2", "Fem", "Set stress and strain for yield point two, separated by a comma.")
obj.addProperty(
"App::PropertyString",
"YieldPoint2",
"Fem",
"Set stress and strain for yield point two, separated by a comma."
)
obj.YieldPoint2 = "241.0, 0.025"
obj.addProperty("App::PropertyString", "YieldPoint3", "Fem", "Set stress and strain for yield point three, separated by a comma.")
obj.addProperty(
"App::PropertyString",
"YieldPoint3",
"Fem",
"Set stress and strain for yield point three, separated by a comma."
)
obj.YieldPoint3 = ""
def execute(self, obj):

View File

@@ -36,18 +36,38 @@ class _FemMeshBoundaryLayer:
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object
obj.addProperty("App::PropertyInteger", "NumberOfLayers", "MeshBoundaryLayerProperties", "set number of inflation layers for this boundary")
obj.addProperty(
"App::PropertyInteger",
"NumberOfLayers",
"MeshBoundaryLayerProperties",
"set number of inflation layers for this boundary"
)
obj.NumberOfLayers = 3
obj.addProperty("App::PropertyLength", "MinimumThickness", "MeshBoundaryLayerProperties", "set minimum thickness,usually the first inflation layer")
obj.addProperty(
"App::PropertyLength",
"MinimumThickness",
"MeshBoundaryLayerProperties",
"set minimum thickness,usually the first inflation layer"
)
# default to zero, user must specify a proper value for this property
obj.addProperty("App::PropertyFloat", "GrowthRate", "MeshBoundaryLayerProperties", "set growth rate of inflation layers for smooth transition")
obj.addProperty(
"App::PropertyFloat",
"GrowthRate",
"MeshBoundaryLayerProperties",
"set growth rate of inflation layers for smooth transition"
)
obj.GrowthRate = 1.5
obj.addProperty("App::PropertyLinkSubList", "References", "MeshBoundaryLayerShapes", "List of FEM mesh region shapes")
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"MeshBoundaryLayerShapes",
"List of FEM mesh region shapes"
)
def execute(self, obj):
return

View File

@@ -36,67 +36,168 @@ class _FemMeshGmsh():
# they will be used from the task panel too, thus they need to be outside of the __init__
known_element_dimensions = ['From Shape', '1D', '2D', '3D']
known_element_orders = ['1st', '2nd']
known_mesh_algorithm_2D = ['Automatic', 'MeshAdapt', 'Delaunay', 'Frontal', 'BAMG', 'DelQuad']
known_mesh_algorithm_3D = ['Automatic', 'Delaunay', 'New Delaunay', 'Frontal', 'Frontal Delaunay', 'Frontal Hex', 'MMG3D', 'R-tree']
known_mesh_algorithm_2D = [
'Automatic',
'MeshAdapt',
'Delaunay',
'Frontal',
'BAMG',
'DelQuad'
]
known_mesh_algorithm_3D = [
'Automatic',
'Delaunay',
'New Delaunay',
'Frontal',
'Frontal Delaunay',
'Frontal Hex',
'MMG3D',
'R-tree'
]
def __init__(self, obj):
self.Type = "Fem::FemMeshGmsh"
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object
obj.addProperty("App::PropertyLinkList", "MeshBoundaryLayerList", "Base", "Mesh boundaries need inflation layers")
obj.addProperty(
"App::PropertyLinkList",
"MeshBoundaryLayerList",
"Base",
"Mesh boundaries need inflation layers"
)
obj.MeshBoundaryLayerList = []
obj.addProperty("App::PropertyLinkList", "MeshRegionList", "Base", "Mesh regions of the mesh")
obj.addProperty(
"App::PropertyLinkList",
"MeshRegionList",
"Base",
"Mesh regions of the mesh"
)
obj.MeshRegionList = []
obj.addProperty("App::PropertyLinkList", "MeshGroupList", "Base", "Mesh groups of the mesh")
obj.addProperty(
"App::PropertyLinkList",
"MeshGroupList",
"Base",
"Mesh groups of the mesh"
)
obj.MeshGroupList = []
obj.addProperty("App::PropertyLink", "Part", "FEM Mesh", "Geometry object, the mesh is made from. The geometry object has to have a Shape.")
obj.addProperty(
"App::PropertyLink",
"Part",
"FEM Mesh",
"Geometry object, the mesh is made from. The geometry object has to have a Shape."
)
obj.Part = None
obj.addProperty("App::PropertyLength", "CharacteristicLengthMax", "FEM Gmsh Mesh Params", "Max mesh element size (0.0 = infinity)")
obj.addProperty(
"App::PropertyLength",
"CharacteristicLengthMax",
"FEM Gmsh Mesh Params",
"Max mesh element size (0.0 = infinity)"
)
obj.CharacteristicLengthMax = 0.0 # will be 1e+22
obj.addProperty("App::PropertyLength", "CharacteristicLengthMin", "FEM Gmsh Mesh Params", "Min mesh element size")
obj.addProperty(
"App::PropertyLength",
"CharacteristicLengthMin",
"FEM Gmsh Mesh Params",
"Min mesh element size"
)
obj.CharacteristicLengthMin = 0.0
obj.addProperty("App::PropertyEnumeration", "ElementDimension", "FEM Gmsh Mesh Params", "Dimension of mesh elements (Auto = according ShapeType of part to mesh)")
obj.addProperty(
"App::PropertyEnumeration",
"ElementDimension",
"FEM Gmsh Mesh Params",
"Dimension of mesh elements (Auto = according ShapeType of part to mesh)"
)
obj.ElementDimension = _FemMeshGmsh.known_element_dimensions
obj.ElementDimension = 'From Shape' # according ShapeType of Part to mesh
obj.addProperty("App::PropertyEnumeration", "ElementOrder", "FEM Gmsh Mesh Params", "Order of mesh elements")
obj.addProperty(
"App::PropertyEnumeration",
"ElementOrder",
"FEM Gmsh Mesh Params",
"Order of mesh elements"
)
obj.ElementOrder = _FemMeshGmsh.known_element_orders
obj.ElementOrder = '2nd'
obj.addProperty("App::PropertyBool", "OptimizeStd", "FEM Gmsh Mesh Params", "Optimize tetra elements")
obj.addProperty(
"App::PropertyBool",
"OptimizeStd",
"FEM Gmsh Mesh Params",
"Optimize tetra elements"
)
obj.OptimizeStd = True
obj.addProperty("App::PropertyBool", "OptimizeNetgen", "FEM Gmsh Mesh Params", "Optimize tetra elements by use of Netgen")
obj.addProperty(
"App::PropertyBool",
"OptimizeNetgen",
"FEM Gmsh Mesh Params",
"Optimize tetra elements by use of Netgen"
)
obj.OptimizeNetgen = False
obj.addProperty("App::PropertyBool", "HighOrderOptimize", "FEM Gmsh Mesh Params", "Optimize high order meshes")
obj.addProperty(
"App::PropertyBool",
"HighOrderOptimize",
"FEM Gmsh Mesh Params",
"Optimize high order meshes"
)
obj.HighOrderOptimize = False
obj.addProperty("App::PropertyBool", "RecombineAll", "FEM Gmsh Mesh Params", "Apply recombination algorithm to all surfaces")
obj.addProperty(
"App::PropertyBool",
"RecombineAll",
"FEM Gmsh Mesh Params",
"Apply recombination algorithm to all surfaces"
)
obj.RecombineAll = False
obj.addProperty("App::PropertyBool", "CoherenceMesh", "FEM Gmsh Mesh Params", "Removes all duplicate mesh vertices")
obj.addProperty(
"App::PropertyBool",
"CoherenceMesh",
"FEM Gmsh Mesh Params",
"Removes all duplicate mesh vertices"
)
obj.CoherenceMesh = True
obj.addProperty("App::PropertyFloat", "GeometryTolerance", "FEM Gmsh Mesh Params", "Geometrical Tolerance (0.0 = GMSH std = 1e-08)")
obj.addProperty(
"App::PropertyFloat",
"GeometryTolerance",
"FEM Gmsh Mesh Params",
"Geometrical Tolerance (0.0 = GMSH std = 1e-08)"
)
obj.GeometryTolerance = 1e-06
obj.addProperty("App::PropertyEnumeration", "Algorithm2D", "FEM Gmsh Mesh Params", "mesh algorithm 2D")
obj.addProperty(
"App::PropertyEnumeration",
"Algorithm2D",
"FEM Gmsh Mesh Params",
"mesh algorithm 2D"
)
obj.Algorithm2D = _FemMeshGmsh.known_mesh_algorithm_2D
obj.Algorithm2D = 'Automatic' # ?
obj.addProperty("App::PropertyEnumeration", "Algorithm3D", "FEM Gmsh Mesh Params", "mesh algorithm 3D")
obj.addProperty(
"App::PropertyEnumeration",
"Algorithm3D",
"FEM Gmsh Mesh Params",
"mesh algorithm 3D"
)
obj.Algorithm3D = _FemMeshGmsh.known_mesh_algorithm_3D
obj.Algorithm3D = 'Automatic' # ?
obj.addProperty("App::PropertyBool", "GroupsOfNodes", "FEM Gmsh Mesh Params", "For each group create not only the elements but the nodes too.")
obj.addProperty(
"App::PropertyBool",
"GroupsOfNodes",
"FEM Gmsh Mesh Params",
"For each group create not only the elements but the nodes too."
)
obj.GroupsOfNodes = False
def execute(self, obj):

View File

@@ -32,8 +32,18 @@ __url__ = "http://www.freecadweb.org"
class _FemMeshGroup:
"The FemMeshGroup object"
def __init__(self, obj):
obj.addProperty("App::PropertyBool", "UseLabel", "MeshGroupProperties", "The identifier used for export (True: Label, False: Name)")
obj.addProperty("App::PropertyLinkSubList", "References", "MeshGroupShapes", "List of FEM mesh group shapes")
obj.addProperty(
"App::PropertyBool",
"UseLabel",
"MeshGroupProperties",
"The identifier used for export (True: Label, False: Name)"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"MeshGroupShapes",
"List of FEM mesh group shapes"
)
obj.Proxy = self
self.Type = "Fem::FemMeshGroup"

View File

@@ -32,8 +32,18 @@ __url__ = "http://www.freecadweb.org"
class _FemMeshRegion:
"The FemMeshRegion object"
def __init__(self, obj):
obj.addProperty("App::PropertyLength", "CharacteristicLength", "MeshRegionProperties", "set characteristic length of FEM elements for this region")
obj.addProperty("App::PropertyLinkSubList", "References", "MeshRegionShapes", "List of FEM mesh region shapes")
obj.addProperty(
"App::PropertyLength",
"CharacteristicLength",
"MeshRegionProperties",
"set characteristic length of FEM elements for this region"
)
obj.addProperty(
"App::PropertyLinkSubList",
"References",
"MeshRegionShapes",
"List of FEM mesh region shapes"
)
obj.Proxy = self
self.Type = "Fem::FemMeshRegion"

View File

@@ -37,50 +37,215 @@ class _FemResultMechanical():
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object
obj.addProperty("App::PropertyString", "ResultType", "Base", "Type of the result", 1) # the 1 set the property to ReadOnly
obj.addProperty(
"App::PropertyString",
"ResultType",
"Base",
"Type of the result",
1 # the 1 set the property to ReadOnly
)
obj.ResultType = str(self.Type)
# for frequency analysis
obj.addProperty("App::PropertyInteger", "Eigenmode", "Data", "", True)
obj.addProperty("App::PropertyFloat", "EigenmodeFrequency", "Data", "User Defined Results", True)
obj.addProperty(
"App::PropertyInteger",
"Eigenmode",
"Data",
"",
True
)
obj.addProperty(
"App::PropertyFloat",
"EigenmodeFrequency",
"Data",
"User Defined Results",
True
)
# node results
# set read only or hide a property: https://forum.freecadweb.org/viewtopic.php?f=18&t=13460&start=10#p108072
# set read only or hide a property:
# https://forum.freecadweb.org/viewtopic.php?f=18&t=13460&start=10#p108072
# do not show up in propertyEditor of comboView
obj.addProperty("App::PropertyVectorList", "DisplacementVectors", "NodeData", "List of displacement vectors", True)
obj.addProperty("App::PropertyFloatList", "Peeq", "NodeData", "List of equivalent plastic strain values", True)
obj.addProperty(
"App::PropertyVectorList",
"DisplacementVectors",
"NodeData",
"List of displacement vectors",
True
)
obj.addProperty(
"App::PropertyFloatList",
"Peeq",
"NodeData",
"List of equivalent plastic strain values",
True
)
# readonly in propertyEditor of comboView
obj.addProperty("App::PropertyFloatList", "DisplacementLengths", "NodeData", "List of displacement lengths", True)
obj.addProperty("App::PropertyFloatList", "StressValues", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "PrincipalMax", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "PrincipalMed", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "PrincipalMin", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "MaxShear", "NodeData", "List of Maximum Shear stress values", True)
obj.addProperty("App::PropertyFloatList", "MassFlowRate", "NodeData", "List of mass flow rate values", True)
obj.addProperty("App::PropertyFloatList", "NetworkPressure", "NodeData", "List of network pressure values", True)
obj.addProperty("App::PropertyFloatList", "UserDefined", "NodeData", "User Defined Results", True)
obj.addProperty("App::PropertyFloatList", "Temperature", "NodeData", "Temperature field", True)
obj.addProperty("App::PropertyFloatList", "NodeStressXX", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStressYY", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStressZZ", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStressXY", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStressXZ", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStressYZ", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStrainXX", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStrainYY", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStrainZZ", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStrainXY", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStrainXZ", "NodeData", "", True)
obj.addProperty("App::PropertyFloatList", "NodeStrainYZ", "NodeData", "", True)
obj.addProperty(
"App::PropertyFloatList",
"DisplacementLengths",
"NodeData",
"List of displacement lengths",
True
)
obj.addProperty(
"App::PropertyFloatList",
"StressValues",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"PrincipalMax",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"PrincipalMed",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"PrincipalMin",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"MaxShear",
"NodeData",
"List of Maximum Shear stress values",
True
)
obj.addProperty(
"App::PropertyFloatList",
"MassFlowRate",
"NodeData",
"List of mass flow rate values",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NetworkPressure",
"NodeData",
"List of network pressure values",
True
)
obj.addProperty(
"App::PropertyFloatList",
"UserDefined",
"NodeData",
"User Defined Results",
True
)
obj.addProperty(
"App::PropertyFloatList",
"Temperature",
"NodeData",
"Temperature field",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStressXX",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStressYY",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStressZZ",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStressXY",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStressXZ",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStressYZ",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainXX",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainYY",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainZZ",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainXY", "NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainXZ",
"NodeData",
"",
True
)
obj.addProperty(
"App::PropertyFloatList",
"NodeStrainYZ",
"NodeData",
"",
True
)
# initialize the Stats with the appropriate count of items (see fill_femresult_stats in femresult/resulttools.py)
# initialize the Stats with the appropriate count of items
# see fill_femresult_stats in femresult/resulttools.py
zero_list = 39 * [0]
obj.Stats = zero_list
# standard Feature methods
def execute(self, obj):
""""this method is executed on object creation and whenever the document is recomputed"
update Part or Mesh should NOT lead to recomputation of the analysis automatically, time consuming
""""this method is executed on object creation and
whenever the document is recomputed"
update Part or Mesh should NOT lead to recomputation
of the analysis automatically, time consuming
"""
return

View File

@@ -40,19 +40,36 @@ class _FemSolverCalculix():
self.Object = obj # keep a ref to the DocObj for nonGui usage
obj.Proxy = self # link between App::DocumentObject to this object
# fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General") # not needed ATM
# not needed ATM
# fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")
ccx_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx")
obj.addProperty("App::PropertyPath", "WorkingDir", "Fem", "Working directory for calculations, will only be used it is left blank in preferences")
# the working directory is not set, the solver working directory is only used if the preferences working directory is left blank
obj.addProperty(
"App::PropertyPath",
"WorkingDir",
"Fem",
"Working directory for calculations, will only be used it is left blank in preferences"
)
# the working directory is not set, the solver working directory is
# only used if the preferences working directory is left blank
obj.addProperty("App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis")
obj.addProperty(
"App::PropertyEnumeration",
"AnalysisType",
"Fem",
"Type of the analysis"
)
obj.AnalysisType = ccxtools.FemToolsCcx.known_analysis_types
analysis_type = ccx_prefs.GetInt("AnalysisType", 0)
obj.AnalysisType = ccxtools.FemToolsCcx.known_analysis_types[analysis_type]
choices_geom_nonlinear = ["linear", "nonlinear"]
obj.addProperty("App::PropertyEnumeration", "GeometricalNonlinearity", "Fem", "Set geometrical nonlinearity")
obj.addProperty(
"App::PropertyEnumeration",
"GeometricalNonlinearity",
"Fem",
"Set geometrical nonlinearity"
)
obj.GeometricalNonlinearity = choices_geom_nonlinear
nonlinear_geom = ccx_prefs.GetBool("NonlinearGeometry", False)
if nonlinear_geom is True:
@@ -61,44 +78,97 @@ class _FemSolverCalculix():
obj.GeometricalNonlinearity = choices_geom_nonlinear[0] # linear
choices_material_nonlinear = ["linear", "nonlinear"]
obj.addProperty("App::PropertyEnumeration", "MaterialNonlinearity", "Fem", "Set material nonlinearity (needs geometrical nonlinearity)")
obj.addProperty(
"App::PropertyEnumeration",
"MaterialNonlinearity",
"Fem",
"Set material nonlinearity (needs geometrical nonlinearity)"
)
obj.MaterialNonlinearity = choices_material_nonlinear
obj.MaterialNonlinearity = choices_material_nonlinear[0]
obj.addProperty("App::PropertyIntegerConstraint", "EigenmodesCount", "Fem", "Number of modes for frequency calculations")
obj.addProperty(
"App::PropertyIntegerConstraint",
"EigenmodesCount",
"Fem",
"Number of modes for frequency calculations"
)
noe = ccx_prefs.GetInt("EigenmodesCount", 10)
obj.EigenmodesCount = (noe, 1, 100, 1)
obj.addProperty("App::PropertyFloatConstraint", "EigenmodeLowLimit", "Fem", "Low frequency limit for eigenmode calculations")
obj.addProperty(
"App::PropertyFloatConstraint",
"EigenmodeLowLimit",
"Fem",
"Low frequency limit for eigenmode calculations"
)
ell = ccx_prefs.GetFloat("EigenmodeLowLimit", 0.0)
obj.EigenmodeLowLimit = (ell, 0.0, 1000000.0, 10000.0)
obj.addProperty("App::PropertyFloatConstraint", "EigenmodeHighLimit", "Fem", "High frequency limit for eigenmode calculations")
obj.addProperty(
"App::PropertyFloatConstraint",
"EigenmodeHighLimit",
"Fem",
"High frequency limit for eigenmode calculations"
)
ehl = ccx_prefs.GetFloat("EigenmodeHighLimit", 1000000.0)
obj.EigenmodeHighLimit = (ehl, 0.0, 1000000.0, 10000.0)
stringIterationsThermoMechMaximum = "Maximum Number of thermo mechanical iterations in each time step before stopping jobs"
obj.addProperty("App::PropertyIntegerConstraint", "IterationsThermoMechMaximum", "Fem", stringIterationsThermoMechMaximum)
stringIterationsThermoMechMaximum = (
"Maximum Number of thermo mechanical iterations "
"in each time step before stopping jobs"
)
obj.addProperty(
"App::PropertyIntegerConstraint",
"IterationsThermoMechMaximum",
"Fem",
stringIterationsThermoMechMaximum
)
niter = ccx_prefs.GetInt("AnalysisMaxIterations", 200)
obj.IterationsThermoMechMaximum = niter
obj.addProperty("App::PropertyFloatConstraint", "TimeInitialStep", "Fem", "Initial time steps")
obj.addProperty(
"App::PropertyFloatConstraint",
"TimeInitialStep",
"Fem",
"Initial time steps"
)
ini = ccx_prefs.GetFloat("AnalysisTimeInitialStep", 1.0)
obj.TimeInitialStep = ini
obj.addProperty("App::PropertyFloatConstraint", "TimeEnd", "Fem", "End time analysis")
obj.addProperty(
"App::PropertyFloatConstraint",
"TimeEnd",
"Fem",
"End time analysis"
)
eni = ccx_prefs.GetFloat("AnalysisTime", 1.0)
obj.TimeEnd = eni
obj.addProperty("App::PropertyBool", "ThermoMechSteadyState", "Fem", "Choose between steady state thermo mech or transient thermo mech analysis")
obj.addProperty(
"App::PropertyBool",
"ThermoMechSteadyState",
"Fem",
"Choose between steady state thermo mech or transient thermo mech analysis"
)
sted = ccx_prefs.GetBool("StaticAnalysis", True)
obj.ThermoMechSteadyState = sted
obj.addProperty("App::PropertyBool", "IterationsControlParameterTimeUse", "Fem", "Use the user defined time incrementation control parameter")
obj.addProperty(
"App::PropertyBool",
"IterationsControlParameterTimeUse",
"Fem",
"Use the user defined time incrementation control parameter"
)
use_non_ccx_iterations_param = ccx_prefs.GetInt("UseNonCcxIterationParam", False)
obj.IterationsControlParameterTimeUse = use_non_ccx_iterations_param
obj.addProperty("App::PropertyBool", "SplitInputWriter", "Fem", "Split writing of ccx input file")
obj.addProperty(
"App::PropertyBool",
"SplitInputWriter",
"Fem",
"Split writing of ccx input file"
)
split = ccx_prefs.GetBool("SplitInputWriter", False)
obj.SplitInputWriter = split
@@ -124,28 +194,84 @@ class _FemSolverCalculix():
'D_D': 1.5,
'W_G': None}
p = ccx_default_time_incrementation_control_parameter
p_iter = '{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}'.format(p['I_0'], p['I_R'], p['I_P'], p['I_C'], p['I_L'], p['I_G'], '', p['I_A'], '', '')
p_cutb = '{0},{1},{2},{3},{4},{5},{6},{7}'.format(p['D_f'], p['D_C'], p['D_B'], p['D_A'], '', '', p['D_D'], '')
obj.addProperty("App::PropertyString", "IterationsControlParameterIter", "Fem", "User defined time incrementation iterations control parameter")
p_iter = '{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}'.format(
p['I_0'],
p['I_R'],
p['I_P'],
p['I_C'],
p['I_L'],
p['I_G'],
'',
p['I_A'],
'',
''
)
p_cutb = '{0},{1},{2},{3},{4},{5},{6},{7}'.format(
p['D_f'],
p['D_C'],
p['D_B'],
p['D_A'],
'',
'',
p['D_D'],
''
)
obj.addProperty(
"App::PropertyString",
"IterationsControlParameterIter",
"Fem",
"User defined time incrementation iterations control parameter"
)
obj.IterationsControlParameterIter = p_iter
obj.addProperty("App::PropertyString", "IterationsControlParameterCutb", "Fem", "User defined time incrementation cutbacks control parameter")
obj.addProperty(
"App::PropertyString",
"IterationsControlParameterCutb",
"Fem",
"User defined time incrementation cutbacks control parameter"
)
obj.IterationsControlParameterCutb = p_cutb
stringIterationsUserDefinedIncrementations = "Set to True to switch off the ccx automatic incrementation completely (ccx parameter DIRECT). Use with care. Analysis may not converge!"
obj.addProperty("App::PropertyBool", "IterationsUserDefinedIncrementations", "Fem", stringIterationsUserDefinedIncrementations)
stringIterationsUserDefinedIncrementations = (
"Set to True to switch off the ccx automatic incrementation completely "
"(ccx parameter DIRECT). Use with care. Analysis may not converge!"
)
obj.addProperty(
"App::PropertyBool",
"IterationsUserDefinedIncrementations",
"Fem",
stringIterationsUserDefinedIncrementations
)
obj.IterationsUserDefinedIncrementations = False
infoIterationsUserDefinedTimeStepLength = "Set to True to use the user defined time steps. The time steps are set with TimeInitialStep and TimeEnd"
obj.addProperty("App::PropertyBool", "IterationsUserDefinedTimeStepLength", "Fem", infoIterationsUserDefinedTimeStepLength)
infoIterationsUserDefinedTimeStepLength = (
"Set to True to use the user defined time steps. "
"The time steps are set with TimeInitialStep and TimeEnd"
)
obj.addProperty(
"App::PropertyBool",
"IterationsUserDefinedTimeStepLength",
"Fem",
infoIterationsUserDefinedTimeStepLength
)
obj.IterationsUserDefinedTimeStepLength = False
known_ccx_solver_types = ["default", "spooles", "iterativescaling", "iterativecholesky"]
obj.addProperty("App::PropertyEnumeration", "MatrixSolverType", "Fem", "Type of solver to use")
obj.addProperty(
"App::PropertyEnumeration",
"MatrixSolverType",
"Fem",
"Type of solver to use"
)
obj.MatrixSolverType = known_ccx_solver_types
solver_type = ccx_prefs.GetInt("Solver", 0)
obj.MatrixSolverType = known_ccx_solver_types[solver_type]
obj.addProperty("App::PropertyBool", "BeamShellResultOutput3D", "Fem", "Output 3D results for 1D and 2D analysis ")
obj.addProperty(
"App::PropertyBool",
"BeamShellResultOutput3D",
"Fem",
"Output 3D results for 1D and 2D analysis "
)
dimout = ccx_prefs.GetBool("BeamShellOutput", False)
obj.BeamShellResultOutput3D = dimout