FEM: nonlinear material, set nonlinear geometry for nonlinear material in ccx solver
This commit is contained in:
@@ -340,8 +340,12 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
||||
message += "Frequency analysis: Solver has no EigenmodeLowLimit.\n"
|
||||
elif not hasattr(self.solver, "EigenmodesCount"):
|
||||
message += "Frequency analysis: Solver has no EigenmodesCount.\n"
|
||||
if hasattr(self.solver, "MaterialNonlinearity") and self.solver.MaterialNonlinearity == "nonlinear" and not self.materials_nonlinear:
|
||||
message += "Solver is set to nonlinear materials, but there is no nonlinear material in the analysis. \n"
|
||||
if hasattr(self.solver, "MaterialNonlinearity") and self.solver.MaterialNonlinearity == "nonlinear":
|
||||
if not self.materials_nonlinear:
|
||||
message += "Solver is set to nonlinear materials, but there is no nonlinear material in the analysis.\n"
|
||||
if self.solver.SolverType == 'FemSolverCalculix' and self.solver.GeometricalNonlinearity != "nonlinear":
|
||||
# nonlinear geometry --> should be set https://forum.freecadweb.org/viewtopic.php?f=18&t=23101&p=180489#p180489
|
||||
message += "Solver CalculiX triggers nonlinear geometry for nonlinear material, thus it should to be set too.\n"
|
||||
# mesh
|
||||
if not self.mesh:
|
||||
message += "No mesh object defined in the analysis\n"
|
||||
@@ -400,7 +404,7 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
||||
if has_nonlinear_material is False:
|
||||
has_nonlinear_material = True
|
||||
else:
|
||||
message += "At least two nonlinear materials use the same linear base material. Only one nonlinear material for each linear material allowed. \n"
|
||||
message += "At least two nonlinear materials use the same linear base material. Only one nonlinear material for each linear material allowed.\n"
|
||||
# constraints
|
||||
if self.analysis_type == "static":
|
||||
if not (self.fixed_constraints or self.displacement_constraints):
|
||||
|
||||
@@ -61,17 +61,20 @@ class _CommandFemMaterialMechanicalNonlinear(FemCommands):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemMaterialMechanicalNonlinear")
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
FreeCADGui.doCommand(command_to_run)
|
||||
# set the material nonlinear property of the solver to nonlinear if only one solver is available and if this solver is a CalculiX solver
|
||||
# set some property of the solver to nonlinear (only if one solver is available and if this solver is a CalculiX solver):
|
||||
# nonlinear material
|
||||
# nonlinear geometry --> its is triggered anyway https://forum.freecadweb.org/viewtopic.php?f=18&t=23101&p=180489#p180489
|
||||
solver_object = None
|
||||
for m in FemGui.getActiveAnalysis().Member:
|
||||
if m.isDerivedFrom('Fem::FemSolverObjectPython'):
|
||||
if not solver_object:
|
||||
solver_object = m
|
||||
else:
|
||||
# we do not change the material nonlinear attribut if we have more than one solver
|
||||
# we do not change attributes if we have more than one solver, since we do not know which one to take
|
||||
solver_object = None
|
||||
break
|
||||
if solver_object and solver_object.SolverType == 'FemSolverCalculix':
|
||||
solver_object.MaterialNonlinearity = "nonlinear"
|
||||
solver_object.GeometricalNonlinearity = "nonlinear"
|
||||
|
||||
FreeCADGui.addCommand('FEM_MaterialMechanicalNonlinear', _CommandFemMaterialMechanicalNonlinear())
|
||||
|
||||
@@ -53,6 +53,7 @@ class _CommandFemSolverCalculix(FemCommands):
|
||||
FreeCADGui.addModule("ObjectsFem")
|
||||
if has_nonlinear_material_obj:
|
||||
FreeCADGui.doCommand("solver = ObjectsFem.makeSolverCalculix()")
|
||||
FreeCADGui.doCommand("solver.GeometricalNonlinearity = 'nonlinear'")
|
||||
FreeCADGui.doCommand("solver.MaterialNonlinearity = 'nonlinear'")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [solver]")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user