FEM: solver object CalculiX: add new attributes and use defaults from prefs

and fix FEM unit tests
This commit is contained in:
Bernd Hahnebach 2016-08-01 21:57:20 +01:00 committed by wmayer
parent 66a71b1a35
commit 81e9e8b3be
3 changed files with 26 additions and 1 deletions

View File

@ -35,7 +35,6 @@ from PySide import QtCore
class FemToolsCcx(FemTools.FemTools):
known_analysis_types = ["static", "frequency"]
known_geom_nonlinear_types = ["linear", "nonlinear"]
finished = QtCore.Signal(int)
## The constructor

View File

@ -75,6 +75,9 @@ class FemTest(unittest.TestCase):
def create_new_solver(self):
self.solver_object = FemSolverCalculix.makeFemSolverCalculix('CalculiX')
self.solver_object.GeometricalNonlinearity = 'linear'
self.solver_object.SteadyState = True
self.solver_object.MatrixSolverType = 'default'
self.active_doc.recompute()
def create_new_mesh(self):

View File

@ -41,6 +41,7 @@ class _FemSolverCalculix():
obj.SolverType = str(self.Type)
fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem")
ccx_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx")
obj.addProperty("App::PropertyPath", "WorkingDir", "Fem", "Working directory for calculations")
obj.WorkingDir = fem_prefs.GetString("WorkingDir", "")
@ -72,6 +73,28 @@ class _FemSolverCalculix():
ehl = ccx_prefs.GetFloat("EigenmodeHighLimit", 1000000.0)
obj.EigenmodeHighLimit = (ehl, 0.0, 1000000.0, 10000.0)
obj.addProperty("App::PropertyIntegerConstraint", "Maxiterations", "Fem", "Number of iterations allowed before stopping jobs")
niter = ccx_prefs.GetInt("AnalysisMaxIterations", 200)
obj.Maxiterations = (niter)
obj.addProperty("App::PropertyFloatConstraint", "InitialTimeStep", "Fem", "Initial time steps")
ini = ccx_prefs.GetFloat("AnalysisInitialTimeStep", 1.0)
obj.InitialTimeStep = (ini)
obj.addProperty("App::PropertyFloatConstraint", "EndTime", "Fem", "Initial time steps")
eni = ccx_prefs.GetFloat("AnalysisTime", 1.0)
obj.EndTime = (eni)
obj.addProperty("App::PropertyBool", "SteadyState", "Fem", "Run steady state or transient analysis")
sted = ccx_prefs.GetBool("StaticAnalysis", True)
obj.SteadyState = (sted)
known_ccx_solver_types = ["default", "spooles", "iterativescaling", "iterativecholesky"]
obj.addProperty("App::PropertyEnumeration", "MatrixSolverType", "Fem", "Type of solver to use")
obj.MatrixSolverType = known_ccx_solver_types
solver_type = ccx_prefs.GetInt("Solver", 0)
obj.MatrixSolverType = known_ccx_solver_types[solver_type]
def execute(self, obj):
return