FEM: nonlinear materials, solver CalculiX implementation
This commit is contained in:
parent
854002f08b
commit
956a13da38
|
@ -43,7 +43,7 @@ import os
|
|||
class FemInputWriter():
|
||||
def __init__(self,
|
||||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
mesh_obj, matlin_obj, matnonlin_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj, planerotation_obj, transform_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
|
@ -54,7 +54,8 @@ class FemInputWriter():
|
|||
self.analysis = analysis_obj
|
||||
self.solver_obj = solver_obj
|
||||
self.mesh_object = mesh_obj
|
||||
self.material_objects = mat_obj
|
||||
self.material_objects = matlin_obj
|
||||
self.material_nonlinear_objects = matnonlin_obj
|
||||
self.fixed_objects = fixed_obj
|
||||
self.displacement_objects = displacement_obj
|
||||
self.contact_objects = contact_obj
|
||||
|
|
|
@ -38,7 +38,7 @@ import FemInputWriter
|
|||
class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
||||
def __init__(self,
|
||||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
mesh_obj, matlin_obj, matnonlin_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj, planerotation_obj, transform_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
|
@ -50,7 +50,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
FemInputWriter.FemInputWriter.__init__(
|
||||
self,
|
||||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
mesh_obj, matlin_obj, matnonlin_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj, planerotation_obj, transform_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
|
@ -337,6 +337,15 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
f.write('{0:.3e}\n'.format(TEC_in_mmK))
|
||||
f.write('*SPECIFIC HEAT\n')
|
||||
f.write('{0:.3e}\n'.format(SH_in_JkgK))
|
||||
if self.solver_obj.MaterialNonlinearity == 'nonlinear':
|
||||
if len(self.material_nonlinear_objects) == 1: # workaround since multiple is on TODO
|
||||
nl_mat_obj = self.material_nonlinear_objects[0]['Object']
|
||||
if nl_mat_obj.MaterialModelNonlinearity == "simple hardening":
|
||||
f.write('*PLASTIC\n')
|
||||
f.write(nl_mat_obj.YieldPoint1 + '\n')
|
||||
f.write(nl_mat_obj.YieldPoint2 + '\n')
|
||||
else:
|
||||
print('Only one nonlinear material supported!!')
|
||||
|
||||
def write_constraints_initialtemperature(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
|
@ -405,7 +414,11 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
analysis_static += ', SOLVER=ITERATIVE SCALING'
|
||||
elif self.solver_obj.MatrixSolverType == "iterativecholesky":
|
||||
analysis_static += ', SOLVER=ITERATIVE CHOLESKY'
|
||||
if self.solver_obj.IterationsUserDefinedIncrementations:
|
||||
analysis_static += ', DIRECT'
|
||||
f.write(analysis_static + '\n')
|
||||
if self.solver_obj.IterationsUserDefinedIncrementations:
|
||||
f.write(self.solver_obj.IterationsUserDefinedTimeStepLength + '\n')
|
||||
|
||||
def write_step_begin_thermomech(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
|
|
|
@ -35,7 +35,7 @@ import FemInputWriter
|
|||
class FemInputWriterZ88(FemInputWriter.FemInputWriter):
|
||||
def __init__(self,
|
||||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
mesh_obj, matlin_obj, matnonlin_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj, planerotation_obj, transform_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
|
@ -47,7 +47,7 @@ class FemInputWriterZ88(FemInputWriter.FemInputWriter):
|
|||
FemInputWriter.FemInputWriter.__init__(
|
||||
self,
|
||||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
mesh_obj, matlin_obj, matnonlin_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj, planerotation_obj, transform_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
|
|
|
@ -147,7 +147,8 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
self.mesh.ViewObject.applyDisplacement(displacement_factor)
|
||||
|
||||
def update_objects(self):
|
||||
# [{'Object':materials}, {}, ...]
|
||||
# [{'Object':materials_linear}, {}, ...]
|
||||
# [{'Object':materials_nonlinear}, {}, ...]
|
||||
# [{'Object':fixed_constraints, 'NodeSupports':bool}, {}, ...]
|
||||
# [{'Object':force_constraints, 'NodeLoad':value}, {}, ...
|
||||
# [{'Object':pressure_constraints, 'xxxxxxxx':value}, {}, ...]
|
||||
|
@ -161,10 +162,14 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
## @var mesh
|
||||
# mesh of the analysis. Used to generate .inp file and to show results
|
||||
self.mesh = None
|
||||
## @var materials
|
||||
# set of materials from the analysis. Updated with update_objects
|
||||
## @var materials_linear
|
||||
# set of linear materials from the analysis. Updated with update_objects
|
||||
# Individual materials are "App::MaterialObjectPython" type
|
||||
self.materials = []
|
||||
self.materials_linear = []
|
||||
## @var materials_nonlinear
|
||||
# set of nonlinear materials from the analysis. Updated with update_objects
|
||||
# Individual materials are Proxy.Type "FemMaterialMechanicalNonlinear"
|
||||
self.materials_nonlinear = []
|
||||
## @var fixed_constraints
|
||||
# set of fixed constraints from the analysis. Updated with update_objects
|
||||
# Individual constraints are "Fem::ConstraintFixed" type
|
||||
|
@ -240,9 +245,13 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
else:
|
||||
raise Exception('FEM: Multiple mesh in analysis not yet supported!')
|
||||
elif m.isDerivedFrom("App::MaterialObjectPython"):
|
||||
material_dict = {}
|
||||
material_dict['Object'] = m
|
||||
self.materials.append(material_dict)
|
||||
material_linear_dict = {}
|
||||
material_linear_dict['Object'] = m
|
||||
self.materials_linear.append(material_linear_dict)
|
||||
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemMaterialMechanicalNonlinear":
|
||||
material_nonlinear_dict = {}
|
||||
material_nonlinear_dict['Object'] = m
|
||||
self.materials_nonlinear.append(material_nonlinear_dict)
|
||||
elif m.isDerivedFrom("Fem::ConstraintFixed"):
|
||||
fixed_constraint_dict = {}
|
||||
fixed_constraint_dict['Object'] = m
|
||||
|
@ -329,16 +338,16 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
message += "FEM mesh has no volume and no shell elements, either define a beam section or provide a FEM mesh with volume elements.\n"
|
||||
if self.mesh.FemMesh.VolumeCount == 0 and self.mesh.FemMesh.FaceCount == 0 and self.mesh.FemMesh.EdgeCount == 0:
|
||||
message += "FEM mesh has neither volume nor shell or edge elements. Provide a FEM mesh with elements!\n"
|
||||
# materials
|
||||
if not self.materials:
|
||||
# materials_linear
|
||||
if not self.materials_linear:
|
||||
message += "No material object defined in the analysis\n"
|
||||
has_no_references = False
|
||||
for m in self.materials:
|
||||
for m in self.materials_linear:
|
||||
if len(m['Object'].References) == 0:
|
||||
if has_no_references is True:
|
||||
message += "More than one material has an empty references list (Only one empty references list is allowed!).\n"
|
||||
has_no_references = True
|
||||
for m in self.materials:
|
||||
for m in self.materials_linear:
|
||||
mat_map = m['Object'].Material
|
||||
if 'YoungsModulus' not in mat_map:
|
||||
message += "No YoungsModulus defined for at least one material.\n"
|
||||
|
|
|
@ -88,7 +88,7 @@ class FemToolsCcx(FemTools.FemTools):
|
|||
try:
|
||||
inp_writer = iw.FemInputWriterCcx(
|
||||
self.analysis, self.solver,
|
||||
self.mesh, self.materials,
|
||||
self.mesh, self.materials_linear, self.materials_nonlinear,
|
||||
self.fixed_constraints, self.displacement_constraints,
|
||||
self.contact_constraints, self.planerotation_constraints, self.transform_constraints,
|
||||
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
||||
|
|
|
@ -82,7 +82,7 @@ class FemToolsZ88(FemTools.FemTools):
|
|||
try:
|
||||
inp_writer = iw.FemInputWriterZ88(
|
||||
self.analysis, self.solver,
|
||||
self.mesh, self.materials,
|
||||
self.mesh, self.materials_linear, self.materials_nonlinear,
|
||||
self.fixed_constraints, self.displacement_constraints,
|
||||
self.contact_constraints, self.planerotation_constraints, self.transform_constraints,
|
||||
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
||||
|
|
Loading…
Reference in New Issue
Block a user