FEM: code formating, max line length < 100, fem solver
This commit is contained in:
@@ -58,16 +58,27 @@ class Proxy(solverbase.Proxy):
|
||||
super(Proxy, self).__init__(obj)
|
||||
obj.Proxy = self
|
||||
|
||||
# fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General") # not needed ATM
|
||||
# not needed ATM
|
||||
# fem_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/General")
|
||||
ccx_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Ccx")
|
||||
|
||||
obj.addProperty("App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis")
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"AnalysisType",
|
||||
"Fem",
|
||||
"Type of the analysis"
|
||||
)
|
||||
obj.AnalysisType = ANALYSIS_TYPES
|
||||
analysis_type = ccx_prefs.GetInt("AnalysisType", 0)
|
||||
obj.AnalysisType = ANALYSIS_TYPES[analysis_type]
|
||||
|
||||
choices_geom_nonlinear = ["linear", "nonlinear"]
|
||||
obj.addProperty("App::PropertyEnumeration", "GeometricalNonlinearity", "Fem", "Set geometrical nonlinearity")
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"GeometricalNonlinearity",
|
||||
"Fem",
|
||||
"Set geometrical nonlinearity"
|
||||
)
|
||||
obj.GeometricalNonlinearity = choices_geom_nonlinear
|
||||
nonlinear_geom = ccx_prefs.GetBool("NonlinearGeometry", False)
|
||||
if nonlinear_geom is True:
|
||||
@@ -76,43 +87,93 @@ class Proxy(solverbase.Proxy):
|
||||
obj.GeometricalNonlinearity = choices_geom_nonlinear[0] # linear
|
||||
|
||||
choices_material_nonlinear = ["linear", "nonlinear"]
|
||||
obj.addProperty("App::PropertyEnumeration", "MaterialNonlinearity", "Fem", "Set material nonlinearity (needs geometrical nonlinearity)")
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"MaterialNonlinearity",
|
||||
"Fem",
|
||||
"Set material nonlinearity (needs geometrical nonlinearity)"
|
||||
)
|
||||
obj.MaterialNonlinearity = choices_material_nonlinear
|
||||
obj.MaterialNonlinearity = choices_material_nonlinear[0]
|
||||
|
||||
obj.addProperty("App::PropertyIntegerConstraint", "EigenmodesCount", "Fem", "Number of modes for frequency calculations")
|
||||
obj.addProperty(
|
||||
"App::PropertyIntegerConstraint",
|
||||
"EigenmodesCount",
|
||||
"Fem",
|
||||
"Number of modes for frequency calculations"
|
||||
)
|
||||
noe = ccx_prefs.GetInt("EigenmodesCount", 10)
|
||||
obj.EigenmodesCount = (noe, 1, 100, 1)
|
||||
|
||||
obj.addProperty("App::PropertyFloatConstraint", "EigenmodeLowLimit", "Fem", "Low frequency limit for eigenmode calculations")
|
||||
obj.addProperty(
|
||||
"App::PropertyFloatConstraint",
|
||||
"EigenmodeLowLimit",
|
||||
"Fem",
|
||||
"Low frequency limit for eigenmode calculations"
|
||||
)
|
||||
ell = ccx_prefs.GetFloat("EigenmodeLowLimit", 0.0)
|
||||
obj.EigenmodeLowLimit = (ell, 0.0, 1000000.0, 10000.0)
|
||||
|
||||
obj.addProperty("App::PropertyFloatConstraint", "EigenmodeHighLimit", "Fem", "High frequency limit for eigenmode calculations")
|
||||
obj.addProperty(
|
||||
"App::PropertyFloatConstraint",
|
||||
"EigenmodeHighLimit",
|
||||
"Fem",
|
||||
"High frequency limit for eigenmode calculations"
|
||||
)
|
||||
ehl = ccx_prefs.GetFloat("EigenmodeHighLimit", 1000000.0)
|
||||
obj.EigenmodeHighLimit = (ehl, 0.0, 1000000.0, 10000.0)
|
||||
|
||||
obj.addProperty("App::PropertyIntegerConstraint", "IterationsThermoMechMaximum", "Fem", "Maximum Number of thermo mechanical iterations in each time step before stopping jobs")
|
||||
obj.addProperty(
|
||||
"App::PropertyIntegerConstraint",
|
||||
"IterationsThermoMechMaximum",
|
||||
"Fem",
|
||||
"Maximum Number of thermo mechanical iterations in each time step before stopping job"
|
||||
)
|
||||
niter = ccx_prefs.GetInt("AnalysisMaxIterations", 200)
|
||||
obj.IterationsThermoMechMaximum = niter
|
||||
|
||||
obj.addProperty("App::PropertyFloatConstraint", "TimeInitialStep", "Fem", "Initial time steps")
|
||||
obj.addProperty(
|
||||
"App::PropertyFloatConstraint",
|
||||
"TimeInitialStep",
|
||||
"Fem",
|
||||
"Initial time steps"
|
||||
)
|
||||
ini = ccx_prefs.GetFloat("AnalysisTimeInitialStep", 1.0)
|
||||
obj.TimeInitialStep = ini
|
||||
|
||||
obj.addProperty("App::PropertyFloatConstraint", "TimeEnd", "Fem", "End time analysis")
|
||||
obj.addProperty(
|
||||
"App::PropertyFloatConstraint",
|
||||
"TimeEnd",
|
||||
"Fem",
|
||||
"End time analysis"
|
||||
)
|
||||
eni = ccx_prefs.GetFloat("AnalysisTime", 1.0)
|
||||
obj.TimeEnd = eni
|
||||
|
||||
obj.addProperty("App::PropertyBool", "ThermoMechSteadyState", "Fem", "Choose between steady state thermo mech or transient thermo mech analysis")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"ThermoMechSteadyState",
|
||||
"Fem",
|
||||
"Choose between steady state thermo mech or transient thermo mech analysis"
|
||||
)
|
||||
sted = ccx_prefs.GetBool("StaticAnalysis", True)
|
||||
obj.ThermoMechSteadyState = sted
|
||||
|
||||
obj.addProperty("App::PropertyBool", "IterationsControlParameterTimeUse", "Fem", "Use the user defined time incrementation control parameter")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"IterationsControlParameterTimeUse",
|
||||
"Fem",
|
||||
"Use the user defined time incrementation control parameter"
|
||||
)
|
||||
use_non_ccx_iterations_param = ccx_prefs.GetInt("UseNonCcxIterationParam", False)
|
||||
obj.IterationsControlParameterTimeUse = use_non_ccx_iterations_param
|
||||
|
||||
obj.addProperty("App::PropertyBool", "SplitInputWriter", "Fem", "Split writing of ccx input file")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"SplitInputWriter",
|
||||
"Fem",
|
||||
"Split writing of ccx input file"
|
||||
)
|
||||
split = ccx_prefs.GetBool("SplitInputWriter", False)
|
||||
obj.SplitInputWriter = split
|
||||
|
||||
@@ -138,28 +199,88 @@ class Proxy(solverbase.Proxy):
|
||||
'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")
|
||||
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.addProperty(
|
||||
"App::PropertyString",
|
||||
"IterationsControlParameterCutb",
|
||||
"Fem",
|
||||
"User defined time incrementation cutbacks control parameter"
|
||||
)
|
||||
obj.IterationsControlParameterCutb = p_cutb
|
||||
|
||||
stringIterationsUserDefinedIncrementations = "Set to True to switch off the ccx automatic incrementation completely (ccx parameter DIRECT). Use with care. Analysis may not converge!"
|
||||
obj.addProperty("App::PropertyBool", "IterationsUserDefinedIncrementations", "Fem", stringIterationsUserDefinedIncrementations)
|
||||
stringIterationsUserDefinedIncrementations = (
|
||||
"Set to True to switch off the ccx automatic incrementation completely "
|
||||
"(ccx parameter DIRECT). Use with care. Analysis may not converge!"
|
||||
)
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"IterationsUserDefinedIncrementations",
|
||||
"Fem",
|
||||
stringIterationsUserDefinedIncrementations)
|
||||
obj.IterationsUserDefinedIncrementations = False
|
||||
|
||||
stringIterationsUserDefinedTimeStepLength = "Set to True to use the user defined time steps. The time steps are set with TimeInitialStep and TimeEnd"
|
||||
obj.addProperty("App::PropertyBool", "IterationsUserDefinedTimeStepLength", "Fem", stringIterationsUserDefinedTimeStepLength)
|
||||
stringIterationsUserDefinedTimeStepLength = (
|
||||
"Set to True to use the user defined time steps. "
|
||||
"The time steps are set with TimeInitialStep and TimeEnd"
|
||||
)
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"IterationsUserDefinedTimeStepLength",
|
||||
"Fem",
|
||||
stringIterationsUserDefinedTimeStepLength
|
||||
)
|
||||
obj.IterationsUserDefinedTimeStepLength = False
|
||||
|
||||
known_ccx_solver_types = ["default", "spooles", "iterativescaling", "iterativecholesky"]
|
||||
obj.addProperty("App::PropertyEnumeration", "MatrixSolverType", "Fem", "Type of solver to use")
|
||||
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]
|
||||
|
||||
obj.addProperty("App::PropertyBool", "BeamShellResultOutput3D", "Fem", "Output 3D results for 1D and 2D analysis ")
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"BeamShellResultOutput3D",
|
||||
"Fem",
|
||||
"Output 3D results for 1D and 2D analysis "
|
||||
)
|
||||
dimout = ccx_prefs.GetBool("BeamShellOutput", False)
|
||||
obj.BeamShellResultOutput3D = dimout
|
||||
|
||||
|
||||
Reference in New Issue
Block a user