| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | __title__ = "FreeCAD FEM calculix write inpfile step equation" |
| | __author__ = "Bernd Hahnebach" |
| | __url__ = "https://www.freecad.org" |
| |
|
| |
|
| | import FreeCAD |
| |
|
| |
|
| | def write_step_equation(f, ccxwriter): |
| |
|
| | f.write("\n{}\n".format(59 * "*")) |
| | f.write("** At least one step is needed to run an CalculiX analysis of FreeCAD\n") |
| |
|
| | |
| | step = "*STEP" |
| | if ccxwriter.solver_obj.GeometricalNonlinearity == "nonlinear": |
| | if ccxwriter.analysis_type in ["static", "thermomech"]: |
| | |
| | step += ", NLGEOM" |
| | elif ccxwriter.analysis_type == "frequency": |
| | FreeCAD.Console.PrintMessage( |
| | "Analysis type frequency and geometrical nonlinear " |
| | "analysis are not allowed together, linear is used instead!\n" |
| | ) |
| |
|
| | if ccxwriter.solver_obj.IncrementsMaximum: |
| | if ccxwriter.analysis_type in ["static", "thermomech", "electromagnetic"]: |
| | step += f", INC={ccxwriter.solver_obj.IncrementsMaximum}" |
| |
|
| | |
| | f.write(step + "\n") |
| |
|
| | |
| | |
| | if ccxwriter.solver_obj.IterationsControlParameterTimeUse: |
| | f.write("*CONTROLS, PARAMETERS=TIME INCREMENTATION\n") |
| | f.write(ccxwriter.solver_obj.IterationsControlParameterIter + "\n") |
| | f.write(ccxwriter.solver_obj.IterationsControlParameterCutb + "\n") |
| |
|
| | |
| | |
| | analysis_type = "" |
| | if ccxwriter.analysis_type == "static": |
| | analysis_type = "*STATIC" |
| | elif ccxwriter.analysis_type == "frequency": |
| | analysis_type = "*FREQUENCY" |
| | elif ccxwriter.analysis_type == "thermomech": |
| | if ccxwriter.solver_obj.ThermoMechType == "coupled": |
| | analysis_type = "*COUPLED TEMPERATURE-DISPLACEMENT" |
| | elif ccxwriter.solver_obj.ThermoMechType == "uncoupled": |
| | analysis_type = "*UNCOUPLED TEMPERATURE-DISPLACEMENT" |
| | elif ccxwriter.solver_obj.ThermoMechType == "pure heat transfer": |
| | analysis_type = "*HEAT TRANSFER" |
| | if ccxwriter.solver_obj.ThermoMechSteadyState: |
| | analysis_type += ", STEADY STATE" |
| | elif ccxwriter.analysis_type == "check": |
| | analysis_type = "*NO ANALYSIS" |
| | elif ccxwriter.analysis_type == "buckling": |
| | analysis_type = "*BUCKLE" |
| | elif ccxwriter.analysis_type == "electromagnetic": |
| | if ccxwriter.solver_obj.ElectromagneticMode == "electrostatic": |
| | analysis_type = "*HEAT TRANSFER, STEADY STATE" |
| |
|
| | |
| | |
| | if ccxwriter.solver_obj.MatrixSolverType == "default": |
| | pass |
| | elif ccxwriter.solver_obj.MatrixSolverType == "pastix": |
| | analysis_type += ", SOLVER=PASTIX" |
| | elif ccxwriter.solver_obj.MatrixSolverType == "pardiso": |
| | analysis_type += ", SOLVER=PARDISO" |
| | elif ccxwriter.solver_obj.MatrixSolverType == "spooles": |
| | analysis_type += ", SOLVER=SPOOLES" |
| | elif ccxwriter.solver_obj.MatrixSolverType == "iterativescaling": |
| | analysis_type += ", SOLVER=ITERATIVE SCALING" |
| | elif ccxwriter.solver_obj.MatrixSolverType == "iterativecholesky": |
| | analysis_type += ", SOLVER=ITERATIVE CHOLESKY" |
| |
|
| | |
| | |
| | if not ccxwriter.solver_obj.AutomaticIncrementation: |
| | if ccxwriter.analysis_type in ["static", "thermomech", "electromagnetic"]: |
| | analysis_type += ", DIRECT" |
| |
|
| | |
| | analysis_parameter = "" |
| | if ccxwriter.analysis_type in ["static", "thermomech", "electromagnetic"]: |
| | analysis_parameter = "{},{},{},{}".format( |
| | ccxwriter.solver_obj.TimeInitialIncrement.getValueAs("s").Value, |
| | ccxwriter.solver_obj.TimePeriod.getValueAs("s").Value, |
| | ccxwriter.solver_obj.TimeMinimumIncrement.getValueAs("s").Value, |
| | ccxwriter.solver_obj.TimeMaximumIncrement.getValueAs("s").Value, |
| | ) |
| | elif ccxwriter.analysis_type == "frequency": |
| | if ( |
| | ccxwriter.solver_obj.EigenmodeLowLimit == 0.0 |
| | and ccxwriter.solver_obj.EigenmodeHighLimit == 0.0 |
| | ): |
| | analysis_parameter = f"{ccxwriter.solver_obj.EigenmodesCount}\n" |
| | else: |
| | analysis_parameter = "{},{},{}\n".format( |
| | ccxwriter.solver_obj.EigenmodesCount, |
| | ccxwriter.solver_obj.EigenmodeLowLimit.getValueAs("Hz").Value, |
| | ccxwriter.solver_obj.EigenmodeHighLimit.getValueAs("Hz").Value, |
| | ) |
| | elif ccxwriter.analysis_type == "buckling": |
| | analysis_parameter = "{},{}".format( |
| | ccxwriter.solver_obj.BucklingFactors, |
| | ccxwriter.solver_obj.BucklingAccuracy, |
| | ) |
| | elif ccxwriter.analysis_type == "check": |
| | analysis_parameter = "" |
| |
|
| | |
| | f.write(analysis_type + "\n") |
| | f.write(analysis_parameter + "\n") |
| |
|
| |
|
| | def write_step_end(f, ccxwriter): |
| | f.write("\n{}\n".format(59 * "*")) |
| | f.write("*END STEP\n") |
| |
|