Merge branch 'master' of github.com:FreeCAD/FreeCAD
This commit is contained in:
@@ -38,7 +38,8 @@ SET(FemExamples_SRCS
|
||||
femexamples/boxanalysis.py
|
||||
femexamples/ccx_cantilever_std.py
|
||||
femexamples/manager.py
|
||||
femexamples/multimaterial_twoboxes.py
|
||||
femexamples/material_multiple_twoboxes.py
|
||||
femexamples/material_nl_platewithhole.py
|
||||
femexamples/rc_wall_2d.py
|
||||
femexamples/thermomech_flow1d.py
|
||||
femexamples/thermomech_spine.py
|
||||
@@ -47,9 +48,10 @@ SET(FemExamples_SRCS
|
||||
SET(FemExampleMeshes_SRCS
|
||||
femexamples/meshes/__init__.py
|
||||
femexamples/meshes/mesh_boxanalysis.py
|
||||
femexamples/meshes/mesh_boxes_2_vertikal_tetra10.py
|
||||
femexamples/meshes/mesh_canticcx_tetra10.py
|
||||
femexamples/meshes/mesh_rc_wall_2d_tria6.py
|
||||
femexamples/meshes/mesh_multimaterial_twoboxes.py
|
||||
femexamples/meshes/mesh_platewithhole.py
|
||||
femexamples/meshes/mesh_thermomech_flow1d.py
|
||||
femexamples/meshes/mesh_thermomech_spine.py
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ def init_doc(doc=None):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_base(doc=None, solver="ccxtools"):
|
||||
def setup_base(doc=None, solvertype="ccxtools"):
|
||||
# setup box base model
|
||||
|
||||
if doc is None:
|
||||
@@ -83,29 +83,28 @@ def setup_base(doc=None, solver="ccxtools"):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_static(doc=None, solver="ccxtools"):
|
||||
def setup_static(doc=None, solvertype="ccxtools"):
|
||||
# setup box static, add a fixed, force and a pressure constraint
|
||||
|
||||
doc = setup_base(doc, solver)
|
||||
doc = setup_base(doc, solvertype)
|
||||
box_obj = doc.Box
|
||||
analysis = doc.Analysis
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver_object.WorkingDir = u""
|
||||
elif solver == "elmer":
|
||||
elif solvertype == "elmer":
|
||||
analysis.addObject(ObjectsFem.makeSolverElmer(doc, "SolverElmer"))
|
||||
elif solver == "z88":
|
||||
elif solvertype == "z88":
|
||||
analysis.addObject(ObjectsFem.makeSolverZ88(doc, "SolverZ88"))
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver_object.AnalysisType = "static"
|
||||
solver_object.GeometricalNonlinearity = "linear"
|
||||
solver_object.ThermoMechSteadyState = False
|
||||
@@ -139,24 +138,23 @@ def setup_static(doc=None, solver="ccxtools"):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_frequency(doc=None, solver="ccxtools"):
|
||||
def setup_frequency(doc=None, solvertype="ccxtools"):
|
||||
# setup box frequency, change solver attributes
|
||||
|
||||
doc = setup_base(doc, solver)
|
||||
doc = setup_base(doc, solvertype)
|
||||
analysis = doc.Analysis
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver_object.WorkingDir = u""
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver_object.AnalysisType = "frequency"
|
||||
solver_object.GeometricalNonlinearity = "linear"
|
||||
solver_object.ThermoMechSteadyState = False
|
||||
|
||||
@@ -35,7 +35,7 @@ def init_doc(doc=None):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_cantileverbase(doc=None, solver="ccxtools"):
|
||||
def setup_cantileverbase(doc=None, solvertype="ccxtools"):
|
||||
# setup CalculiX cantilever base model
|
||||
|
||||
if doc is None:
|
||||
@@ -56,21 +56,20 @@ def setup_cantileverbase(doc=None, solver="ccxtools"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver_object.WorkingDir = u""
|
||||
elif solver == "elmer":
|
||||
elif solvertype == "elmer":
|
||||
analysis.addObject(ObjectsFem.makeSolverElmer(doc, "SolverElmer"))
|
||||
elif solver == "z88":
|
||||
elif solvertype == "z88":
|
||||
analysis.addObject(ObjectsFem.makeSolverZ88(doc, "SolverZ88"))
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver_object.AnalysisType = "static"
|
||||
solver_object.GeometricalNonlinearity = "linear"
|
||||
solver_object.ThermoMechSteadyState = False
|
||||
@@ -113,10 +112,10 @@ def setup_cantileverbase(doc=None, solver="ccxtools"):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_cantileverfaceload(doc=None, solver="ccxtools"):
|
||||
def setup_cantileverfaceload(doc=None, solvertype="ccxtools"):
|
||||
# setup CalculiX cantilever, apply 9 MN on surface of front end face
|
||||
|
||||
doc = setup_cantileverbase(doc, solver)
|
||||
doc = setup_cantileverbase(doc, solvertype)
|
||||
|
||||
# force_constraint
|
||||
force_constraint = doc.Analysis.addObject(
|
||||
@@ -131,10 +130,10 @@ def setup_cantileverfaceload(doc=None, solver="ccxtools"):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_cantilevernodeload(doc=None, solver="ccxtools"):
|
||||
def setup_cantilevernodeload(doc=None, solvertype="ccxtools"):
|
||||
# setup CalculiX cantilever, apply 9 MN on the 4 nodes of the front end face
|
||||
|
||||
doc = setup_cantileverbase(doc, solver)
|
||||
doc = setup_cantileverbase(doc, solvertype)
|
||||
|
||||
# force_constraint
|
||||
force_constraint = doc.Analysis.addObject(
|
||||
@@ -155,11 +154,11 @@ def setup_cantilevernodeload(doc=None, solver="ccxtools"):
|
||||
return doc
|
||||
|
||||
|
||||
def setup_cantileverprescribeddisplacement(doc=None, solver="ccxtools"):
|
||||
def setup_cantileverprescribeddisplacement(doc=None, solvertype="ccxtools"):
|
||||
# setup CalculiX cantilever
|
||||
# apply a prescribed displacement of 250 mm in -z on the front end face
|
||||
|
||||
doc = setup_cantileverbase(doc, solver)
|
||||
doc = setup_cantileverbase(doc, solvertype)
|
||||
|
||||
# displacement_constraint
|
||||
displacement_constraint = doc.Analysis.addObject(
|
||||
|
||||
@@ -79,7 +79,8 @@ def run_all():
|
||||
run_ccx_cantileverfaceload()
|
||||
run_ccx_cantilevernodeload()
|
||||
run_ccx_cantileverprescribeddisplacement()
|
||||
run_multimaterial_twoboxes()
|
||||
run_material_nl_platewithhole()
|
||||
run_material_multiple_twoboxes()
|
||||
run_rcwall2d()
|
||||
run_thermomech_flow1d()
|
||||
run_thermomech_spine()
|
||||
@@ -95,6 +96,7 @@ def run_boxanalysisstatic(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -109,6 +111,7 @@ def run_boxanalysisfrequency(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -123,6 +126,7 @@ def run_ccx_cantileverfaceload(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -137,6 +141,7 @@ def run_ccx_cantilevernodeload(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -151,13 +156,14 @@ def run_ccx_cantileverprescribeddisplacement(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
|
||||
def run_multimaterial_twoboxes(solver=None, base_name=None):
|
||||
def run_material_multiple_twoboxes(solver=None, base_name=None):
|
||||
|
||||
from .multimaterial_twoboxes import setup
|
||||
from .material_multiple_twoboxes import setup
|
||||
doc = setup()
|
||||
|
||||
if base_name is None:
|
||||
@@ -165,6 +171,22 @@ def run_multimaterial_twoboxes(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
|
||||
def run_material_nl_platewithhole(solver=None, base_name=None):
|
||||
|
||||
from .material_nl_platewithhole import setup
|
||||
doc = setup()
|
||||
|
||||
if base_name is None:
|
||||
base_name = "Nonlinear_material_plate_with_hole"
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -179,6 +201,7 @@ def run_rcwall2d(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -193,6 +216,7 @@ def run_thermomech_flow1d(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -207,6 +231,7 @@ def run_thermomech_spine(solver=None, base_name=None):
|
||||
if solver is not None:
|
||||
base_name += "_" + solver
|
||||
run_analysis(doc, base_name)
|
||||
doc.recompute()
|
||||
|
||||
return doc
|
||||
|
||||
@@ -221,7 +246,8 @@ doc = run_boxanalysisfrequency()
|
||||
doc = run_ccx_cantileverfaceload()
|
||||
doc = run_ccx_cantilevernodeload()
|
||||
doc = run_ccx_cantileverprescribeddisplacement()
|
||||
doc = run_multimaterial_twoboxes()
|
||||
doc = run_material_multiple_twoboxes()
|
||||
doc = run_material_nl_platewithhole()
|
||||
doc = run_rcwall2d()
|
||||
doc = run_thermomech_flow1d()
|
||||
doc = run_thermomech_spine()
|
||||
|
||||
@@ -35,7 +35,7 @@ def init_doc(doc=None):
|
||||
return doc
|
||||
|
||||
|
||||
def setup(doc=None, solver="ccxtools"):
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
# setup model
|
||||
|
||||
if doc is None:
|
||||
@@ -79,17 +79,16 @@ def setup(doc=None, solver="ccxtools"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver_object.WorkingDir = u""
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver_object.AnalysisType = "static"
|
||||
solver_object.GeometricalNonlinearity = "linear"
|
||||
solver_object.ThermoMechSteadyState = False
|
||||
@@ -139,7 +138,7 @@ def setup(doc=None, solver="ccxtools"):
|
||||
pressure_constraint.Reversed = False
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_multimaterial_twoboxes import create_nodes, create_elements
|
||||
from .meshes.mesh_boxes_2_vertikal_tetra10 import create_nodes, create_elements
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
@@ -157,7 +156,7 @@ def setup(doc=None, solver="ccxtools"):
|
||||
|
||||
|
||||
"""
|
||||
from femexamples import multimaterial_twoboxes as twoboxes
|
||||
from femexamples import material_multiple_twoboxes as twoboxes
|
||||
twoboxes.setup()
|
||||
|
||||
"""
|
||||
162
src/Mod/Fem/femexamples/material_nl_platewithhole.py
Normal file
162
src/Mod/Fem/femexamples/material_nl_platewithhole.py
Normal file
@@ -0,0 +1,162 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2019 Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * This file is part of the FreeCAD CAx development system. *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * FreeCAD is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with FreeCAD; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import ObjectsFem
|
||||
import Fem
|
||||
|
||||
|
||||
mesh_name = "Mesh" # needs to be Mesh to work with unit tests
|
||||
|
||||
|
||||
def init_doc(doc=None):
|
||||
if doc is None:
|
||||
doc = FreeCAD.newDocument()
|
||||
return doc
|
||||
|
||||
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
""" Nonlinear material example, plate with hole.
|
||||
|
||||
https://forum.freecadweb.org/viewtopic.php?f=24&t=31997&start=30
|
||||
https://forum.freecadweb.org/viewtopic.php?t=33974&start=90
|
||||
https://forum.freecadweb.org/viewtopic.php?t=35893
|
||||
|
||||
plate: 400x200x10 mm
|
||||
hole: diameter 100 mm (half cross section)
|
||||
load: 130 MPa tension
|
||||
linear material: Steel, E = 210000 MPa, my = 0.3
|
||||
nonlinear material: '240.0, 0.0' to '270.0, 0.025'
|
||||
TODO nonlinear material: give more information, use values from harry
|
||||
TODO compare results with example from HarryvL
|
||||
|
||||
"""
|
||||
|
||||
if doc is None:
|
||||
doc = init_doc()
|
||||
|
||||
# part
|
||||
import Part
|
||||
from FreeCAD import Vector as vec
|
||||
from Part import makeLine as ln
|
||||
from Part import makeCircle as ci
|
||||
|
||||
v1 = vec(-200, -100, 0)
|
||||
v2 = vec(200, -100, 0)
|
||||
v3 = vec(200, 100, 0)
|
||||
v4 = vec(-200, 100, 0)
|
||||
l1 = ln(v1, v2)
|
||||
l2 = ln(v2, v3)
|
||||
l3 = ln(v3, v4)
|
||||
l4 = ln(v4, v1)
|
||||
v5 = vec(0, 0, 0)
|
||||
c1 = ci(50, v5)
|
||||
face = Part.makeFace([Part.Wire([l1, l2, l3, l4]), c1], "Part::FaceMakerBullseye")
|
||||
partfem = doc.addObject("Part::Feature", "Hole_Plate")
|
||||
partfem.Shape = face.extrude(vec(0, 0, 10))
|
||||
doc.recompute()
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
FreeCADGui.ActiveDocument.activeView().viewAxonometric()
|
||||
FreeCADGui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
# analysis
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
|
||||
# solver
|
||||
if solvertype == "calculix":
|
||||
solver = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solvertype == "ccxtools":
|
||||
solver = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver.WorkingDir = u""
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver.AnalysisType = "static"
|
||||
solver.GeometricalNonlinearity = "linear"
|
||||
solver.ThermoMechSteadyState = False
|
||||
solver.MatrixSolverType = "default"
|
||||
solver.IterationsControlParameterTimeUse = False
|
||||
solver.GeometricalNonlinearity = 'nonlinear'
|
||||
solver.MaterialNonlinearity = 'nonlinear'
|
||||
|
||||
# linear material
|
||||
matprop = {}
|
||||
matprop["Name"] = "CalculiX-Steel"
|
||||
matprop["YoungsModulus"] = "210000 MPa"
|
||||
matprop["PoissonRatio"] = "0.30"
|
||||
matprop["Density"] = "7900 kg/m^3"
|
||||
material = analysis.addObject(
|
||||
ObjectsFem.makeMaterialSolid(doc, "Material_lin")
|
||||
)[0]
|
||||
material.Material = matprop
|
||||
|
||||
# nonlinear material
|
||||
nonlinear_material = analysis.addObject(
|
||||
ObjectsFem.makeMaterialMechanicalNonlinear(doc, material, "Material_nonlin")
|
||||
)[0]
|
||||
nonlinear_material.YieldPoint1 = '240.0, 0.0'
|
||||
nonlinear_material.YieldPoint2 = '270.0, 0.025'
|
||||
# check solver attributes, Nonlinearity needs to be set to nonlinear
|
||||
|
||||
# fixed_constraint
|
||||
fixed_constraint = analysis.addObject(
|
||||
ObjectsFem.makeConstraintFixed(doc, "ConstraintFixed")
|
||||
)[0]
|
||||
fixed_constraint.References = [(partfem, "Face4")]
|
||||
|
||||
# force constraint
|
||||
pressure_constraint = doc.Analysis.addObject(
|
||||
ObjectsFem.makeConstraintPressure(doc, "ConstraintPressure")
|
||||
)[0]
|
||||
pressure_constraint.References = [(partfem, "Face2")]
|
||||
pressure_constraint.Pressure = 130.0
|
||||
pressure_constraint.Reversed = True
|
||||
|
||||
# mesh
|
||||
from .meshes.mesh_platewithhole import create_nodes, create_elements
|
||||
fem_mesh = Fem.FemMesh()
|
||||
control = create_nodes(fem_mesh)
|
||||
if not control:
|
||||
FreeCAD.Console.PrintError("Error on creating nodes.\n")
|
||||
control = create_elements(fem_mesh)
|
||||
if not control:
|
||||
FreeCAD.Console.PrintError("Error on creating elements.\n")
|
||||
femmesh_obj = analysis.addObject(
|
||||
doc.addObject("Fem::FemMeshObject", mesh_name)
|
||||
)[0]
|
||||
femmesh_obj.FemMesh = fem_mesh
|
||||
|
||||
doc.recompute()
|
||||
return doc
|
||||
|
||||
|
||||
"""
|
||||
from femexamples import material_nl_platewithhole as nlmat
|
||||
nlmat.setup()
|
||||
|
||||
"""
|
||||
19766
src/Mod/Fem/femexamples/meshes/mesh_platewithhole.py
Normal file
19766
src/Mod/Fem/femexamples/meshes/mesh_platewithhole.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -35,7 +35,7 @@ def init_doc(doc=None):
|
||||
return doc
|
||||
|
||||
|
||||
def setup(doc=None, solver="ccxtools"):
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
# setup reinfoced wall in 2D
|
||||
|
||||
if doc is None:
|
||||
@@ -75,17 +75,16 @@ def setup(doc=None, solver="ccxtools"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver.WorkingDir = u""
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver.AnalysisType = "static"
|
||||
solver.GeometricalNonlinearity = "linear"
|
||||
solver.ThermoMechSteadyState = False
|
||||
|
||||
@@ -35,7 +35,7 @@ def init_doc(doc=None):
|
||||
return doc
|
||||
|
||||
|
||||
def setup(doc=None, solver="ccxtools"):
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
# setup model
|
||||
|
||||
if doc is None:
|
||||
@@ -91,17 +91,16 @@ def setup(doc=None, solver="ccxtools"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools") # CalculiX
|
||||
)[0]
|
||||
solver_object.WorkingDir = u""
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver_object.AnalysisType = "thermomech"
|
||||
solver_object.GeometricalNonlinearity = "linear"
|
||||
solver_object.ThermoMechSteadyState = True
|
||||
|
||||
@@ -35,7 +35,7 @@ def init_doc(doc=None):
|
||||
return doc
|
||||
|
||||
|
||||
def setup(doc=None, solver="ccxtools"):
|
||||
def setup(doc=None, solvertype="ccxtools"):
|
||||
# setup model
|
||||
|
||||
if doc is None:
|
||||
@@ -57,20 +57,19 @@ def setup(doc=None, solver="ccxtools"):
|
||||
analysis = ObjectsFem.makeAnalysis(doc, "Analysis")
|
||||
|
||||
# solver
|
||||
# TODO How to pass multiple solver for one analysis in one doc
|
||||
if solver == "calculix":
|
||||
if solvertype == "calculix":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculix(doc, "SolverCalculiX")
|
||||
)[0]
|
||||
elif solver == "ccxtools":
|
||||
elif solvertype == "ccxtools":
|
||||
solver_object = analysis.addObject(
|
||||
ObjectsFem.makeSolverCalculixCcxTools(doc, "CalculiXccxTools")
|
||||
)[0]
|
||||
solver_object.WorkingDir = u""
|
||||
# should be possible with elmer too
|
||||
# elif solver == "elmer":
|
||||
# elif solvertype == "elmer":
|
||||
# analysis.addObject(ObjectsFem.makeSolverElmer(doc, "SolverElmer"))
|
||||
if solver == "calculix" or solver == "ccxtools":
|
||||
if solvertype == "calculix" or solvertype == "ccxtools":
|
||||
solver_object.AnalysisType = "thermomech"
|
||||
solver_object.GeometricalNonlinearity = "linear"
|
||||
solver_object.ThermoMechSteadyState = True
|
||||
|
||||
@@ -33,7 +33,6 @@ __url__ = "http://www.freecadweb.org"
|
||||
import FreeCAD
|
||||
from FreeCAD import Console
|
||||
import os
|
||||
import Fem
|
||||
|
||||
|
||||
# ********* generic FreeCAD import and export methods *********
|
||||
|
||||
Reference in New Issue
Block a user