FEM: constraint self weight: implementation for solver CalculiX

This commit is contained in:
Bernd Hahnebach 2016-07-21 06:07:44 +01:00 committed by Yorik van Havre
parent 3554c70483
commit b69116b4aa
4 changed files with 27 additions and 4 deletions

View File

@ -44,7 +44,7 @@ class FemInputWriter():
def __init__(self, analysis_obj, solver_obj,
mesh_obj, mat_obj,
fixed_obj,
force_obj, pressure_obj,
selfweight_obj, force_obj, pressure_obj,
displacement_obj,
beamsection_obj, shellthickness_obj,
analysis_type, eigenmode_parameters,
@ -54,6 +54,7 @@ class FemInputWriter():
self.mesh_object = mesh_obj
self.material_objects = mat_obj
self.fixed_objects = fixed_obj
self.selfweight_objects = selfweight_obj
self.force_objects = force_obj
self.pressure_objects = pressure_obj
self.displacement_objects = displacement_obj

View File

@ -39,7 +39,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
def __init__(self, analysis_obj, solver_obj,
mesh_obj, mat_obj,
fixed_obj,
force_obj, pressure_obj,
selfweight_obj, force_obj, pressure_obj,
displacement_obj,
beamsection_obj, shellthickness_obj,
analysis_type=None, eigenmode_parameters=None,
@ -47,7 +47,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
FemInputWriter.FemInputWriter.__init__(self, analysis_obj, solver_obj,
mesh_obj, mat_obj,
fixed_obj,
force_obj, pressure_obj,
selfweight_obj, force_obj, pressure_obj,
displacement_obj,
beamsection_obj, shellthickness_obj,
analysis_type, eigenmode_parameters,
@ -71,6 +71,7 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
self.write_constraints_fixed(inpfile)
self.write_constraints_displacement(inpfile)
if self.analysis_type is None or self.analysis_type == "static":
self.write_constraints_selfweight(inpfile)
self.write_constraints_force(inpfile)
self.write_constraints_pressure(inpfile)
elif self.analysis_type == "frequency":
@ -260,6 +261,19 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
f.write(disp_obj_name + ',6,6,' + str(disp_obj.zRotation) + '\n')
f.write('\n')
def write_constraints_selfweight(self, f):
f.write('\n***********************************************************\n')
f.write('** Self weight\n')
f.write('** written by {} function\n'.format(sys._getframe().f_code.co_name))
for femobj in self.selfweight_objects: # femobj --> dict, FreeCAD document object is femobj['Object']
selwei_obj_name = femobj['Object'].Name
f.write('** ' + selwei_obj_name + '\n')
f.write('*DLOAD\n')
f.write('Eall,GRAV,9810,0,0,-1\n')
f.write('\n')
# die grav (erdbeschleunigung) ist fuer alle gleich
# die verschidene density wurde in den material sets geschrieben !
def write_constraints_force(self, f):
# check shape type of reference shape and get node loads
self.get_constraints_force_nodeloads()

View File

@ -165,6 +165,10 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
# set of fixed constraints from the analysis. Updated with update_objects
# Individual constraints are "Fem::ConstraintFixed" type
self.fixed_constraints = []
## @var selfweight_constraints
# set of selfweight constraints from the analysis. Updated with update_objects
# Individual constraints are Proxy.Type "FemConstraintSelfWeight"
self.selfweight_constraints = []
## @var force_constraints
# set of force constraints from the analysis. Updated with update_objects
# Individual constraints are "Fem::ConstraintForce" type
@ -215,6 +219,10 @@ class FemTools(QtCore.QRunnable, QtCore.QObject):
fixed_constraint_dict = {}
fixed_constraint_dict['Object'] = m
self.fixed_constraints.append(fixed_constraint_dict)
elif hasattr(m, "Proxy") and m.Proxy.Type == "FemConstraintSelfWeight":
selfweight_dict = {}
selfweight_dict['Object'] = m
self.selfweight_constraints.append(selfweight_dict)
elif m.isDerivedFrom("Fem::ConstraintForce"):
force_constraint_dict = {}
force_constraint_dict['Object'] = m

View File

@ -90,7 +90,7 @@ class FemToolsCcx(FemTools.FemTools):
inp_writer = iw.FemInputWriterCcx(self.analysis, self.solver,
self.mesh, self.materials,
self.fixed_constraints,
self.force_constraints, self.pressure_constraints,
self.selfweight_constraints, self.force_constraints, self.pressure_constraints,
self.displacement_constraints,
self.beam_sections, self.shell_thicknesses,
self.analysis_type, self.eigenmode_parameters,