FEM: reformat codebase
This commit is contained in:
@@ -63,6 +63,7 @@ def setup_boxanalysisbase(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_boxanalysis_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -37,12 +37,14 @@ def get_information():
|
||||
"constraints": [],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["frequency"]
|
||||
"equations": ["frequency"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.boxanalysis_frequency import setup
|
||||
@@ -53,6 +55,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -72,7 +75,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj.AnalysisType = "frequency"
|
||||
solver_obj.GeometricalNonlinearity = "linear"
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force", "pressure"],
|
||||
"solvers": ["ccxtools", "elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.boxanalysis_static import setup
|
||||
@@ -55,6 +57,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -75,7 +78,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "elmer":
|
||||
solver_obj = ObjectsFem.makeSolverElmer(doc, "SolverElmer")
|
||||
ObjectsFem.makeEquationElasticity(doc, solver_obj)
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["displacement", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["buckling"]
|
||||
"equations": ["buckling"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.buckling_lateraltorsionalbuckling import setup
|
||||
@@ -65,6 +67,7 @@ flange load for a buckling factor of 1.00:
|
||||
43280000 Nmm / 278.6 mm = 155348 N
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -108,7 +111,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -125,10 +128,10 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# shell thicknesses
|
||||
thickness_flanges = ObjectsFem.makeElementGeometry2D(doc, 10.7, 'Thickness_Flanges')
|
||||
thickness_flanges = ObjectsFem.makeElementGeometry2D(doc, 10.7, "Thickness_Flanges")
|
||||
thickness_flanges.References = [(geom_obj, ("Face1", "Face2", "Face3", "Face4"))]
|
||||
analysis.addObject(thickness_flanges)
|
||||
thickness_web = ObjectsFem.makeElementGeometry2D(doc, 7.1, 'Thickness_Web')
|
||||
thickness_web = ObjectsFem.makeElementGeometry2D(doc, 7.1, "Thickness_Web")
|
||||
thickness_web.References = [(geom_obj, "Face5")]
|
||||
analysis.addObject(thickness_web)
|
||||
|
||||
@@ -173,6 +176,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_buckling_ibeam_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["displacement", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["buckling"]
|
||||
"equations": ["buckling"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.buckling_platebuckling import setup
|
||||
@@ -55,6 +57,7 @@ See forum topic post:
|
||||
https://forum.freecad.org/viewtopic.php?f=18&t=20217&start=110#p509935
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -82,7 +85,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -100,7 +103,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# shell thickness
|
||||
thickness_obj = ObjectsFem.makeElementGeometry2D(doc, 50, 'Thickness')
|
||||
thickness_obj = ObjectsFem.makeElementGeometry2D(doc, 50, "Thickness")
|
||||
analysis.addObject(thickness_obj)
|
||||
|
||||
# material
|
||||
@@ -146,6 +149,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_buckling_plate_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -40,12 +40,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["buckling"]
|
||||
"equations": ["buckling"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_buckling_flexuralbuckling import setup
|
||||
@@ -59,6 +61,7 @@ This example is based on a CalculiX verification example.
|
||||
http://www.feacluster.com/CalculiX/ccx_2.13/doc/ccx/input_deck_viewer.php?input_deck=beam8b.inp
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -87,7 +90,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver,
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -126,6 +129,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_flexural_buckling import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -69,7 +69,7 @@ def setup_cantilever_base_edge(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "mystran":
|
||||
solver_obj = ObjectsFem.makeSolverMystran(doc, "SolverMystran")
|
||||
else:
|
||||
@@ -92,7 +92,7 @@ def setup_cantilever_base_edge(doc=None, solvertype="ccxtools"):
|
||||
sectiontype="Rectangular",
|
||||
width=1000.0,
|
||||
height=1000.0,
|
||||
name="BeamCrossSection"
|
||||
name="BeamCrossSection",
|
||||
)
|
||||
analysis.addObject(beamsection_obj)
|
||||
|
||||
@@ -113,13 +113,14 @@ def setup_cantilever_base_edge(doc=None, solvertype="ccxtools"):
|
||||
# constraint force
|
||||
con_force = ObjectsFem.makeConstraintForce(doc, "ConstraintForce")
|
||||
con_force.References = [(geom_obj, "Vertex2")]
|
||||
con_force.Force = "9000000.0 N" # 9 MN
|
||||
con_force.Force = "9000000.0 N" # 9 MN
|
||||
con_force.Direction = (load_line, ["Edge1"])
|
||||
con_force.Reversed = False
|
||||
analysis.addObject(con_force)
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_canticcx_seg3 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -58,7 +58,7 @@ def setup_cantilever_base_face(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "mystran":
|
||||
solver_obj = ObjectsFem.makeSolverMystran(doc, "SolverMystran")
|
||||
elif solvertype == "z88":
|
||||
@@ -78,7 +78,7 @@ def setup_cantilever_base_face(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# shell thickness
|
||||
thickness_obj = ObjectsFem.makeElementGeometry2D(doc, 1000, 'Thickness')
|
||||
thickness_obj = ObjectsFem.makeElementGeometry2D(doc, 1000, "Thickness")
|
||||
analysis.addObject(thickness_obj)
|
||||
|
||||
# material
|
||||
@@ -105,6 +105,7 @@ def setup_cantilever_base_face(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_canticcx_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -54,7 +54,7 @@ def setup_cantilever_base_solid(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "elmer":
|
||||
solver_obj = ObjectsFem.makeSolverElmer(doc, "SolverElmer")
|
||||
ObjectsFem.makeEquationElasticity(doc, solver_obj)
|
||||
@@ -92,6 +92,7 @@ def setup_cantilever_base_solid(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_canticcx_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -36,12 +36,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_beam_circle import setup
|
||||
@@ -73,6 +75,7 @@ CalculiX FEM max deflection:
|
||||
- Delta ca. 1.5 %
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -36,12 +36,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_beam_pipe import setup
|
||||
@@ -77,6 +79,7 @@ CalculiX FEM max deflection:
|
||||
- Delta ca. 1.0 %
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -36,12 +36,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_beam_rect import setup
|
||||
@@ -74,6 +76,7 @@ CalculiX FEM max deflection:
|
||||
- but the rotation seems 90 degree rotated (FIXME)
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -40,12 +40,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "elmer", "z88"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_hexa20 import setup
|
||||
@@ -57,6 +59,7 @@ hexa20 elements and face load
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -80,6 +83,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# load the hexa20 mesh
|
||||
from .meshes.mesh_canticcx_hexa20 import create_nodes, create_elements
|
||||
|
||||
new_fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(new_fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "mystran"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_quad4 import setup
|
||||
@@ -57,6 +59,7 @@ See forum topic post:
|
||||
CalculiX cantilever modeled with quad4 face elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -76,6 +79,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# load the quad4 mesh
|
||||
from .meshes.mesh_canticcx_quad4 import create_nodes, create_elements
|
||||
|
||||
new_fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(new_fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_quad8 import setup
|
||||
@@ -57,6 +59,7 @@ See forum topic post:
|
||||
CalculiX cantilever modeled with quad8 face elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -76,6 +79,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# load the quad8 mesh
|
||||
from .meshes.mesh_canticcx_quad8 import create_nodes, create_elements
|
||||
|
||||
new_fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(new_fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "mystran"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_seg2 import setup
|
||||
@@ -57,6 +59,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=16044
|
||||
CalculiX cantilever modeled with seg2 beam elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -76,6 +79,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# load the seg2 mesh
|
||||
from .meshes.mesh_canticcx_seg2 import create_nodes, create_elements
|
||||
|
||||
new_fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(new_fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -34,12 +34,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_seg3 import setup
|
||||
@@ -52,6 +54,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=16044
|
||||
CalculiX cantilever modeled with seg3 beam elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -38,12 +38,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "elmer", "mystran", "z88"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_tetra4 import setup
|
||||
@@ -55,6 +57,7 @@ Mesh before run the example.
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "mystran"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_tria3 import setup
|
||||
@@ -57,6 +59,7 @@ See forum topic post:
|
||||
CalculiX cantilever modeled with tria3 face elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -76,6 +79,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# load the tria3 mesh
|
||||
from .meshes.mesh_canticcx_tria3 import create_nodes, create_elements
|
||||
|
||||
new_fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(new_fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -34,12 +34,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "z88"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_ele_tria6 import setup
|
||||
@@ -51,6 +53,7 @@ See forum topic post:
|
||||
CalculiX cantilever modeled with face elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -37,12 +37,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "elmer", "mystran", "z88"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_faceload import setup
|
||||
@@ -53,6 +55,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -37,12 +37,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "elmer", "mystran", "z88"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_nodeload import setup
|
||||
@@ -53,6 +55,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -76,7 +79,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geom_obj, "Vertex5"),
|
||||
(geom_obj, "Vertex6"),
|
||||
(geom_obj, "Vertex7"),
|
||||
(geom_obj, "Vertex8")
|
||||
(geom_obj, "Vertex8"),
|
||||
]
|
||||
con_force.Force = "9000000.0 N"
|
||||
con_force.Direction = (doc.Box, ["Edge5"])
|
||||
|
||||
@@ -37,12 +37,14 @@ def get_information():
|
||||
"constraints": ["fixed", "displacement"],
|
||||
"solvers": ["ccxtools", "elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.ccx_cantilever_prescribeddisplacement import setup
|
||||
@@ -53,6 +55,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
@@ -44,12 +44,14 @@ def get_information():
|
||||
"constraints": ["centrif", "fixed"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "multimaterial",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_centrif import setup
|
||||
@@ -62,6 +64,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=57770
|
||||
constraint centrif, concerning CENTRIF label from ccx's *DLOAD card
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -129,7 +132,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -178,6 +181,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_constraint_centrif_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force", "contact"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_contact_shell_shell import setup
|
||||
@@ -62,6 +64,7 @@ based on https://forum.freecad.org/viewtopic.php?f=18&t=42228#p359488
|
||||
contact example shell to shell elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -109,7 +112,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
force_point.ViewObject.PointColor = (1.0, 0.0, 0.0)
|
||||
|
||||
# boolean fragment of upper tubo and force point
|
||||
boolfrag = SplitFeatures.makeBooleanFragments(name='BooleanFragments')
|
||||
boolfrag = SplitFeatures.makeBooleanFragments(name="BooleanFragments")
|
||||
boolfrag.Objects = [upper_tube, force_point]
|
||||
if FreeCAD.GuiUp:
|
||||
upper_tube.ViewObject.hide()
|
||||
@@ -138,7 +141,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -156,7 +159,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# shell thickness
|
||||
shell_thick = ObjectsFem.makeElementGeometry2D(doc, 0.5, 'ShellThickness')
|
||||
shell_thick = ObjectsFem.makeElementGeometry2D(doc, 0.5, "ShellThickness")
|
||||
analysis.addObject(shell_thick)
|
||||
|
||||
# material
|
||||
@@ -197,6 +200,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_contact_tube_tube_tria3 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -44,12 +44,14 @@ def get_information():
|
||||
"constraints": ["fixed", "pressure", "contact"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_contact_solid_solid import setup
|
||||
@@ -61,6 +63,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=20276
|
||||
constraint contact for solid to solid mesh
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -91,7 +94,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
top_halfcyl_obj.Radius = 30
|
||||
top_halfcyl_obj.Height = 500
|
||||
top_halfcyl_obj.Angle = 180
|
||||
top_halfcyl_sh = Part.getShape(top_halfcyl_obj, '', needSubElement=False, refine=True)
|
||||
top_halfcyl_sh = Part.getShape(top_halfcyl_obj, "", needSubElement=False, refine=True)
|
||||
top_halfcyl_obj.Shape = top_halfcyl_sh
|
||||
top_halfcyl_obj.Placement = FreeCAD.Placement(
|
||||
Vector(0, -42, 0),
|
||||
@@ -118,7 +121,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -180,7 +183,11 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(con_contact)
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_contact_box_halfcylinder_tetra10 import create_nodes, create_elements
|
||||
from .meshes.mesh_contact_box_halfcylinder_tetra10 import (
|
||||
create_nodes,
|
||||
create_elements,
|
||||
)
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -50,12 +50,14 @@ def get_information():
|
||||
"constraints": ["section_print", "fixed", "pressure"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_section_print import setup
|
||||
@@ -68,6 +70,7 @@ https://forum.freecad.org/viewtopic.php?t=43044
|
||||
constraint section print with volume elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -83,27 +86,20 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# geometric objects
|
||||
# the part sketch
|
||||
arc_sketch = doc.addObject("Sketcher::SketchObject", "Arc_Sketch")
|
||||
arc_sketch.Placement = FreeCAD.Placement(
|
||||
Vector(0, 0, 0),
|
||||
Rotation(0, 0, 0, 1)
|
||||
)
|
||||
arc_sketch.Placement = FreeCAD.Placement(Vector(0, 0, 0), Rotation(0, 0, 0, 1))
|
||||
arc_sketch.MapMode = "Deactivated"
|
||||
# not the exact geometry which makes a closed wire
|
||||
# exact geometry will be made by the constraints
|
||||
# the order is important for the constraints definition
|
||||
geoList = [
|
||||
Part.ArcOfCircle(
|
||||
Part.Circle(Vector(0, 0, 0), Vector(0, 0, 1), 47),
|
||||
0,
|
||||
math.pi
|
||||
),
|
||||
Part.ArcOfCircle(Part.Circle(Vector(0, 0, 0), Vector(0, 0, 1), 47), 0, math.pi),
|
||||
Part.ArcOfCircle(
|
||||
Part.Circle(Vector(-19, -22, 0), Vector(0, 0, 1), 89),
|
||||
math.pi / 12,
|
||||
math.pi / 1.1
|
||||
math.pi / 1.1,
|
||||
),
|
||||
Part.LineSegment(Vector(-105, 0, 0), Vector(-47, 0, 0)),
|
||||
Part.LineSegment(Vector(47, 0, 0), Vector(67, 0, 0))
|
||||
Part.LineSegment(Vector(47, 0, 0), Vector(67, 0, 0)),
|
||||
]
|
||||
arc_sketch.addGeometry(geoList, False)
|
||||
# https://wiki.freecad.org/Sketcher_ConstrainCoincident
|
||||
@@ -122,7 +118,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
Sketcher.Constraint("DistanceX", 2, 2, 2, 1, 58),
|
||||
Sketcher.Constraint("DistanceX", 3, 2, 3, 1, 20),
|
||||
Sketcher.Constraint("Radius", 0, 47),
|
||||
Sketcher.Constraint("Radius", 1, 89)
|
||||
Sketcher.Constraint("Radius", 1, 89),
|
||||
]
|
||||
arc_sketch.addConstraint(conList)
|
||||
|
||||
@@ -144,12 +140,12 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
section_sketch = doc.addObject("Sketcher::SketchObject", "Section_Sketch")
|
||||
section_sketch.Placement = FreeCAD.Placement(
|
||||
Vector(0.000000, 0.000000, 0.000000),
|
||||
Rotation(0.000000, 0.000000, 0.000000, 1.000000)
|
||||
Rotation(0.000000, 0.000000, 0.000000, 1.000000),
|
||||
)
|
||||
section_sketch.MapMode = "Deactivated"
|
||||
section_sketch.addGeometry(
|
||||
Part.LineSegment(Vector(-6.691961, -16.840161, 0), Vector(75.156087, 79.421394, 0)),
|
||||
False
|
||||
False,
|
||||
)
|
||||
# section_sketch.ExternalGeometry = extrude_part
|
||||
|
||||
@@ -223,7 +219,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -266,6 +262,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_section_print_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed", "self weight"],
|
||||
"solvers": ["ccxtools", "elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_selfweight_cantilever import setup
|
||||
@@ -59,6 +61,7 @@ l = 32 m, yields just from self weight, means max sigma around 235 n/mm2
|
||||
max deformation = 576.8 mm
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -86,7 +89,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "elmer":
|
||||
solver_obj = ObjectsFem.makeSolverElmer(doc, "SolverElmer")
|
||||
eq_obj = ObjectsFem.makeEquationElasticity(doc, solver_obj)
|
||||
@@ -127,6 +130,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_selfweight_cantilever_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -44,12 +44,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force", "tie"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_tie import setup
|
||||
@@ -62,6 +64,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=42783
|
||||
constraint tie, bond two surfaces together (solid mesh only)
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -108,7 +111,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -156,6 +159,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_constraint_tie_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -44,12 +44,14 @@ def get_information():
|
||||
"constraints": ["pressure", "displacement", "transform"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_transform_beam_hinged import setup
|
||||
@@ -62,6 +64,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=20238#p157643
|
||||
Constraint transform on a beam
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -83,7 +86,9 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
cylinder.Height = "20 mm"
|
||||
cylinder.Radius = "6 mm"
|
||||
cylinder.Placement = FreeCAD.Placement(
|
||||
Vector(10, 12, 10), Rotation(0, 0, 90), Vector(0, 0, 0),
|
||||
Vector(10, 12, 10),
|
||||
Rotation(0, 0, 90),
|
||||
Vector(0, 0, 0),
|
||||
)
|
||||
cut = doc.addObject("Part::Cut", "Cut")
|
||||
cut.Base = cube
|
||||
@@ -102,9 +107,9 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
fusion.Refine = True
|
||||
|
||||
# compound filter
|
||||
geom_obj = CompoundFilter.makeCompoundFilter(name='CompoundFilter')
|
||||
geom_obj = CompoundFilter.makeCompoundFilter(name="CompoundFilter")
|
||||
geom_obj.Base = fusion
|
||||
geom_obj.FilterType = 'window-volume'
|
||||
geom_obj.FilterType = "window-volume"
|
||||
doc.recompute()
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
@@ -118,7 +123,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -169,6 +174,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_transform_beam_hinged_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
@@ -180,7 +186,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
femmesh_obj.FemMesh = fem_mesh
|
||||
femmesh_obj.Part = geom_obj
|
||||
femmesh_obj.SecondOrderLinear = False
|
||||
femmesh_obj.CharacteristicLengthMax = '7 mm'
|
||||
femmesh_obj.CharacteristicLengthMax = "7 mm"
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -52,12 +52,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force", "transform"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.constraint_transform_torque import setup
|
||||
@@ -72,6 +74,7 @@ https://forum.freecad.org/viewtopic.php?t=18970
|
||||
constraint transform with a constraint force
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -115,7 +118,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -160,6 +163,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_transform_torque_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": [],
|
||||
"solvers": ["ccxtools", "elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["elasticity"] # "frequency", but list not allowed here
|
||||
"equations": ["elasticity"], # "frequency", but list not allowed here
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.elmer_nonguitutorial01_eigenvalue_of_elastic_beam import setup
|
||||
@@ -55,6 +57,7 @@ See forum topic post:
|
||||
https://forum.freecad.org/viewtopic.php?t=56590
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -83,7 +86,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "elmer":
|
||||
solver_obj = ObjectsFem.makeSolverElmer(doc, "SolverElmer")
|
||||
eq_obj = ObjectsFem.makeEquationElasticity(doc, solver_obj)
|
||||
@@ -118,15 +121,13 @@ def setup(doc=None, solvertype="elmer"):
|
||||
|
||||
# constraint fixed
|
||||
con_fixed = ObjectsFem.makeConstraintFixed(doc, "ConstraintFixed")
|
||||
con_fixed.References = [
|
||||
(geom_obj, "Face1"),
|
||||
(geom_obj, "Face2")
|
||||
]
|
||||
con_fixed.References = [(geom_obj, "Face1"), (geom_obj, "Face2")]
|
||||
analysis.addObject(con_fixed)
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_eigenvalue_of_elastic_beam_tetra10 import create_nodes
|
||||
from .meshes.mesh_eigenvalue_of_elastic_beam_tetra10 import create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -42,12 +42,14 @@ def get_information():
|
||||
"constraints": ["displacement", "spring"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["deformation"]
|
||||
"equations": ["deformation"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_deformation_spring_elmer import setup
|
||||
@@ -56,6 +58,7 @@ setup()
|
||||
Deformation equation - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -75,18 +78,24 @@ def setup(doc=None, solvertype="elmer"):
|
||||
SketchPath = body.newObject("Sketcher::SketchObject", "Spring_Path")
|
||||
SketchPath.AttachmentSupport = (doc.getObject("XY_Plane"), [""])
|
||||
SketchPath.MapMode = "FlatFace"
|
||||
SketchPath.addGeometry(Part.LineSegment(Vector(
|
||||
-20.0, 30.0, 0.0), Vector(-20.0, 0.0, 0.0)), False)
|
||||
SketchPath.addConstraint(Sketcher.Constraint('PointOnObject', 0, 2, -1))
|
||||
SketchPath.addConstraint(Sketcher.Constraint('Vertical', 0))
|
||||
SketchPath.addGeometry(Part.ArcOfCircle(Part.Circle(
|
||||
Vector(0.0, 0.0, 0.0), Vector(0, 0, 1), 20.0), 3.141593, 6.283185), False)
|
||||
SketchPath.addConstraint(Sketcher.Constraint('Tangent', 0, 2, 1, 1))
|
||||
SketchPath.addConstraint(Sketcher.Constraint('PointOnObject', 1, 2, -1))
|
||||
SketchPath.addGeometry(Part.LineSegment(
|
||||
Vector(20.0, 0.0, 0.0), Vector(20.0, 30.0, 0.0)), False)
|
||||
SketchPath.addConstraint(Sketcher.Constraint('Tangent', 1, 2, 2, 1))
|
||||
SketchPath.addConstraint(Sketcher.Constraint('Equal', 2, 0))
|
||||
SketchPath.addGeometry(
|
||||
Part.LineSegment(Vector(-20.0, 30.0, 0.0), Vector(-20.0, 0.0, 0.0)), False
|
||||
)
|
||||
SketchPath.addConstraint(Sketcher.Constraint("PointOnObject", 0, 2, -1))
|
||||
SketchPath.addConstraint(Sketcher.Constraint("Vertical", 0))
|
||||
SketchPath.addGeometry(
|
||||
Part.ArcOfCircle(
|
||||
Part.Circle(Vector(0.0, 0.0, 0.0), Vector(0, 0, 1), 20.0),
|
||||
3.141593,
|
||||
6.283185,
|
||||
),
|
||||
False,
|
||||
)
|
||||
SketchPath.addConstraint(Sketcher.Constraint("Tangent", 0, 2, 1, 1))
|
||||
SketchPath.addConstraint(Sketcher.Constraint("PointOnObject", 1, 2, -1))
|
||||
SketchPath.addGeometry(Part.LineSegment(Vector(20.0, 0.0, 0.0), Vector(20.0, 30.0, 0.0)), False)
|
||||
SketchPath.addConstraint(Sketcher.Constraint("Tangent", 1, 2, 2, 1))
|
||||
SketchPath.addConstraint(Sketcher.Constraint("Equal", 2, 0))
|
||||
SketchPath.ViewObject.Visibility = False
|
||||
|
||||
# sketch defining the spring cross section
|
||||
@@ -94,11 +103,11 @@ def setup(doc=None, solvertype="elmer"):
|
||||
SketchCircle.AttachmentSupport = (doc.getObject("XZ_Plane"), [""])
|
||||
SketchCircle.MapMode = "FlatFace"
|
||||
SketchCircle.addGeometry(Part.Circle(Vector(-20.0, 0.0, 0.0), Vector(0, 0, 1), 7.5), False)
|
||||
SketchCircle.addConstraint(Sketcher.Constraint('PointOnObject', 0, 3, -1))
|
||||
SketchCircle.addConstraint(Sketcher.Constraint("PointOnObject", 0, 3, -1))
|
||||
SketchCircle.ViewObject.Visibility = False
|
||||
|
||||
# the spring object
|
||||
SpringObject = body.newObject('PartDesign::AdditivePipe', 'Spring')
|
||||
SpringObject = body.newObject("PartDesign::AdditivePipe", "Spring")
|
||||
SpringObject.Profile = SketchCircle
|
||||
SpringObject.Spine = SketchPath
|
||||
|
||||
@@ -112,6 +121,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -148,7 +158,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
DisplaceLeft = doc.addObject("Fem::ConstraintDisplacement", "DisplacementLeft")
|
||||
DisplaceLeft.xFree = False
|
||||
DisplaceLeft.hasXFormula = True
|
||||
DisplaceLeft.xDisplacementFormula = "Variable \"time\"; Real MATC \"0.006*tx\""
|
||||
DisplaceLeft.xDisplacementFormula = 'Variable "time"; Real MATC "0.006*tx"'
|
||||
DisplaceLeft.yFree = False
|
||||
DisplaceLeft.yFix = True
|
||||
DisplaceLeft.zFree = False
|
||||
@@ -159,7 +169,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
DisplaceRight = doc.addObject("Fem::ConstraintDisplacement", "DisplacementRight")
|
||||
DisplaceRight.xFree = False
|
||||
DisplaceRight.hasXFormula = True
|
||||
DisplaceRight.xDisplacementFormula = "Variable \"time\"; Real MATC \"-0.006*tx\""
|
||||
DisplaceRight.xDisplacementFormula = 'Variable "time"; Real MATC "-0.006*tx"'
|
||||
DisplaceRight.yFree = False
|
||||
DisplaceRight.yFix = True
|
||||
DisplaceRight.zFree = False
|
||||
@@ -189,15 +199,13 @@ def setup(doc=None, solvertype="elmer"):
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["electrostatic potential"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "fluid",
|
||||
"equations": ["electrostatic"]
|
||||
"equations": ["electrostatic"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_electrostatics_capacitance_two_balls import setup
|
||||
@@ -61,6 +63,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=41488&start=90#p412047
|
||||
Electrostatics equation in FreeCAD FEM-Elmer
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -102,6 +105,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -174,18 +178,20 @@ def setup(doc=None, solvertype="elmer"):
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
if error:
|
||||
# try to create from existing rough mesh
|
||||
from .meshes.mesh_capacitance_two_balls_tetra10 import create_nodes, create_elements
|
||||
from .meshes.mesh_capacitance_two_balls_tetra10 import (
|
||||
create_nodes,
|
||||
create_elements,
|
||||
)
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -46,12 +46,14 @@ def get_information():
|
||||
"constraints": ["electrostatic potential"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "fluid",
|
||||
"equations": ["electrostatic"]
|
||||
"equations": ["electrostatic"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_electrostatics_electricforce_elmer_nongui6 import setup
|
||||
@@ -64,6 +66,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=41488&start=40#p373292
|
||||
Electrostatics equation in FreeCAD FEM-Elmer
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -86,7 +89,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
Part.LineSegment(Vector(0.000000, 0.000000, 0), Vector(57.407921, 0.000000, 0)),
|
||||
Part.LineSegment(Vector(57.407921, 0.000000, 0), Vector(57.407921, 35.205284, 0)),
|
||||
Part.LineSegment(Vector(57.407921, 35.205284, 0), Vector(0.000000, 35.205284, 0)),
|
||||
Part.LineSegment(Vector(0.000000, 35.205284, 0), Vector(0.000000, 0.000000, 0))]
|
||||
Part.LineSegment(Vector(0.000000, 35.205284, 0), Vector(0.000000, 0.000000, 0)),
|
||||
]
|
||||
base_sketch.addGeometry(base_geoList, False)
|
||||
base_conList = [
|
||||
Sketcher.Constraint("Coincident", 0, 2, 1, 1),
|
||||
@@ -99,7 +103,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
Sketcher.Constraint("Vertical", 3),
|
||||
Sketcher.Constraint("Coincident", 0, 1, -1, 1),
|
||||
Sketcher.Constraint("DistanceY", 1, 1, 1, 2, 35.205284),
|
||||
Sketcher.Constraint("DistanceX", 0, 1, 0, 2, 57.407921)]
|
||||
Sketcher.Constraint("DistanceX", 0, 1, 0, 2, 57.407921),
|
||||
]
|
||||
base_sketch.addConstraint(base_conList)
|
||||
base_sketch.setDatum(9, Units.Quantity("5000.000000 mm"))
|
||||
base_sketch.setDatum(10, Units.Quantity("5000.000000 mm"))
|
||||
@@ -120,7 +125,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
Part.LineSegment(Vector(5037.082520, 0.000000, 0), Vector(1309.763672, -21.422216, 0)),
|
||||
Part.LineSegment(Vector(1309.763672, 0.000000, 0), Vector(1372.406982, 1544.678467, 0)),
|
||||
Part.LineSegment(Vector(1372.406982, 1544.678467, 0), Vector(-37.083382, 1544.678467, 0)),
|
||||
Part.LineSegment(Vector(0.000000, 1544.678467, 0), Vector(25.560951, 4958.778320, 0))]
|
||||
Part.LineSegment(Vector(0.000000, 1544.678467, 0), Vector(25.560951, 4958.778320, 0)),
|
||||
]
|
||||
upper_sketch.addGeometry(upper_geoList, False)
|
||||
upper_conList = [
|
||||
Sketcher.Constraint("Horizontal", 0),
|
||||
@@ -140,7 +146,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
Sketcher.Constraint("DistanceX", 0, 1, 0, 2, 5037.082520),
|
||||
Sketcher.Constraint("DistanceY", 1, 2, 1, 1, 4958.778320),
|
||||
Sketcher.Constraint("DistanceY", 3, 1, 3, 2, 1544.678467),
|
||||
Sketcher.Constraint("DistanceX", 4, 2, 4, 1, 1309.763672)]
|
||||
Sketcher.Constraint("DistanceX", 4, 2, 4, 1, 1309.763672),
|
||||
]
|
||||
upper_sketch.addConstraint(upper_conList)
|
||||
upper_sketch.setDatum(14, Units.Quantity("5000.000000 mm"))
|
||||
upper_sketch.setDatum(15, Units.Quantity("5000.000000 mm"))
|
||||
@@ -163,6 +170,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -209,7 +217,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(geom_obj, "Face4"),
|
||||
(geom_obj, "Face5"),
|
||||
(geom_obj, "Face6"),
|
||||
(geom_obj, "Face11")]
|
||||
(geom_obj, "Face11"),
|
||||
]
|
||||
con_elect_pot2.Potential = "1 V"
|
||||
con_elect_pot2.CapacitanceBody = 2
|
||||
con_elect_pot2.CapacitanceBodyEnabled = True
|
||||
@@ -231,23 +240,26 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(geom_obj, "Face4"),
|
||||
(geom_obj, "Face5"),
|
||||
(geom_obj, "Face6"),
|
||||
(geom_obj, "Face11")]
|
||||
(geom_obj, "Face11"),
|
||||
]
|
||||
mesh_region.ViewObject.Visibility = False
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
if error:
|
||||
# try to create from existing rough mesh
|
||||
from .meshes.mesh_electricforce_elmer_nongui6_tetra10 import create_nodes, create_elements
|
||||
from .meshes.mesh_electricforce_elmer_nongui6_tetra10 import (
|
||||
create_nodes,
|
||||
create_elements,
|
||||
)
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -41,16 +41,22 @@ def get_information():
|
||||
"name": "Flow - Elmer 2D",
|
||||
"meshtype": "solid",
|
||||
"meshelement": "Tet10",
|
||||
"constraints": ["initial pressure", "initial temperature",
|
||||
"temperature", "velocity"],
|
||||
"constraints": [
|
||||
"initial pressure",
|
||||
"initial temperature",
|
||||
"temperature",
|
||||
"velocity",
|
||||
],
|
||||
"solvers": ["elmer"],
|
||||
"material": "fluid",
|
||||
"equations": ["flow", "heat"]
|
||||
"equations": ["flow", "heat"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_flow_elmer_2D import setup
|
||||
@@ -59,6 +65,7 @@ setup()
|
||||
Flow and Heat equation - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -118,6 +125,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -185,7 +193,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
FlowVelocity_Inlet = ObjectsFem.makeConstraintFlowVelocity(doc, "FlowVelocity_Inlet")
|
||||
FlowVelocity_Inlet.References = [(BooleanFragments, "Edge5")]
|
||||
FlowVelocity_Inlet.VelocityXFormula = (
|
||||
"Variable Coordinate 2; Real MATC \"10*(tx+50e-3)*(50e-3-tx)\""
|
||||
'Variable Coordinate 2; Real MATC "10*(tx+50e-3)*(50e-3-tx)"'
|
||||
)
|
||||
FlowVelocity_Inlet.VelocityXUnspecified = False
|
||||
FlowVelocity_Inlet.VelocityXHasFormula = True
|
||||
@@ -198,7 +206,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge2"),
|
||||
(BooleanFragments, "Edge3"),
|
||||
(BooleanFragments, "Edge4"),
|
||||
(BooleanFragments, "Edge7")]
|
||||
(BooleanFragments, "Edge7"),
|
||||
]
|
||||
FlowVelocity_Wall.VelocityXUnspecified = False
|
||||
FlowVelocity_Wall.VelocityYUnspecified = False
|
||||
analysis.addObject(FlowVelocity_Wall)
|
||||
@@ -216,7 +225,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge2"),
|
||||
(BooleanFragments, "Edge3"),
|
||||
(BooleanFragments, "Edge4"),
|
||||
(BooleanFragments, "Edge7")]
|
||||
(BooleanFragments, "Edge7"),
|
||||
]
|
||||
analysis.addObject(Temperature_Wall)
|
||||
|
||||
# constraint inlet temperature
|
||||
@@ -254,20 +264,19 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge1"),
|
||||
(BooleanFragments, "Vertex2"),
|
||||
(BooleanFragments, "Vertex4"),
|
||||
(BooleanFragments, "Vertex6")]
|
||||
(BooleanFragments, "Vertex6"),
|
||||
]
|
||||
mesh_region.ViewObject.Visibility = False
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -41,16 +41,23 @@ def get_information():
|
||||
"name": "Initial Flow - Elmer 2D",
|
||||
"meshtype": "solid",
|
||||
"meshelement": "Tet10",
|
||||
"constraints": ["initial pressure", "initial temperature", "initial velocity",
|
||||
"temperature", "velocity"],
|
||||
"constraints": [
|
||||
"initial pressure",
|
||||
"initial temperature",
|
||||
"initial velocity",
|
||||
"temperature",
|
||||
"velocity",
|
||||
],
|
||||
"solvers": ["elmer"],
|
||||
"material": "fluid",
|
||||
"equations": ["flow", "heat"]
|
||||
"equations": ["flow", "heat"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_flow_initial_elmer_2D import setup
|
||||
@@ -59,6 +66,7 @@ setup()
|
||||
Flow and Heat equation with initial velocity - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -118,6 +126,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -196,7 +205,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge2"),
|
||||
(BooleanFragments, "Edge3"),
|
||||
(BooleanFragments, "Edge4"),
|
||||
(BooleanFragments, "Edge7")]
|
||||
(BooleanFragments, "Edge7"),
|
||||
]
|
||||
FlowVelocity_Wall.VelocityXUnspecified = False
|
||||
FlowVelocity_Wall.VelocityYUnspecified = False
|
||||
analysis.addObject(FlowVelocity_Wall)
|
||||
@@ -223,7 +233,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge2"),
|
||||
(BooleanFragments, "Edge3"),
|
||||
(BooleanFragments, "Edge4"),
|
||||
(BooleanFragments, "Edge7")]
|
||||
(BooleanFragments, "Edge7"),
|
||||
]
|
||||
analysis.addObject(Temperature_Wall)
|
||||
|
||||
# constraint inlet temperature
|
||||
@@ -261,20 +272,19 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge1"),
|
||||
(BooleanFragments, "Vertex2"),
|
||||
(BooleanFragments, "Vertex4"),
|
||||
(BooleanFragments, "Vertex6")]
|
||||
(BooleanFragments, "Vertex6"),
|
||||
]
|
||||
mesh_region.ViewObject.Visibility = False
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -41,16 +41,22 @@ def get_information():
|
||||
"name": "Turbulent Flow - Elmer 2D",
|
||||
"meshtype": "solid",
|
||||
"meshelement": "Tet10",
|
||||
"constraints": ["initial pressure", "initial temperature",
|
||||
"temperature", "velocity"],
|
||||
"constraints": [
|
||||
"initial pressure",
|
||||
"initial temperature",
|
||||
"temperature",
|
||||
"velocity",
|
||||
],
|
||||
"solvers": ["elmer"],
|
||||
"material": "fluid",
|
||||
"equations": ["flow", "heat"]
|
||||
"equations": ["flow", "heat"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_flow_turbulent_elmer_2D import setup
|
||||
@@ -59,6 +65,7 @@ setup()
|
||||
Flow and Heat equation in turbulent flow - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -118,6 +125,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -191,7 +199,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
FlowVelocity_Inlet = ObjectsFem.makeConstraintFlowVelocity(doc, "FlowVelocity_Inlet")
|
||||
FlowVelocity_Inlet.References = [(BooleanFragments, "Edge5")]
|
||||
FlowVelocity_Inlet.VelocityXFormula = (
|
||||
"Variable Coordinate 2; Real MATC \"10*(tx+50e-3)*(50e-3-tx)\""
|
||||
'Variable Coordinate 2; Real MATC "10*(tx+50e-3)*(50e-3-tx)"'
|
||||
)
|
||||
FlowVelocity_Inlet.VelocityXUnspecified = False
|
||||
FlowVelocity_Inlet.VelocityXHasFormula = True
|
||||
@@ -204,7 +212,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge2"),
|
||||
(BooleanFragments, "Edge3"),
|
||||
(BooleanFragments, "Edge4"),
|
||||
(BooleanFragments, "Edge7")]
|
||||
(BooleanFragments, "Edge7"),
|
||||
]
|
||||
FlowVelocity_Wall.VelocityXUnspecified = False
|
||||
FlowVelocity_Wall.VelocityYUnspecified = False
|
||||
analysis.addObject(FlowVelocity_Wall)
|
||||
@@ -222,7 +231,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge2"),
|
||||
(BooleanFragments, "Edge3"),
|
||||
(BooleanFragments, "Edge4"),
|
||||
(BooleanFragments, "Edge7")]
|
||||
(BooleanFragments, "Edge7"),
|
||||
]
|
||||
analysis.addObject(Temperature_Wall)
|
||||
|
||||
# constraint inlet temperature
|
||||
@@ -260,20 +270,19 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Edge1"),
|
||||
(BooleanFragments, "Vertex2"),
|
||||
(BooleanFragments, "Vertex4"),
|
||||
(BooleanFragments, "Vertex6")]
|
||||
(BooleanFragments, "Vertex6"),
|
||||
]
|
||||
mesh_region.ViewObject.Visibility = False
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -40,12 +40,14 @@ def get_information():
|
||||
"constraints": ["electrostatic potential", "temperature"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["electrostatic", "flux", "heat"]
|
||||
"equations": ["electrostatic", "flux", "heat"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_flux_elmer import setup
|
||||
@@ -54,6 +56,7 @@ setup()
|
||||
Potential flux and heat flux - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -80,6 +83,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -155,15 +159,13 @@ def setup(doc=None, solvertype="elmer"):
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["current density"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["electromagnetic"]
|
||||
"equations": ["electromagnetic"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_magnetodynamics_2D_elmer import setup
|
||||
@@ -57,6 +59,7 @@ setup()
|
||||
Magnetodynamic2D equation - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -120,8 +123,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
Powder.ViewObject.Visibility = False
|
||||
|
||||
# a half circle defining later the air volume
|
||||
Air_Circle = Part.makeCircle(
|
||||
140.0, Vector(0.0, 60.0, 0.0), Vector(0.0, 0.0, 1.0), -90.0, 90.0)
|
||||
Air_Circle = Part.makeCircle(140.0, Vector(0.0, 60.0, 0.0), Vector(0.0, 0.0, 1.0), -90.0, 90.0)
|
||||
Air_Line = Part.makeLine((0.0, -80.0, 0.0), (0.0, 200.0, 0.0))
|
||||
Air_Area = doc.addObject("Part::Feature", "Air_Area")
|
||||
Air_Area.Shape = Part.Face([Part.Wire([Air_Circle, Air_Line])])
|
||||
@@ -175,6 +177,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -212,7 +215,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
material_obj.References = [
|
||||
(BooleanFragments, "Face2"),
|
||||
(BooleanFragments, "Face5"),
|
||||
(BooleanFragments, "Face6")]
|
||||
(BooleanFragments, "Face6"),
|
||||
]
|
||||
analysis.addObject(material_obj)
|
||||
|
||||
# graphite of the crucible
|
||||
@@ -265,20 +269,19 @@ def setup(doc=None, solvertype="elmer"):
|
||||
(BooleanFragments, "Face1"),
|
||||
(BooleanFragments, "Face2"),
|
||||
(BooleanFragments, "Face3"),
|
||||
(BooleanFragments, "Face4")]
|
||||
(BooleanFragments, "Face4"),
|
||||
]
|
||||
mesh_region.ViewObject.Visibility = False
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -42,12 +42,14 @@ def get_information():
|
||||
"constraints": ["electrostatic potential", "magnetization"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["electromagnetic"]
|
||||
"equations": ["electromagnetic"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_magnetodynamics_elmer import setup
|
||||
@@ -56,6 +58,7 @@ setup()
|
||||
Magnetodynamic equation - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -99,6 +102,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -157,7 +161,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
AxialField.References = [
|
||||
(BooleanFragments, "Face4"),
|
||||
(BooleanFragments, "Face5"),
|
||||
(BooleanFragments, "Face6")]
|
||||
(BooleanFragments, "Face6"),
|
||||
]
|
||||
AxialField.PotentialEnabled = False
|
||||
AxialField.AV_im_1_Disabled = False
|
||||
AxialField.AV_im_2_Disabled = False
|
||||
@@ -209,18 +214,20 @@ def setup(doc=None, solvertype="elmer"):
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
if error:
|
||||
# try to create from existing rough mesh
|
||||
from .meshes.mesh_capacitance_two_balls_tetra10 import create_nodes, create_elements
|
||||
from .meshes.mesh_capacitance_two_balls_tetra10 import (
|
||||
create_nodes,
|
||||
create_elements,
|
||||
)
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["magnetization"],
|
||||
"solvers": ["elmer"],
|
||||
"material": "solid",
|
||||
"equations": ["magnetostatic"]
|
||||
"equations": ["magnetostatic"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.equation_magnetostatics_2D_elmer import setup
|
||||
@@ -57,6 +59,7 @@ setup()
|
||||
Magnetodynamic2D equation - Elmer solver
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="elmer"):
|
||||
@@ -93,25 +96,43 @@ def setup(doc=None, solvertype="elmer"):
|
||||
|
||||
# the U-part of the horse shoe
|
||||
# credits: https://forum.freecad.org/viewtopic.php?p=663051#p663051
|
||||
vpairs = [[Vector(340.0, 200.0, 0.0), Vector(200.0, 200.0, 0.0)],
|
||||
[Vector(200.0, 200.0, 0.0), Vector(200.0, 100.0, 0.0)],
|
||||
[Vector(200.0, 100.0, 0.0), Vector(325.0, 100.0, 0.0)],
|
||||
[Vector(325.0, 100.0, 0.0), Vector(325.0, -100.0, 0.0)],
|
||||
[Vector(325.0, -100.0, 0.0), Vector(200.0, -100.0, 0.0)],
|
||||
[Vector(200.0, -100.0, 0.0), Vector(200.0, -200.0, 0.0)],
|
||||
[Vector(200.0, -200.0, 0.0), Vector(340.0, -200.0, 0.0)],
|
||||
[Vector(340.0, 200.0, 0.0), Vector(340.0, -200.0, 0.0)]]
|
||||
typeId = ['Part::GeomLine', 'Part::GeomLine', 'Part::GeomLine', 'Part::GeomBSplineCurve',
|
||||
'Part::GeomLine', 'Part::GeomLine', 'Part::GeomLine', 'Part::GeomBSplineCurve']
|
||||
e3Poles = [Vector(325.0, 100.0, 0.0), Vector(400.0, 100.0, 0.0),
|
||||
Vector(400.0, 0.0, 0.0), Vector(400.0, -100.0, 0.0),
|
||||
Vector(325.0, -100.0, 0.0)]
|
||||
vpairs = [
|
||||
[Vector(340.0, 200.0, 0.0), Vector(200.0, 200.0, 0.0)],
|
||||
[Vector(200.0, 200.0, 0.0), Vector(200.0, 100.0, 0.0)],
|
||||
[Vector(200.0, 100.0, 0.0), Vector(325.0, 100.0, 0.0)],
|
||||
[Vector(325.0, 100.0, 0.0), Vector(325.0, -100.0, 0.0)],
|
||||
[Vector(325.0, -100.0, 0.0), Vector(200.0, -100.0, 0.0)],
|
||||
[Vector(200.0, -100.0, 0.0), Vector(200.0, -200.0, 0.0)],
|
||||
[Vector(200.0, -200.0, 0.0), Vector(340.0, -200.0, 0.0)],
|
||||
[Vector(340.0, 200.0, 0.0), Vector(340.0, -200.0, 0.0)],
|
||||
]
|
||||
typeId = [
|
||||
"Part::GeomLine",
|
||||
"Part::GeomLine",
|
||||
"Part::GeomLine",
|
||||
"Part::GeomBSplineCurve",
|
||||
"Part::GeomLine",
|
||||
"Part::GeomLine",
|
||||
"Part::GeomLine",
|
||||
"Part::GeomBSplineCurve",
|
||||
]
|
||||
e3Poles = [
|
||||
Vector(325.0, 100.0, 0.0),
|
||||
Vector(400.0, 100.0, 0.0),
|
||||
Vector(400.0, 0.0, 0.0),
|
||||
Vector(400.0, -100.0, 0.0),
|
||||
Vector(325.0, -100.0, 0.0),
|
||||
]
|
||||
e3Knots = [0.0, 0.5, 1.0]
|
||||
e3Mults = [4, 1, 4]
|
||||
e3Degree = 3
|
||||
e7Poles = [Vector(340.0, 200.0, 0.0), Vector(500.0, 200.0, 0.0),
|
||||
Vector(500.0, 0.0, 0.0), Vector(500.0, -200.0, 0.0),
|
||||
Vector(340.0, -200.0, 0.0)]
|
||||
e7Poles = [
|
||||
Vector(340.0, 200.0, 0.0),
|
||||
Vector(500.0, 200.0, 0.0),
|
||||
Vector(500.0, 0.0, 0.0),
|
||||
Vector(500.0, -200.0, 0.0),
|
||||
Vector(340.0, -200.0, 0.0),
|
||||
]
|
||||
e7Knots = [0.0, 0.5, 1.0]
|
||||
e7Mults = [4, 1, 4]
|
||||
e7Degree = 3
|
||||
@@ -121,7 +142,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
c7.buildFromPolesMultsKnots(e7Poles, e7Mults, e7Knots, False, e7Degree)
|
||||
edges = [c3.toShape(), c7.toShape()]
|
||||
for i in range(len(typeId)):
|
||||
if typeId[i] == 'Part::GeomLine':
|
||||
if typeId[i] == "Part::GeomLine":
|
||||
edges.append(Part.makeLine(*vpairs[i]))
|
||||
|
||||
sedges = Part.__sortEdges__(edges)
|
||||
@@ -175,6 +196,7 @@ def setup(doc=None, solvertype="elmer"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
if FreeCAD.GuiUp:
|
||||
import FemGui
|
||||
|
||||
FemGui.setActiveAnalysis(analysis)
|
||||
|
||||
# solver
|
||||
@@ -218,7 +240,8 @@ def setup(doc=None, solvertype="elmer"):
|
||||
material_obj.References = [
|
||||
(BooleanFragments, "Face1"),
|
||||
(BooleanFragments, "Face2"),
|
||||
(BooleanFragments, "Face3")]
|
||||
(BooleanFragments, "Face3"),
|
||||
]
|
||||
analysis.addObject(material_obj)
|
||||
|
||||
# magnetization lower
|
||||
@@ -247,20 +270,19 @@ def setup(doc=None, solvertype="elmer"):
|
||||
mesh_region.References = [
|
||||
(BooleanFragments, "Face1"),
|
||||
(BooleanFragments, "Face2"),
|
||||
(BooleanFragments, "Face3")]
|
||||
(BooleanFragments, "Face3"),
|
||||
]
|
||||
mesh_region.ViewObject.Visibility = False
|
||||
|
||||
# generate the mesh
|
||||
from femmesh import gmshtools
|
||||
|
||||
gmsh_mesh = gmshtools.GmshTools(femmesh_obj, analysis)
|
||||
try:
|
||||
error = gmsh_mesh.create_mesh()
|
||||
except Exception:
|
||||
error = sys.exc_info()[1]
|
||||
FreeCAD.Console.PrintError(
|
||||
"Unexpected error when creating mesh: {}\n"
|
||||
.format(error)
|
||||
)
|
||||
FreeCAD.Console.PrintError(f"Unexpected error when creating mesh: {error}\n")
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
@@ -38,10 +38,12 @@ import FreeCADGui
|
||||
|
||||
class FemExamples(QtGui.QWidget):
|
||||
def __init__(self):
|
||||
super(FemExamples, self).__init__()
|
||||
super().__init__()
|
||||
self.init_ui()
|
||||
|
||||
def __del__(self,):
|
||||
def __del__(
|
||||
self,
|
||||
):
|
||||
# need as fix for qt event error
|
||||
# --> see https://forum.freecad.org/viewtopic.php?f=18&t=10732&start=10#p86493
|
||||
return
|
||||
@@ -205,9 +207,9 @@ class FemExamples(QtGui.QWidget):
|
||||
if grand_parent_name == "Solvers":
|
||||
solver = parent.text(0)
|
||||
# if done this way the Python commands are printed in Python console
|
||||
FreeCADGui.doCommand("from femexamples.{} import setup".format(str(example)))
|
||||
FreeCADGui.doCommand(f"from femexamples.{str(example)} import setup")
|
||||
if solver is not None:
|
||||
FreeCADGui.doCommand("setup(solvertype=\"{}\")".format(str(solver)))
|
||||
FreeCADGui.doCommand(f'setup(solvertype="{str(solver)}")')
|
||||
else:
|
||||
FreeCADGui.doCommand("setup()")
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
@@ -236,10 +238,11 @@ class FemExamples(QtGui.QWidget):
|
||||
# if done this way the Python commands are printed in Python console
|
||||
FreeCADGui.doCommand("from femexamples.manager import run_example")
|
||||
if solver is not None:
|
||||
FreeCADGui.doCommand("run_example(\"{}\", solver=\"{}\", run_solver=True)"
|
||||
.format(str(example), str(solver)))
|
||||
FreeCADGui.doCommand(
|
||||
f'run_example("{str(example)}", solver="{str(solver)}", run_solver=True)'
|
||||
)
|
||||
else:
|
||||
FreeCADGui.doCommand("run_example(\"{}\", run_solver=True)".format(str(example)))
|
||||
FreeCADGui.doCommand(f'run_example("{str(example)}", run_solver=True)')
|
||||
QtGui.QApplication.restoreOverrideCursor()
|
||||
|
||||
def enable_buttons(self):
|
||||
|
||||
@@ -39,12 +39,14 @@ def get_information():
|
||||
"constraints": ["fixed"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["frequency"]
|
||||
"equations": ["frequency"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.frequency_beamsimple import setup
|
||||
@@ -57,6 +59,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=58959#p506565
|
||||
simple frequency analysis
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -85,7 +88,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -104,9 +107,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# material
|
||||
material_obj = analysis.addObject(
|
||||
ObjectsFem.makeMaterialSolid(doc, "MechanicalMaterial")
|
||||
)[0]
|
||||
material_obj = analysis.addObject(ObjectsFem.makeMaterialSolid(doc, "MechanicalMaterial"))[0]
|
||||
mat = material_obj.Material
|
||||
mat["Name"] = "Steel-Generic"
|
||||
mat["YoungsModulus"] = "200000 MPa"
|
||||
@@ -145,6 +146,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_beamsimple_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -148,6 +148,7 @@ def run_analysis(doc, base_name, filepath="", run_solver=False):
|
||||
# find the first solver
|
||||
# thus ATM only one solver per analysis is supported
|
||||
from femtools.femutils import is_derived_from
|
||||
|
||||
for m in doc.Analysis.Group:
|
||||
if is_derived_from(m, "Fem::FemSolverObjectPython"):
|
||||
solver = m
|
||||
@@ -155,17 +156,17 @@ def run_analysis(doc, base_name, filepath="", run_solver=False):
|
||||
|
||||
# a file name is needed for the besides dir to work
|
||||
save_fc_file = join(filepath, (base_name + ".FCStd"))
|
||||
FreeCAD.Console.PrintMessage(
|
||||
"Save FreeCAD file for {} analysis to {}\n.".format(base_name, save_fc_file)
|
||||
)
|
||||
FreeCAD.Console.PrintMessage(f"Save FreeCAD file for {base_name} analysis to {save_fc_file}\n.")
|
||||
doc.saveAs(save_fc_file)
|
||||
|
||||
# get analysis workig dir
|
||||
from femtools.femutils import get_beside_dir
|
||||
|
||||
working_dir = get_beside_dir(solver)
|
||||
|
||||
# run analysis
|
||||
from femsolver.run import run_fem_solver
|
||||
|
||||
if run_solver is True:
|
||||
run_fem_solver(solver, working_dir)
|
||||
|
||||
@@ -176,9 +177,10 @@ def run_analysis(doc, base_name, filepath="", run_solver=False):
|
||||
def run_example(example, solver=None, base_name=None, run_solver=False):
|
||||
|
||||
from importlib import import_module
|
||||
|
||||
module = import_module("femexamples." + example)
|
||||
if not hasattr(module, "setup"):
|
||||
FreeCAD.Console.PrintError("Setup method not found in {}\n".format(example))
|
||||
FreeCAD.Console.PrintError(f"Setup method not found in {example}\n")
|
||||
return None
|
||||
|
||||
if solver is None:
|
||||
@@ -215,7 +217,9 @@ def get_meshname():
|
||||
def get_header(information):
|
||||
return """{name}
|
||||
|
||||
{information}""".format(name=information["name"], information=print_info_dict(information))
|
||||
{information}""".format(
|
||||
name=information["name"], information=print_info_dict(information)
|
||||
)
|
||||
|
||||
|
||||
def print_info_dict(information):
|
||||
@@ -224,11 +228,11 @@ def print_info_dict(information):
|
||||
value_text = ""
|
||||
if isinstance(v, list):
|
||||
for j in v:
|
||||
value_text += "{}, ".format(j)
|
||||
value_text += f"{j}, "
|
||||
value_text = value_text.rstrip(", ")
|
||||
else:
|
||||
value_text = v
|
||||
the_text += "{} --> {}\n".format(k, value_text)
|
||||
the_text += f"{k} --> {value_text}\n"
|
||||
# print(the_text)
|
||||
return the_text
|
||||
|
||||
|
||||
@@ -42,12 +42,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "multimaterial",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.material_multiple_bendingbeam_fiveboxes import setup
|
||||
@@ -58,6 +60,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -124,7 +127,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -179,7 +182,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(doc.Box2, "Face6"),
|
||||
(doc.Box3, "Face6"),
|
||||
(doc.Box4, "Face6"),
|
||||
(doc.Box5, "Face6")
|
||||
(doc.Box5, "Face6"),
|
||||
]
|
||||
con_force.Force = "10000.00 N"
|
||||
con_force.Direction = (doc.Box1, ["Edge1"])
|
||||
@@ -188,6 +191,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_multibodybeam_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -40,12 +40,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "multimaterial",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.material_multiple_bendingbeam_fivefaces import setup
|
||||
@@ -56,6 +58,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -113,7 +116,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -143,10 +146,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(material_obj1)
|
||||
|
||||
material_obj2 = ObjectsFem.makeMaterialSolid(doc, "FemMaterial2")
|
||||
material_obj2.References = [
|
||||
(doc.Face2, "Face1"),
|
||||
(doc.Face4, "Face1")
|
||||
]
|
||||
material_obj2.References = [(doc.Face2, "Face1"), (doc.Face4, "Face1")]
|
||||
mat = material_obj2.Material
|
||||
mat["Name"] = "PLA"
|
||||
mat["YoungsModulus"] = "3640 MPa"
|
||||
@@ -165,10 +165,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# constraint fixed
|
||||
con_fixed = ObjectsFem.makeConstraintFixed(doc, "ConstraintFixed")
|
||||
con_fixed.References = [
|
||||
(doc.Face1, "Edge1"),
|
||||
(doc.Face5, "Edge3")
|
||||
]
|
||||
con_fixed.References = [(doc.Face1, "Edge1"), (doc.Face5, "Edge3")]
|
||||
analysis.addObject(con_fixed)
|
||||
|
||||
# constraint force
|
||||
@@ -178,7 +175,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(doc.Face2, "Edge4"),
|
||||
(doc.Face3, "Edge4"),
|
||||
(doc.Face4, "Edge4"),
|
||||
(doc.Face5, "Edge4")
|
||||
(doc.Face5, "Edge4"),
|
||||
]
|
||||
con_force.Force = "10000.00 N"
|
||||
con_force.Direction = (doc.Face1, ["Edge1"])
|
||||
@@ -187,6 +184,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_multibodybeam_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["fixed", "pressure"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "multimaterial",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.material_multiple_tensionrod_twoboxes import setup
|
||||
@@ -59,6 +61,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -109,7 +112,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -157,6 +160,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_boxes_2_vertikal_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -51,12 +51,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "nonlinear",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.material_nl_platewithhole import setup
|
||||
@@ -80,6 +82,7 @@ TODO nonlinear material: give more information, use values from harry
|
||||
TODO compare results with example from HarryvL
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -118,7 +121,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -131,8 +134,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
solver_obj.ThermoMechSteadyState = False
|
||||
solver_obj.MatrixSolverType = "default"
|
||||
solver_obj.IterationsControlParameterTimeUse = False
|
||||
solver_obj.GeometricalNonlinearity = 'nonlinear'
|
||||
solver_obj.MaterialNonlinearity = 'nonlinear'
|
||||
solver_obj.GeometricalNonlinearity = "nonlinear"
|
||||
solver_obj.MaterialNonlinearity = "nonlinear"
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# linear material
|
||||
@@ -147,7 +150,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# nonlinear material
|
||||
name_nlm = "Material_nonlin"
|
||||
nonlinear_mat = ObjectsFem.makeMaterialMechanicalNonlinear(doc, material_obj, name_nlm)
|
||||
nonlinear_mat.YieldPoints = ['240.0, 0.0', '270.0, 0.025']
|
||||
nonlinear_mat.YieldPoints = ["240.0, 0.0", "270.0, 0.025"]
|
||||
analysis.addObject(nonlinear_mat)
|
||||
# check solver attributes, Nonlinearity needs to be set to nonlinear
|
||||
|
||||
@@ -165,6 +168,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_platewithhole_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -266,129 +266,804 @@ def create_nodes(femmesh):
|
||||
|
||||
def create_elements(femmesh):
|
||||
# elements
|
||||
femmesh.addVolume([
|
||||
192, 61, 105, 222, 19, 1, 10, 95, 193, 104, 220, 221, 20, 9, 93, 94, 190, 62, 103, 219
|
||||
], 1)
|
||||
femmesh.addVolume([
|
||||
222, 105, 34, 134, 95, 10, 2, 13, 220, 106, 133, 223, 93, 11, 12, 96, 219, 103, 33, 132
|
||||
], 2)
|
||||
femmesh.addVolume([
|
||||
79, 192, 222, 163, 4, 19, 95, 16, 191, 221, 224, 164, 18, 94, 97, 17, 78, 190, 219, 161
|
||||
], 3)
|
||||
femmesh.addVolume([
|
||||
163, 222, 134, 64, 16, 95, 13, 3, 224, 223,
|
||||
135, 162, 97, 96, 14, 15, 161, 219, 132, 63
|
||||
], 4)
|
||||
femmesh.addVolume([
|
||||
196, 59, 109, 228, 192, 61, 105, 222, 197,
|
||||
108, 226, 227, 193, 104, 220, 221, 194, 60, 107, 225
|
||||
], 5)
|
||||
femmesh.addVolume([
|
||||
228, 109, 36, 138, 222, 105, 34, 134, 226,
|
||||
110, 137, 229, 220, 106, 133, 223, 225, 107, 35, 136
|
||||
], 6)
|
||||
femmesh.addVolume([
|
||||
81, 196, 228, 167, 79, 192, 222, 163, 195, 227,
|
||||
230, 168, 191, 221, 224, 164, 80, 194, 225, 165
|
||||
], 7)
|
||||
femmesh.addVolume([
|
||||
167, 228, 138, 66, 163, 222, 134, 64, 230, 229,
|
||||
139, 166, 224, 223, 135, 162, 165, 225, 136, 65
|
||||
], 8)
|
||||
femmesh.addVolume([
|
||||
200, 57, 113, 234, 196, 59, 109, 228, 201, 112,
|
||||
232, 233, 197, 108, 226, 227, 198, 58, 111, 231
|
||||
], 9)
|
||||
femmesh.addVolume([
|
||||
234, 113, 38, 142, 228, 109, 36, 138, 232, 114,
|
||||
141, 235, 226, 110, 137, 229, 231, 111, 37, 140
|
||||
], 10)
|
||||
femmesh.addVolume([
|
||||
83, 200, 234, 171, 81, 196, 228, 167, 199, 233,
|
||||
236, 172, 195, 227, 230, 168, 82, 198, 231, 169
|
||||
], 11)
|
||||
femmesh.addVolume([
|
||||
171, 234, 142, 68, 167, 228, 138, 66, 236, 235,
|
||||
143, 170, 230, 229, 139, 166, 169, 231, 140, 67
|
||||
], 12)
|
||||
femmesh.addVolume([
|
||||
204, 55, 117, 240, 200, 57, 113, 234, 205, 116,
|
||||
238, 239, 201, 112, 232, 233, 202, 56, 115, 237
|
||||
], 13)
|
||||
femmesh.addVolume([
|
||||
240, 117, 40, 146, 234, 113, 38, 142, 238, 118,
|
||||
145, 241, 232, 114, 141, 235, 237, 115, 39, 144
|
||||
], 14)
|
||||
femmesh.addVolume([
|
||||
85, 204, 240, 175, 83, 200, 234, 171, 203, 239,
|
||||
242, 176, 199, 233, 236, 172, 84, 202, 237, 173
|
||||
], 15)
|
||||
femmesh.addVolume([
|
||||
175, 240, 146, 70, 171, 234, 142, 68, 242, 241,
|
||||
147, 174, 236, 235, 143, 170, 173, 237, 144, 69
|
||||
], 16)
|
||||
femmesh.addVolume([
|
||||
208, 53, 121, 246, 204, 55, 117, 240, 209, 120,
|
||||
244, 245, 205, 116, 238, 239, 206, 54, 119, 243
|
||||
], 17)
|
||||
femmesh.addVolume([
|
||||
246, 121, 42, 150, 240, 117, 40, 146, 244, 122,
|
||||
149, 247, 238, 118, 145, 241, 243, 119, 41, 148
|
||||
], 18)
|
||||
femmesh.addVolume([
|
||||
87, 208, 246, 179, 85, 204, 240, 175, 207, 245,
|
||||
248, 180, 203, 239, 242, 176, 86, 206, 243, 177
|
||||
], 19)
|
||||
femmesh.addVolume([
|
||||
179, 246, 150, 72, 175, 240, 146, 70, 248, 247,
|
||||
151, 178, 242, 241, 147, 174, 177, 243, 148, 71
|
||||
], 20)
|
||||
femmesh.addVolume([
|
||||
212, 51, 125, 252, 208, 53, 121, 246, 213, 124,
|
||||
250, 251, 209, 120, 244, 245, 210, 52, 123, 249
|
||||
], 21)
|
||||
femmesh.addVolume([
|
||||
252, 125, 44, 154, 246, 121, 42, 150, 250, 126,
|
||||
153, 253, 244, 122, 149, 247, 249, 123, 43, 152
|
||||
], 22)
|
||||
femmesh.addVolume([
|
||||
89, 212, 252, 183, 87, 208, 246, 179, 211, 251,
|
||||
254, 184, 207, 245, 248, 180, 88, 210, 249, 181
|
||||
], 23)
|
||||
femmesh.addVolume([
|
||||
183, 252, 154, 74, 179, 246, 150, 72, 254, 253,
|
||||
155, 182, 248, 247, 151, 178, 181, 249, 152, 73
|
||||
], 24)
|
||||
femmesh.addVolume([
|
||||
216, 49, 129, 258, 212, 51, 125, 252, 217, 128,
|
||||
256, 257, 213, 124, 250, 251, 214, 50, 127, 255
|
||||
], 25)
|
||||
femmesh.addVolume([
|
||||
258, 129, 46, 158, 252, 125, 44, 154, 256, 130,
|
||||
157, 259, 250, 126, 153, 253, 255, 127, 45, 156
|
||||
], 26)
|
||||
femmesh.addVolume([
|
||||
91, 216, 258, 187, 89, 212, 252, 183, 215, 257,
|
||||
260, 188, 211, 251, 254, 184, 90, 214, 255, 185
|
||||
], 27)
|
||||
femmesh.addVolume([
|
||||
187, 258, 158, 76, 183, 252, 154, 74, 260, 259,
|
||||
159, 186, 254, 253, 155, 182, 185, 255, 156, 75
|
||||
], 28)
|
||||
femmesh.addVolume([
|
||||
31, 5, 22, 100, 216, 49, 129, 258, 32, 21,
|
||||
98, 99, 217, 128, 256, 257, 218, 48, 131, 261
|
||||
], 29)
|
||||
femmesh.addVolume([
|
||||
100, 22, 6, 25, 258, 129, 46, 158, 98, 23,
|
||||
24, 101, 256, 130, 157, 259, 261, 131, 47, 160
|
||||
], 30)
|
||||
femmesh.addVolume([
|
||||
8, 31, 100, 28, 91, 216, 258, 187, 30, 99,
|
||||
102, 29, 215, 257, 260, 188, 92, 218, 261, 189
|
||||
], 31)
|
||||
femmesh.addVolume([
|
||||
28, 100, 25, 7, 187, 258, 158, 76, 102, 101,
|
||||
26, 27, 260, 259, 159, 186, 189, 261, 160, 77
|
||||
], 32)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
192,
|
||||
61,
|
||||
105,
|
||||
222,
|
||||
19,
|
||||
1,
|
||||
10,
|
||||
95,
|
||||
193,
|
||||
104,
|
||||
220,
|
||||
221,
|
||||
20,
|
||||
9,
|
||||
93,
|
||||
94,
|
||||
190,
|
||||
62,
|
||||
103,
|
||||
219,
|
||||
],
|
||||
1,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
222,
|
||||
105,
|
||||
34,
|
||||
134,
|
||||
95,
|
||||
10,
|
||||
2,
|
||||
13,
|
||||
220,
|
||||
106,
|
||||
133,
|
||||
223,
|
||||
93,
|
||||
11,
|
||||
12,
|
||||
96,
|
||||
219,
|
||||
103,
|
||||
33,
|
||||
132,
|
||||
],
|
||||
2,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
79,
|
||||
192,
|
||||
222,
|
||||
163,
|
||||
4,
|
||||
19,
|
||||
95,
|
||||
16,
|
||||
191,
|
||||
221,
|
||||
224,
|
||||
164,
|
||||
18,
|
||||
94,
|
||||
97,
|
||||
17,
|
||||
78,
|
||||
190,
|
||||
219,
|
||||
161,
|
||||
],
|
||||
3,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
163,
|
||||
222,
|
||||
134,
|
||||
64,
|
||||
16,
|
||||
95,
|
||||
13,
|
||||
3,
|
||||
224,
|
||||
223,
|
||||
135,
|
||||
162,
|
||||
97,
|
||||
96,
|
||||
14,
|
||||
15,
|
||||
161,
|
||||
219,
|
||||
132,
|
||||
63,
|
||||
],
|
||||
4,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
196,
|
||||
59,
|
||||
109,
|
||||
228,
|
||||
192,
|
||||
61,
|
||||
105,
|
||||
222,
|
||||
197,
|
||||
108,
|
||||
226,
|
||||
227,
|
||||
193,
|
||||
104,
|
||||
220,
|
||||
221,
|
||||
194,
|
||||
60,
|
||||
107,
|
||||
225,
|
||||
],
|
||||
5,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
228,
|
||||
109,
|
||||
36,
|
||||
138,
|
||||
222,
|
||||
105,
|
||||
34,
|
||||
134,
|
||||
226,
|
||||
110,
|
||||
137,
|
||||
229,
|
||||
220,
|
||||
106,
|
||||
133,
|
||||
223,
|
||||
225,
|
||||
107,
|
||||
35,
|
||||
136,
|
||||
],
|
||||
6,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
81,
|
||||
196,
|
||||
228,
|
||||
167,
|
||||
79,
|
||||
192,
|
||||
222,
|
||||
163,
|
||||
195,
|
||||
227,
|
||||
230,
|
||||
168,
|
||||
191,
|
||||
221,
|
||||
224,
|
||||
164,
|
||||
80,
|
||||
194,
|
||||
225,
|
||||
165,
|
||||
],
|
||||
7,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
167,
|
||||
228,
|
||||
138,
|
||||
66,
|
||||
163,
|
||||
222,
|
||||
134,
|
||||
64,
|
||||
230,
|
||||
229,
|
||||
139,
|
||||
166,
|
||||
224,
|
||||
223,
|
||||
135,
|
||||
162,
|
||||
165,
|
||||
225,
|
||||
136,
|
||||
65,
|
||||
],
|
||||
8,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
200,
|
||||
57,
|
||||
113,
|
||||
234,
|
||||
196,
|
||||
59,
|
||||
109,
|
||||
228,
|
||||
201,
|
||||
112,
|
||||
232,
|
||||
233,
|
||||
197,
|
||||
108,
|
||||
226,
|
||||
227,
|
||||
198,
|
||||
58,
|
||||
111,
|
||||
231,
|
||||
],
|
||||
9,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
234,
|
||||
113,
|
||||
38,
|
||||
142,
|
||||
228,
|
||||
109,
|
||||
36,
|
||||
138,
|
||||
232,
|
||||
114,
|
||||
141,
|
||||
235,
|
||||
226,
|
||||
110,
|
||||
137,
|
||||
229,
|
||||
231,
|
||||
111,
|
||||
37,
|
||||
140,
|
||||
],
|
||||
10,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
83,
|
||||
200,
|
||||
234,
|
||||
171,
|
||||
81,
|
||||
196,
|
||||
228,
|
||||
167,
|
||||
199,
|
||||
233,
|
||||
236,
|
||||
172,
|
||||
195,
|
||||
227,
|
||||
230,
|
||||
168,
|
||||
82,
|
||||
198,
|
||||
231,
|
||||
169,
|
||||
],
|
||||
11,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
171,
|
||||
234,
|
||||
142,
|
||||
68,
|
||||
167,
|
||||
228,
|
||||
138,
|
||||
66,
|
||||
236,
|
||||
235,
|
||||
143,
|
||||
170,
|
||||
230,
|
||||
229,
|
||||
139,
|
||||
166,
|
||||
169,
|
||||
231,
|
||||
140,
|
||||
67,
|
||||
],
|
||||
12,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
204,
|
||||
55,
|
||||
117,
|
||||
240,
|
||||
200,
|
||||
57,
|
||||
113,
|
||||
234,
|
||||
205,
|
||||
116,
|
||||
238,
|
||||
239,
|
||||
201,
|
||||
112,
|
||||
232,
|
||||
233,
|
||||
202,
|
||||
56,
|
||||
115,
|
||||
237,
|
||||
],
|
||||
13,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
240,
|
||||
117,
|
||||
40,
|
||||
146,
|
||||
234,
|
||||
113,
|
||||
38,
|
||||
142,
|
||||
238,
|
||||
118,
|
||||
145,
|
||||
241,
|
||||
232,
|
||||
114,
|
||||
141,
|
||||
235,
|
||||
237,
|
||||
115,
|
||||
39,
|
||||
144,
|
||||
],
|
||||
14,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
85,
|
||||
204,
|
||||
240,
|
||||
175,
|
||||
83,
|
||||
200,
|
||||
234,
|
||||
171,
|
||||
203,
|
||||
239,
|
||||
242,
|
||||
176,
|
||||
199,
|
||||
233,
|
||||
236,
|
||||
172,
|
||||
84,
|
||||
202,
|
||||
237,
|
||||
173,
|
||||
],
|
||||
15,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
175,
|
||||
240,
|
||||
146,
|
||||
70,
|
||||
171,
|
||||
234,
|
||||
142,
|
||||
68,
|
||||
242,
|
||||
241,
|
||||
147,
|
||||
174,
|
||||
236,
|
||||
235,
|
||||
143,
|
||||
170,
|
||||
173,
|
||||
237,
|
||||
144,
|
||||
69,
|
||||
],
|
||||
16,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
208,
|
||||
53,
|
||||
121,
|
||||
246,
|
||||
204,
|
||||
55,
|
||||
117,
|
||||
240,
|
||||
209,
|
||||
120,
|
||||
244,
|
||||
245,
|
||||
205,
|
||||
116,
|
||||
238,
|
||||
239,
|
||||
206,
|
||||
54,
|
||||
119,
|
||||
243,
|
||||
],
|
||||
17,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
246,
|
||||
121,
|
||||
42,
|
||||
150,
|
||||
240,
|
||||
117,
|
||||
40,
|
||||
146,
|
||||
244,
|
||||
122,
|
||||
149,
|
||||
247,
|
||||
238,
|
||||
118,
|
||||
145,
|
||||
241,
|
||||
243,
|
||||
119,
|
||||
41,
|
||||
148,
|
||||
],
|
||||
18,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
87,
|
||||
208,
|
||||
246,
|
||||
179,
|
||||
85,
|
||||
204,
|
||||
240,
|
||||
175,
|
||||
207,
|
||||
245,
|
||||
248,
|
||||
180,
|
||||
203,
|
||||
239,
|
||||
242,
|
||||
176,
|
||||
86,
|
||||
206,
|
||||
243,
|
||||
177,
|
||||
],
|
||||
19,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
179,
|
||||
246,
|
||||
150,
|
||||
72,
|
||||
175,
|
||||
240,
|
||||
146,
|
||||
70,
|
||||
248,
|
||||
247,
|
||||
151,
|
||||
178,
|
||||
242,
|
||||
241,
|
||||
147,
|
||||
174,
|
||||
177,
|
||||
243,
|
||||
148,
|
||||
71,
|
||||
],
|
||||
20,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
212,
|
||||
51,
|
||||
125,
|
||||
252,
|
||||
208,
|
||||
53,
|
||||
121,
|
||||
246,
|
||||
213,
|
||||
124,
|
||||
250,
|
||||
251,
|
||||
209,
|
||||
120,
|
||||
244,
|
||||
245,
|
||||
210,
|
||||
52,
|
||||
123,
|
||||
249,
|
||||
],
|
||||
21,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
252,
|
||||
125,
|
||||
44,
|
||||
154,
|
||||
246,
|
||||
121,
|
||||
42,
|
||||
150,
|
||||
250,
|
||||
126,
|
||||
153,
|
||||
253,
|
||||
244,
|
||||
122,
|
||||
149,
|
||||
247,
|
||||
249,
|
||||
123,
|
||||
43,
|
||||
152,
|
||||
],
|
||||
22,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
89,
|
||||
212,
|
||||
252,
|
||||
183,
|
||||
87,
|
||||
208,
|
||||
246,
|
||||
179,
|
||||
211,
|
||||
251,
|
||||
254,
|
||||
184,
|
||||
207,
|
||||
245,
|
||||
248,
|
||||
180,
|
||||
88,
|
||||
210,
|
||||
249,
|
||||
181,
|
||||
],
|
||||
23,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
183,
|
||||
252,
|
||||
154,
|
||||
74,
|
||||
179,
|
||||
246,
|
||||
150,
|
||||
72,
|
||||
254,
|
||||
253,
|
||||
155,
|
||||
182,
|
||||
248,
|
||||
247,
|
||||
151,
|
||||
178,
|
||||
181,
|
||||
249,
|
||||
152,
|
||||
73,
|
||||
],
|
||||
24,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
216,
|
||||
49,
|
||||
129,
|
||||
258,
|
||||
212,
|
||||
51,
|
||||
125,
|
||||
252,
|
||||
217,
|
||||
128,
|
||||
256,
|
||||
257,
|
||||
213,
|
||||
124,
|
||||
250,
|
||||
251,
|
||||
214,
|
||||
50,
|
||||
127,
|
||||
255,
|
||||
],
|
||||
25,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
258,
|
||||
129,
|
||||
46,
|
||||
158,
|
||||
252,
|
||||
125,
|
||||
44,
|
||||
154,
|
||||
256,
|
||||
130,
|
||||
157,
|
||||
259,
|
||||
250,
|
||||
126,
|
||||
153,
|
||||
253,
|
||||
255,
|
||||
127,
|
||||
45,
|
||||
156,
|
||||
],
|
||||
26,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
91,
|
||||
216,
|
||||
258,
|
||||
187,
|
||||
89,
|
||||
212,
|
||||
252,
|
||||
183,
|
||||
215,
|
||||
257,
|
||||
260,
|
||||
188,
|
||||
211,
|
||||
251,
|
||||
254,
|
||||
184,
|
||||
90,
|
||||
214,
|
||||
255,
|
||||
185,
|
||||
],
|
||||
27,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
187,
|
||||
258,
|
||||
158,
|
||||
76,
|
||||
183,
|
||||
252,
|
||||
154,
|
||||
74,
|
||||
260,
|
||||
259,
|
||||
159,
|
||||
186,
|
||||
254,
|
||||
253,
|
||||
155,
|
||||
182,
|
||||
185,
|
||||
255,
|
||||
156,
|
||||
75,
|
||||
],
|
||||
28,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
31,
|
||||
5,
|
||||
22,
|
||||
100,
|
||||
216,
|
||||
49,
|
||||
129,
|
||||
258,
|
||||
32,
|
||||
21,
|
||||
98,
|
||||
99,
|
||||
217,
|
||||
128,
|
||||
256,
|
||||
257,
|
||||
218,
|
||||
48,
|
||||
131,
|
||||
261,
|
||||
],
|
||||
29,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
100,
|
||||
22,
|
||||
6,
|
||||
25,
|
||||
258,
|
||||
129,
|
||||
46,
|
||||
158,
|
||||
98,
|
||||
23,
|
||||
24,
|
||||
101,
|
||||
256,
|
||||
130,
|
||||
157,
|
||||
259,
|
||||
261,
|
||||
131,
|
||||
47,
|
||||
160,
|
||||
],
|
||||
30,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
8,
|
||||
31,
|
||||
100,
|
||||
28,
|
||||
91,
|
||||
216,
|
||||
258,
|
||||
187,
|
||||
30,
|
||||
99,
|
||||
102,
|
||||
29,
|
||||
215,
|
||||
257,
|
||||
260,
|
||||
188,
|
||||
92,
|
||||
218,
|
||||
261,
|
||||
189,
|
||||
],
|
||||
31,
|
||||
)
|
||||
femmesh.addVolume(
|
||||
[
|
||||
28,
|
||||
100,
|
||||
25,
|
||||
7,
|
||||
187,
|
||||
258,
|
||||
158,
|
||||
76,
|
||||
102,
|
||||
101,
|
||||
26,
|
||||
27,
|
||||
260,
|
||||
259,
|
||||
159,
|
||||
186,
|
||||
189,
|
||||
261,
|
||||
160,
|
||||
77,
|
||||
],
|
||||
32,
|
||||
)
|
||||
return True
|
||||
|
||||
@@ -41,12 +41,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools", "elmer", "mystran"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.buckling_platebuckling import setup
|
||||
@@ -64,6 +66,7 @@ one each mesh node on one edge 100 N tension force
|
||||
Does not work on Z88 because Z88 does not support quad4 elements
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -95,7 +98,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
doc.recompute()
|
||||
|
||||
# all geom boolean fragment
|
||||
geom_obj = SplitFeatures.makeBooleanFragments(name='ThePointPlate')
|
||||
geom_obj = SplitFeatures.makeBooleanFragments(name="ThePointPlate")
|
||||
geom_obj.Objects = [plate, force_pt1, force_pt2, force_pt3, force_pt4]
|
||||
doc.recompute()
|
||||
if FreeCAD.GuiUp:
|
||||
@@ -117,7 +120,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "elmer":
|
||||
solver_obj = ObjectsFem.makeSolverElmer(doc, "SolverElmer")
|
||||
ObjectsFem.makeEquationElasticity(doc, solver_obj)
|
||||
@@ -141,7 +144,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
analysis.addObject(solver_obj)
|
||||
|
||||
# shell thickness
|
||||
thickness_obj = ObjectsFem.makeElementGeometry2D(doc, 0.3, 'Thickness')
|
||||
thickness_obj = ObjectsFem.makeElementGeometry2D(doc, 0.3, "Thickness")
|
||||
analysis.addObject(thickness_obj)
|
||||
|
||||
# material
|
||||
@@ -175,6 +178,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_plate_mystran_quad4 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -44,12 +44,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force", "displacement"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "reinforced",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.rc_wall_2d import setup
|
||||
@@ -62,6 +64,7 @@ https://forum.freecad.org/viewtopic.php?f=18&t=33106&start=80#p296469
|
||||
example from Harry's epic topic: Concrete branch ready for testing
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -104,7 +107,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -163,6 +166,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_rc_wall_2d_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["force", "fixed"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.square_pipe_end_twisted_edgeforces import setup
|
||||
@@ -59,6 +61,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -93,7 +96,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -127,7 +130,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(doc.SquareTube, "Edge4"),
|
||||
(doc.SquareTube, "Edge7"),
|
||||
(doc.SquareTube, "Edge10"),
|
||||
(doc.SquareTube, "Edge12")]
|
||||
(doc.SquareTube, "Edge12"),
|
||||
]
|
||||
analysis.addObject(con_fixed)
|
||||
|
||||
# con_force1
|
||||
@@ -164,6 +168,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_square_pipe_end_twisted_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["force", "fixed"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.square_pipe_end_twisted_nodeforces import setup
|
||||
@@ -59,6 +61,7 @@ See forum topic post:
|
||||
...
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -203,7 +206,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
else:
|
||||
FreeCAD.Console.PrintWarning(
|
||||
"Unknown or unsupported solver type: {}. "
|
||||
@@ -281,7 +284,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geofixes_obj, "Vertex45"),
|
||||
(geofixes_obj, "Vertex27"),
|
||||
(geofixes_obj, "Vertex2"),
|
||||
(geofixes_obj, "Vertex25")]
|
||||
(geofixes_obj, "Vertex25"),
|
||||
]
|
||||
analysis.addObject(con_fixed)
|
||||
|
||||
# con_force1
|
||||
@@ -307,7 +311,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex21"),
|
||||
(geoforces_obj, "Vertex22"),
|
||||
(geoforces_obj, "Vertex23"),
|
||||
(geoforces_obj, "Vertex24"), ]
|
||||
(geoforces_obj, "Vertex24"),
|
||||
]
|
||||
con_force3.Force = "27777.78 N"
|
||||
con_force3.Direction = (geom_obj, ["Edge9"])
|
||||
con_force3.Reversed = False
|
||||
@@ -320,7 +325,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex10"),
|
||||
(geoforces_obj, "Vertex11"),
|
||||
(geoforces_obj, "Vertex12"),
|
||||
(geoforces_obj, "Vertex13"), ]
|
||||
(geoforces_obj, "Vertex13"),
|
||||
]
|
||||
con_force4.Force = "27777.78 N"
|
||||
con_force4.Direction = (geom_obj, ["Edge3"])
|
||||
con_force4.Reversed = False
|
||||
@@ -334,7 +340,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex45"),
|
||||
(geoforces_obj, "Vertex46"),
|
||||
(geoforces_obj, "Vertex47"),
|
||||
(geoforces_obj, "Vertex48"), ]
|
||||
(geoforces_obj, "Vertex48"),
|
||||
]
|
||||
con_force5.Force = "66666.67 N"
|
||||
con_force5.Direction = (geom_obj, ["Edge9"])
|
||||
con_force5.Reversed = False
|
||||
@@ -348,7 +355,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex33"),
|
||||
(geoforces_obj, "Vertex34"),
|
||||
(geoforces_obj, "Vertex35"),
|
||||
(geoforces_obj, "Vertex36"), ]
|
||||
(geoforces_obj, "Vertex36"),
|
||||
]
|
||||
con_force6.Force = "66666.67 N"
|
||||
con_force6.Direction = (geom_obj, ["Edge3"])
|
||||
con_force6.Reversed = False
|
||||
@@ -377,7 +385,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex4"),
|
||||
(geoforces_obj, "Vertex5"),
|
||||
(geoforces_obj, "Vertex6"),
|
||||
(geoforces_obj, "Vertex7"), ]
|
||||
(geoforces_obj, "Vertex7"),
|
||||
]
|
||||
con_force9.Force = "27777.78 N"
|
||||
con_force9.Direction = (geom_obj, ["Edge11"])
|
||||
con_force9.Reversed = False
|
||||
@@ -390,7 +399,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex16"),
|
||||
(geoforces_obj, "Vertex17"),
|
||||
(geoforces_obj, "Vertex18"),
|
||||
(geoforces_obj, "Vertex19"), ]
|
||||
(geoforces_obj, "Vertex19"),
|
||||
]
|
||||
con_force10.Force = "27777.78 N"
|
||||
con_force10.Direction = (geom_obj, ["Edge6"])
|
||||
con_force10.Reversed = False
|
||||
@@ -404,7 +414,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex27"),
|
||||
(geoforces_obj, "Vertex28"),
|
||||
(geoforces_obj, "Vertex29"),
|
||||
(geoforces_obj, "Vertex30"), ]
|
||||
(geoforces_obj, "Vertex30"),
|
||||
]
|
||||
con_force11.Force = "66666.67 N"
|
||||
con_force11.Direction = (geom_obj, ["Edge11"])
|
||||
con_force11.Reversed = False
|
||||
@@ -418,7 +429,8 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
(geoforces_obj, "Vertex39"),
|
||||
(geoforces_obj, "Vertex40"),
|
||||
(geoforces_obj, "Vertex41"),
|
||||
(geoforces_obj, "Vertex42"), ]
|
||||
(geoforces_obj, "Vertex42"),
|
||||
]
|
||||
con_force12.Force = "66666.67 N"
|
||||
con_force12.Direction = (geom_obj, ["Edge6"])
|
||||
con_force12.Reversed = False
|
||||
@@ -426,6 +438,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_square_pipe_end_twisted_tria6 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -51,12 +51,14 @@ def get_information():
|
||||
"constraints": ["fixed", "initial temperature", "temperature"],
|
||||
"solvers": ["ccxtools", "elmer"],
|
||||
"material": "multimaterial",
|
||||
"equations": ["thermomechanical"]
|
||||
"equations": ["thermomechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
To run the example from Python console use:
|
||||
from femexamples.thermomech_bimetall import setup
|
||||
@@ -73,6 +75,7 @@ this file has 7.15 mm max deflection
|
||||
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -105,7 +108,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
doc.recompute()
|
||||
|
||||
# all geom boolean fragment
|
||||
geom_obj = SplitFeatures.makeBooleanFragments(name='BooleanFragments')
|
||||
geom_obj = SplitFeatures.makeBooleanFragments(name="BooleanFragments")
|
||||
geom_obj.Objects = [bottom_box_obj, top_box_obj]
|
||||
if FreeCAD.GuiUp:
|
||||
bottom_box_obj.ViewObject.hide()
|
||||
@@ -122,7 +125,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "elmer":
|
||||
solver_obj = analysis.addObject(ObjectsFem.makeSolverElmer(doc, "SolverElmer"))[0]
|
||||
solver_obj.SteadyStateMinIterations = 1
|
||||
@@ -189,25 +192,20 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# constraint temperature
|
||||
con_temp = ObjectsFem.makeConstraintTemperature(doc, "ConstraintTemperatureHot")
|
||||
con_temp.References = [
|
||||
(geom_obj, "Face5"),
|
||||
(geom_obj, "Face11")
|
||||
]
|
||||
con_temp.References = [(geom_obj, "Face5"), (geom_obj, "Face11")]
|
||||
con_temp.Temperature = 373.0
|
||||
con_temp.CFlux = 0.0
|
||||
analysis.addObject(con_temp)
|
||||
|
||||
con_temp = ObjectsFem.makeConstraintTemperature(doc, "ConstraintTemperatureNormal")
|
||||
con_temp.References = [
|
||||
(geom_obj, "Face1"),
|
||||
(geom_obj, "Face7")
|
||||
]
|
||||
con_temp.References = [(geom_obj, "Face1"), (geom_obj, "Face7")]
|
||||
con_temp.Temperature = 273.0
|
||||
con_temp.CFlux = 0.0
|
||||
analysis.addObject(con_temp)
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_thermomech_bimetall_tetra10 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -38,7 +38,7 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["z88"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ def setup(doc=None, solvertype="z88"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_truss_crane_seg2 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
@@ -43,12 +43,14 @@ def get_information():
|
||||
"constraints": ["fixed", "force"],
|
||||
"solvers": ["ccxtools"],
|
||||
"material": "solid",
|
||||
"equations": ["mechanical"]
|
||||
"equations": ["mechanical"],
|
||||
}
|
||||
|
||||
|
||||
def get_explanation(header=""):
|
||||
return header + """
|
||||
return (
|
||||
header
|
||||
+ """
|
||||
|
||||
# To run the example from Python console use,
|
||||
# (works even after an edit without restart of FreeCAD):
|
||||
@@ -69,6 +71,7 @@ Z88 official example 2, crane beam
|
||||
- max deflection Mystran : x.xx mm
|
||||
- max deflection Z88 : 8.19 mm # one seg2 truss element foreach bar
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
@@ -401,7 +404,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
# solver
|
||||
if solvertype == "ccxtools":
|
||||
solver_obj = ObjectsFem.makeSolverCalculiXCcxTools(doc, "CalculiXCcxTools")
|
||||
solver_obj.WorkingDir = u""
|
||||
solver_obj.WorkingDir = ""
|
||||
elif solvertype == "z88":
|
||||
solver_obj = ObjectsFem.makeSolverZ88(doc, "SolverZ88")
|
||||
else:
|
||||
@@ -420,10 +423,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# beam section
|
||||
beamsection_obj = ObjectsFem.makeElementGeometry1D(
|
||||
doc,
|
||||
sectiontype="Circular",
|
||||
height=25.0,
|
||||
name="CrossSectionCircular"
|
||||
doc, sectiontype="Circular", height=25.0, name="CrossSectionCircular"
|
||||
)
|
||||
analysis.addObject(beamsection_obj)
|
||||
|
||||
@@ -451,6 +451,7 @@ def setup(doc=None, solvertype="ccxtools"):
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_truss_crane_seg3 import create_nodes, create_elements
|
||||
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
|
||||
Reference in New Issue
Block a user