FEM: calculix solver: better handling of iterations control parameter and

add them to FEM unit test
This commit is contained in:
Bernd Hahnebach 2016-08-01 21:58:44 +01:00 committed by wmayer
parent 1c4bd96e34
commit 2fb6d51f9f
3 changed files with 42 additions and 8 deletions

View File

@ -365,10 +365,11 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
elif self.solver_obj.GeometricalNonlinearity == "nonlinear" and self.analysis_type == 'frequency': elif self.solver_obj.GeometricalNonlinearity == "nonlinear" and self.analysis_type == 'frequency':
print('Analysis type frequency and geometrical nonlinear analyis are not allowed together, linear is used instead!') print('Analysis type frequency and geometrical nonlinear analyis are not allowed together, linear is used instead!')
f.write(static_frequency_step + '\n') f.write(static_frequency_step + '\n')
if self.solver_obj.IterationsControlParameterTimeUse:
f.write('*CONTROLS, PARAMETERS=TIME INCREMENTATION\n') f.write('*CONTROLS, PARAMETERS=TIME INCREMENTATION\n')
f.write('4,8,9,200,10,400,,200,\n') f.write(self.solver_obj.IterationsControlParameterIter + '\n')
f.write('0.25,0.5,0.75,0.85,,,1.5,\n') f.write(self.solver_obj.IterationsControlParameterCutb + '\n')
f.write('*STATIC') analysis_static = '*STATIC'
if self.solver_obj.MatrixSolverType == "default": if self.solver_obj.MatrixSolverType == "default":
pass pass
elif self.solver_obj.MatrixSolverType == "spooles": elif self.solver_obj.MatrixSolverType == "spooles":
@ -388,10 +389,10 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
thermomech_step += ', NLGEOM' thermomech_step += ', NLGEOM'
thermomech_step += ', INC=' + str(self.solver_obj.IterationsMaximum) thermomech_step += ', INC=' + str(self.solver_obj.IterationsMaximum)
f.write(thermomech_step + '\n') f.write(thermomech_step + '\n')
f.write(step) if self.solver_obj.IterationsControlParameterTimeUse:
f.write('*CONTROLS, PARAMETERS=TIME INCREMENTATION\n') f.write('*CONTROLS, PARAMETERS=TIME INCREMENTATION\n')
f.write('4,8,9,200,10,400,,200,\n') f.write(self.solver_obj.IterationsControlParameterIter + '\n')
f.write('0.25,0.5,0.75,0.85,,,1.5,\n') f.write(self.solver_obj.IterationsControlParameterCutb + '\n')
def write_constraints_fixed(self, f): def write_constraints_fixed(self, f):
f.write('\n***********************************************************\n') f.write('\n***********************************************************\n')

View File

@ -78,6 +78,7 @@ class FemTest(unittest.TestCase):
self.solver_object.GeometricalNonlinearity = 'linear' self.solver_object.GeometricalNonlinearity = 'linear'
self.solver_object.SteadyState = True self.solver_object.SteadyState = True
self.solver_object.MatrixSolverType = 'default' self.solver_object.MatrixSolverType = 'default'
self.solver_object.IterationsControlParameterTimeUse = False
self.active_doc.recompute() self.active_doc.recompute()
def create_new_mesh(self): def create_new_mesh(self):

View File

@ -89,6 +89,38 @@ class _FemSolverCalculix():
sted = ccx_prefs.GetBool("StaticAnalysis", True) sted = ccx_prefs.GetBool("StaticAnalysis", True)
obj.SteadyState = (sted) obj.SteadyState = (sted)
obj.addProperty("App::PropertyBool", "IterationsControlParameterTimeUse", "Fem", "Use the user defined time incrementation control parameter")
obj.IterationsControlParameterTimeUse = False
ccx_default_time_incrementation_control_parameter = {
# iteration parameter
'I_0': 4,
'I_R': 8,
'I_P': 9,
'I_C': 200, # ccx default = 16
'I_L': 10,
'I_G': 400, # ccx default = 4
'I_S': None,
'I_A': 200, # ccx default = 5
'I_J': None,
'I_T': None,
# cutback parameter
'D_f': 0.25,
'D_C': 0.5,
'D_B': 0.75,
'D_A': 0.85,
'D_S': None,
'D_H': None,
'D_D': 1.5,
'W_G': None}
p = ccx_default_time_incrementation_control_parameter
p_iter = '{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}'.format(p['I_0'], p['I_R'], p['I_P'], p['I_C'], p['I_L'], p['I_G'], '', p['I_A'], '', '')
p_cutb = '{0},{1},{2},{3},{4},{5},{6},{7}'.format(p['D_f'], p['D_C'], p['D_B'], p['D_A'], '', '', p['D_D'], '')
obj.addProperty("App::PropertyString", "IterationsControlParameterIter", "Fem", "User defined time incrementation iterations control parameter")
obj.IterationsControlParameterIter = p_iter
obj.addProperty("App::PropertyString", "IterationsControlParameterCutb", "Fem", "User defined time incrementation cutbacks control parameter")
obj.IterationsControlParameterCutb = p_cutb
known_ccx_solver_types = ["default", "spooles", "iterativescaling", "iterativecholesky"] known_ccx_solver_types = ["default", "spooles", "iterativescaling", "iterativecholesky"]
obj.addProperty("App::PropertyEnumeration", "MatrixSolverType", "Fem", "Type of solver to use") obj.addProperty("App::PropertyEnumeration", "MatrixSolverType", "Fem", "Type of solver to use")
obj.MatrixSolverType = known_ccx_solver_types obj.MatrixSolverType = known_ccx_solver_types