FEM: constraint contact: add implementation for solver CalculiX
This commit is contained in:
parent
116c9717cc
commit
9107e92b52
|
@ -45,6 +45,7 @@ class FemInputWriter():
|
|||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
beamsection_obj, shellthickness_obj,
|
||||
analysis_type, eigenmode_parameters,
|
||||
|
@ -56,6 +57,7 @@ class FemInputWriter():
|
|||
self.material_objects = mat_obj
|
||||
self.fixed_objects = fixed_obj
|
||||
self.displacement_objects = displacement_obj
|
||||
self.contact_objects = contact_obj
|
||||
self.selfweight_objects = selfweight_obj
|
||||
self.force_objects = force_obj
|
||||
self.pressure_objects = pressure_obj
|
||||
|
|
|
@ -40,6 +40,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
beamsection_obj, shellthickness_obj,
|
||||
analysis_type=None, eigenmode_parameters=None,
|
||||
|
@ -49,6 +50,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
beamsection_obj, shellthickness_obj,
|
||||
analysis_type, eigenmode_parameters,
|
||||
|
@ -69,8 +71,12 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
self.write_node_sets_constraints_fixed(inpfile)
|
||||
if self.displacement_objects:
|
||||
self.write_node_sets_constraints_displacement(inpfile)
|
||||
if self.contact_objects:
|
||||
self.write_surfaces_contraints_contact(inpfile)
|
||||
self.write_materials(inpfile)
|
||||
self.write_femelementsets(inpfile)
|
||||
if self.contact_objects:
|
||||
self.write_constraints_contact(inpfile)
|
||||
self.write_step_begin(inpfile)
|
||||
if self.fixed_objects:
|
||||
self.write_constraints_fixed(inpfile)
|
||||
|
@ -152,6 +158,30 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
for n in femobj['Nodes']:
|
||||
f.write(str(n) + ',\n')
|
||||
|
||||
def write_surfaces_contraints_contact(self, f):
|
||||
# get surface nodes and write them to file
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Surfaces for contact constraint\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
obj = 0
|
||||
for femobj in self.contact_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
|
||||
contact_obj = femobj['Object']
|
||||
cnt = 0
|
||||
obj = obj + 1
|
||||
for o, elem_tup in contact_obj.References:
|
||||
for elem in elem_tup:
|
||||
ref_shape = o.Shape.getElement(elem)
|
||||
cnt = cnt + 1
|
||||
if ref_shape.ShapeType == 'Face':
|
||||
if cnt == 1:
|
||||
name = "DEP" + str(obj)
|
||||
else:
|
||||
name = "IND" + str(obj)
|
||||
f.write('*SURFACE, NAME =' + name + '\n')
|
||||
v = self.mesh_object.FemMesh.getccxVolumesByFace(ref_shape)
|
||||
for i in v:
|
||||
f.write("{},S{}\n".format(i[0], i[1]))
|
||||
|
||||
def write_materials(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Materials\n')
|
||||
|
@ -286,6 +316,28 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
|||
f.write(disp_obj_name + ',6,6,' + str(disp_obj.zRotation) + '\n')
|
||||
f.write('\n')
|
||||
|
||||
def write_constraints_contact(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Contact Constraints\n')
|
||||
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
|
||||
obj = 0
|
||||
for femobj in self.contact_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
|
||||
obj = obj + 1
|
||||
contact_obj = femobj['Object']
|
||||
f.write('*CONTACT PAIR, INTERACTION=INT' + str(obj) + ',TYPE=SURFACE TO SURFACE\n')
|
||||
ind_surf = "IND" + str(obj)
|
||||
dep_surf = "DEP" + str(obj)
|
||||
f.write(dep_surf + ',' + ind_surf + '\n')
|
||||
f.write('*SURFACE INTERACTION, NAME=INT' + str(obj) + '\n')
|
||||
f.write('*SURFACE BEHAVIOR,PRESSURE-OVERCLOSURE=LINEAR\n')
|
||||
slope = contact_obj.Slope
|
||||
f.write(str(slope) + ' \n')
|
||||
friction = contact_obj.Friction
|
||||
if friction > 0:
|
||||
f.write('*FRICTION \n')
|
||||
stick = (slope / 10.0)
|
||||
f.write(str(friction) + ', ' + str(stick) + ' \n')
|
||||
|
||||
def write_constraints_selfweight(self, f):
|
||||
f.write('\n***********************************************************\n')
|
||||
f.write('** Self weight\n')
|
||||
|
|
|
@ -37,6 +37,7 @@ class FemInputWriterZ88(FemInputWriter.FemInputWriter):
|
|||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
beamsection_obj, shellthickness_obj,
|
||||
analysis_type=None, eigenmode_parameters=None,
|
||||
|
@ -46,6 +47,7 @@ class FemInputWriterZ88(FemInputWriter.FemInputWriter):
|
|||
analysis_obj, solver_obj,
|
||||
mesh_obj, mat_obj,
|
||||
fixed_obj, displacement_obj,
|
||||
contact_obj,
|
||||
selfweight_obj, force_obj, pressure_obj,
|
||||
beamsection_obj, shellthickness_obj,
|
||||
analysis_type, eigenmode_parameters,
|
||||
|
|
|
@ -153,6 +153,7 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
# [{'Object':pressure_constraints, 'xxxxxxxx':value}, {}, ...]
|
||||
# [{'Object':beam_sections, 'xxxxxxxx':value}, {}, ...]
|
||||
# [{'Object':shell_thicknesses, 'xxxxxxxx':value}, {}, ...]
|
||||
# [{'Object':contact_constraints, 'xxxxxxxx':value}, {}, ...]
|
||||
|
||||
## @var mesh
|
||||
# mesh of the analysis. Used to generate .inp file and to show results
|
||||
|
@ -189,6 +190,10 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
# set of displacements for the analysis. Updated with update_objects
|
||||
# Individual displacement_constraints are Proxy.Type "FemConstraintDisplacement"
|
||||
self.displacement_constraints = []
|
||||
## @var contact_constraints
|
||||
# set of contact constraints from the analysis. Updated with update_objects
|
||||
# Individual constraints are "Fem::ConstraintContact" type
|
||||
self.contact_constraints = []
|
||||
|
||||
found_solver_for_use = False
|
||||
for m in self.analysis.Member:
|
||||
|
@ -235,6 +240,10 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
|
|||
displacement_constraint_dict = {}
|
||||
displacement_constraint_dict['Object'] = m
|
||||
self.displacement_constraints.append(displacement_constraint_dict)
|
||||
elif m.isDerivedFrom("Fem::ConstraintContact"):
|
||||
contact_constraint_dict = {}
|
||||
contact_constraint_dict['Object'] = m
|
||||
self.contact_constraints.append(contact_constraint_dict)
|
||||
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemBeamSection":
|
||||
beam_section_dict = {}
|
||||
beam_section_dict['Object'] = m
|
||||
|
|
|
@ -92,6 +92,7 @@ class FemToolsCcx(FemTools.FemTools):
|
|||
self.analysis, self.solver,
|
||||
self.mesh, self.materials,
|
||||
self.fixed_constraints, self.displacement_constraints,
|
||||
self.contact_constraints,
|
||||
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
||||
self.beam_sections, self.shell_thicknesses,
|
||||
self.analysis_type, self.eigenmode_parameters,
|
||||
|
|
|
@ -84,6 +84,7 @@ class FemToolsZ88(FemTools.FemTools):
|
|||
self.analysis, self.solver,
|
||||
self.mesh, self.materials,
|
||||
self.fixed_constraints, self.displacement_constraints,
|
||||
self.contact_constraints,
|
||||
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
|
||||
self.beam_sections, self.shell_thicknesses,
|
||||
self.analysis_type, None,
|
||||
|
|
Loading…
Reference in New Issue
Block a user