From 6555bdc83c580cb162b76812b9af498c19f39d5b Mon Sep 17 00:00:00 2001 From: Florian Foinant-Willig Date: Sun, 16 Mar 2025 22:45:44 +0100 Subject: [PATCH] Fem: Prevent user to remove core properties --- src/Mod/Fem/femsolver/calculix/solver.py | 62 ++++++++++++++++--- .../femsolver/elmer/equations/deformation.py | 24 ++++++- .../femsolver/elmer/equations/elasticity.py | 57 ++++++++++++++--- .../elmer/equations/elasticity_writer.py | 31 +++++++++- .../elmer/equations/electricforce.py | 1 + .../elmer/equations/electricforce_writer.py | 1 + .../elmer/equations/electrostatic.py | 25 ++++++-- .../elmer/equations/electrostatic_writer.py | 3 + .../Fem/femsolver/elmer/equations/equation.py | 1 + src/Mod/Fem/femsolver/elmer/equations/flow.py | 19 +++++- .../femsolver/elmer/equations/flow_writer.py | 11 +++- src/Mod/Fem/femsolver/elmer/equations/flux.py | 34 ++++++++-- .../femsolver/elmer/equations/flux_writer.py | 14 ++++- src/Mod/Fem/femsolver/elmer/equations/heat.py | 14 ++++- .../femsolver/elmer/equations/heat_writer.py | 7 ++- .../Fem/femsolver/elmer/equations/linear.py | 30 ++++++--- .../elmer/equations/magnetodynamic.py | 38 ++++++++---- .../elmer/equations/magnetodynamic2D.py | 44 ++++++++++--- .../femsolver/elmer/equations/nonlinear.py | 13 +++- .../elmer/equations/staticcurrent.py | 23 +++++-- src/Mod/Fem/femsolver/elmer/solver.py | 38 +++++++++--- src/Mod/Fem/femsolver/elmer/writer.py | 12 +++- src/Mod/Fem/femsolver/equationbase.py | 2 +- src/Mod/Fem/femsolver/mystran/solver.py | 4 +- 24 files changed, 421 insertions(+), 87 deletions(-) diff --git a/src/Mod/Fem/femsolver/calculix/solver.py b/src/Mod/Fem/femsolver/calculix/solver.py index c982e4553a..ff18bb01b8 100644 --- a/src/Mod/Fem/femsolver/calculix/solver.py +++ b/src/Mod/Fem/femsolver/calculix/solver.py @@ -66,7 +66,11 @@ class _BaseSolverCalculix: def add_attributes(self, obj): if not hasattr(obj, "AnalysisType"): obj.addProperty( - "App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis" + "App::PropertyEnumeration", + "AnalysisType", + "Fem", + "Type of the analysis", + locked=True, ) obj.AnalysisType = ANALYSIS_TYPES obj.AnalysisType = ANALYSIS_TYPES[0] @@ -78,6 +82,7 @@ class _BaseSolverCalculix: "GeometricalNonlinearity", "Fem", "Set geometrical nonlinearity", + locked=True, ) obj.GeometricalNonlinearity = choices_geom_nonlinear obj.GeometricalNonlinearity = choices_geom_nonlinear[0] @@ -89,6 +94,7 @@ class _BaseSolverCalculix: "MaterialNonlinearity", "Fem", "Set material nonlinearity", + locked=True, ) obj.MaterialNonlinearity = choices_material_nonlinear obj.MaterialNonlinearity = choices_material_nonlinear[0] @@ -99,6 +105,7 @@ class _BaseSolverCalculix: "EigenmodesCount", "Fem", "Number of modes for frequency calculations", + locked=True, ) obj.EigenmodesCount = (10, 1, 100, 1) @@ -108,6 +115,7 @@ class _BaseSolverCalculix: "EigenmodeLowLimit", "Fem", "Low frequency limit for eigenmode calculations", + locked=True, ) obj.EigenmodeLowLimit = (0.0, 0.0, 1000000.0, 10000.0) @@ -117,6 +125,7 @@ class _BaseSolverCalculix: "EigenmodeHighLimit", "Fem", "High frequency limit for eigenmode calculations", + locked=True, ) obj.EigenmodeHighLimit = (1000000.0, 0.0, 1000000.0, 10000.0) @@ -129,6 +138,7 @@ class _BaseSolverCalculix: "IterationsMaximum", "Fem", help_string_IterationsMaximum, + locked=True, ) obj.IterationsMaximum = 2000 @@ -142,28 +152,43 @@ class _BaseSolverCalculix: "BucklingFactors", "Fem", "Calculates the lowest buckling modes to the corresponding buckling factors", + locked=True, ) obj.BucklingFactors = 1 if not hasattr(obj, "TimeInitialStep"): obj.addProperty( - "App::PropertyFloatConstraint", "TimeInitialStep", "Fem", "Initial time steps" + "App::PropertyFloatConstraint", + "TimeInitialStep", + "Fem", + "Initial time steps", + locked=True, ) obj.TimeInitialStep = 0.01 if not hasattr(obj, "TimeEnd"): - obj.addProperty("App::PropertyFloatConstraint", "TimeEnd", "Fem", "End time analysis") + obj.addProperty( + "App::PropertyFloatConstraint", "TimeEnd", "Fem", "End time analysis", locked=True + ) obj.TimeEnd = 1.0 if not hasattr(obj, "TimeMinimumStep"): obj.addProperty( - "App::PropertyFloatConstraint", "TimeMinimumStep", "Fem", "Minimum time step" + "App::PropertyFloatConstraint", + "TimeMinimumStep", + "Fem", + "Minimum time step", + locked=True, ) obj.TimeMinimumStep = 0.00001 if not hasattr(obj, "TimeMaximumStep"): obj.addProperty( - "App::PropertyFloatConstraint", "TimeMaximumStep", "Fem", "Maximum time step" + "App::PropertyFloatConstraint", + "TimeMaximumStep", + "Fem", + "Maximum time step", + locked=True, ) obj.TimeMaximumStep = 1.0 @@ -173,6 +198,7 @@ class _BaseSolverCalculix: "ThermoMechSteadyState", "Fem", "Choose between steady state thermo mech or transient thermo mech analysis", + locked=True, ) obj.ThermoMechSteadyState = True @@ -182,12 +208,17 @@ class _BaseSolverCalculix: "IterationsControlParameterTimeUse", "Fem", "Use the user defined time incrementation control parameter", + locked=True, ) obj.IterationsControlParameterTimeUse = False if not hasattr(obj, "SplitInputWriter"): obj.addProperty( - "App::PropertyBool", "SplitInputWriter", "Fem", "Split writing of ccx input file" + "App::PropertyBool", + "SplitInputWriter", + "Fem", + "Split writing of ccx input file", + locked=True, ) obj.SplitInputWriter = False @@ -211,6 +242,7 @@ class _BaseSolverCalculix: "IterationsControlParameterIter", "Fem", "User defined time incrementation iterations control parameter", + locked=True, ) obj.IterationsControlParameterIter = control_parameter_iterations @@ -230,6 +262,7 @@ class _BaseSolverCalculix: "IterationsControlParameterCutb", "Fem", "User defined time incrementation cutbacks control parameter", + locked=True, ) obj.IterationsControlParameterCutb = control_parameter_cutback @@ -243,6 +276,7 @@ class _BaseSolverCalculix: "IterationsUserDefinedIncrementations", "Fem", stringIterationsUserDefinedIncrementations, + locked=True, ) obj.IterationsUserDefinedIncrementations = False @@ -256,6 +290,7 @@ class _BaseSolverCalculix: "IterationsUserDefinedTimeStepLength", "Fem", help_string_IterationsUserDefinedTimeStepLength, + locked=True, ) obj.IterationsUserDefinedTimeStepLength = False @@ -269,7 +304,11 @@ class _BaseSolverCalculix: "iterativecholesky", ] obj.addProperty( - "App::PropertyEnumeration", "MatrixSolverType", "Fem", "Type of solver to use" + "App::PropertyEnumeration", + "MatrixSolverType", + "Fem", + "Type of solver to use", + locked=True, ) obj.MatrixSolverType = known_ccx_solver_types obj.MatrixSolverType = known_ccx_solver_types[0] @@ -280,6 +319,7 @@ class _BaseSolverCalculix: "BeamShellResultOutput3D", "Fem", "Output 3D results for 1D and 2D analysis ", + locked=True, ) obj.BeamShellResultOutput3D = True @@ -289,6 +329,7 @@ class _BaseSolverCalculix: "BeamReducedIntegration", "Fem", "Set to True to use beam elements with reduced integration", + locked=True, ) obj.BeamReducedIntegration = True @@ -298,12 +339,15 @@ class _BaseSolverCalculix: "OutputFrequency", "Fem", "Set the output frequency in increments", + locked=True, ) obj.OutputFrequency = 1 if not hasattr(obj, "ModelSpace"): model_space_types = ["3D", "plane stress", "plane strain", "axisymmetric"] - obj.addProperty("App::PropertyEnumeration", "ModelSpace", "Fem", "Type of model space") + obj.addProperty( + "App::PropertyEnumeration", "ModelSpace", "Fem", "Type of model space", locked=True + ) obj.ModelSpace = model_space_types if not hasattr(obj, "ThermoMechType"): @@ -313,6 +357,7 @@ class _BaseSolverCalculix: "ThermoMechType", "Fem", "Type of thermomechanical analysis", + locked=True, ) obj.ThermoMechType = thermomech_types @@ -322,6 +367,7 @@ class _BaseSolverCalculix: "BucklingAccuracy", "Fem", "Accuracy for buckling analysis", + locked=True, ) obj.BucklingAccuracy = 0.01 diff --git a/src/Mod/Fem/femsolver/elmer/equations/deformation.py b/src/Mod/Fem/femsolver/elmer/equations/deformation.py index 6b4da216cb..9448a0e2f9 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/deformation.py +++ b/src/Mod/Fem/femsolver/elmer/equations/deformation.py @@ -45,37 +45,53 @@ class Proxy(nonlinear.Proxy, equationbase.DeformationProxy): super().__init__(obj) obj.addProperty( - "App::PropertyBool", "CalculatePangle", "Deformation", "Compute principal stress angles" + "App::PropertyBool", + "CalculatePangle", + "Deformation", + "Compute principal stress angles", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculatePrincipal", "Deformation", "Compute principal stress components", + locked=True, ) obj.addProperty( - "App::PropertyBool", "CalculateStrains", "Deformation", "Compute the strain tensor" + "App::PropertyBool", + "CalculateStrains", + "Deformation", + "Compute the strain tensor", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculateStresses", "Deformation", "Compute stress tensor and vanMises", + locked=True, ) obj.addProperty( "App::PropertyBool", "InitializeStateVariables", "Deformation", "See Elmer manual for info", + locked=True, ) obj.addProperty( - "App::PropertyBool", "MixedFormulation", "Deformation", "See Elmer manual for info" + "App::PropertyBool", + "MixedFormulation", + "Deformation", + "See Elmer manual for info", + locked=True, ) obj.addProperty( "App::PropertyBool", "NeoHookeanMaterial", "Deformation", ("Uses the neo-Hookean material model"), + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -85,12 +101,14 @@ class Proxy(nonlinear.Proxy, equationbase.DeformationProxy): "Computes solution according to plane\nstress situation.\n" "Applies only for 2D geometry." ), + locked=True, ) obj.addProperty( "App::PropertyString", "Variable", "Deformation", "Only for a 2D model change the '3' to '2'", + locked=True, ) obj.Priority = 10 diff --git a/src/Mod/Fem/femsolver/elmer/equations/elasticity.py b/src/Mod/Fem/femsolver/elmer/equations/elasticity.py index f77eccdb6e..b76afd4169 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/elasticity.py +++ b/src/Mod/Fem/femsolver/elmer/equations/elasticity.py @@ -55,34 +55,53 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): super().__init__(obj) obj.addProperty( - "App::PropertyBool", "CalculatePangle", "Elasticity", "Compute principal stress angles" + "App::PropertyBool", + "CalculatePangle", + "Elasticity", + "Compute principal stress angles", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculatePrincipal", "Elasticity", "Compute principal stress components", + locked=True, ) obj.addProperty( - "App::PropertyBool", "CalculateStrains", "Elasticity", "Compute the strain tensor" + "App::PropertyBool", + "CalculateStrains", + "Elasticity", + "Compute the strain tensor", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculateStresses", "Elasticity", "Compute stress tensor and vanMises", + locked=True, ) obj.addProperty( - "App::PropertyBool", "ConstantBulkSystem", "Elasticity", "See Elmer manual for info" + "App::PropertyBool", + "ConstantBulkSystem", + "Elasticity", + "See Elmer manual for info", + locked=True, ) obj.addProperty( "App::PropertyBool", "DisplaceMesh", "Elasticity", ("If mesh is deformed by displacement field.\nSet to False for 'Eigen Analysis'."), + locked=True, ) obj.addProperty( - "App::PropertyBool", "EigenAnalysis", "Eigen Values", "If true, modal analysis" + "App::PropertyBool", + "EigenAnalysis", + "Eigen Values", + "If true, modal analysis", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -92,12 +111,14 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "Should be true if eigen system is complex\n" "Must be false for a damped eigen value analysis." ), + locked=True, ) obj.addProperty( "App::PropertyBool", "EigenSystemComputeResiduals", "Eigen Values", "Computes residuals of eigen value system", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -107,18 +128,21 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "Set a damped eigen analysis. Can only be\n" "used if 'Linear Solver Type' is 'Iterative'." ), + locked=True, ) obj.addProperty( "App::PropertyIntegerConstraint", "EigenSystemMaxIterations", "Eigen Values", "Max iterations for iterative eigensystem solver", + locked=True, ) obj.addProperty( "App::PropertyEnumeration", "EigenSystemSelect", "Eigen Values", "Which eigenvalues are computed", + locked=True, ) obj.addProperty( "App::PropertyFloat", @@ -128,21 +152,28 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "Convergence tolerance for iterative eigensystem solve\n" "Default is 100 times the 'Linear Tolerance'" ), + locked=True, ) obj.addProperty( "App::PropertyInteger", "EigenSystemValues", "Eigen Values", "Number of lowest eigen modes", + locked=True, ) obj.addProperty( "App::PropertyBool", "FixDisplacement", "Elasticity", "If displacements or forces are set,\nthereby model lumping is used", + locked=True, ) obj.addProperty( - "App::PropertyBool", "GeometricStiffness", "Elasticity", "Consider geometric stiffness" + "App::PropertyBool", + "GeometricStiffness", + "Elasticity", + "Consider geometric stiffness", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -152,19 +183,24 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "Computation of incompressible material in connection\n" "with viscoelastic Maxwell material and a custom 'Variable'" ), + locked=True, ) obj.addProperty( "App::PropertyBool", "MaxwellMaterial", "Elasticity", "Compute viscoelastic material model", + locked=True, + ) + obj.addProperty( + "App::PropertyBool", "ModelLumping", "Elasticity", "Use model lumping", locked=True ) - obj.addProperty("App::PropertyBool", "ModelLumping", "Elasticity", "Use model lumping") obj.addProperty( "App::PropertyFile", "ModelLumpingFilename", "Elasticity", "File to save results from model lumping to", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -174,9 +210,14 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "If true, 'Eigen Analysis' is stability analysis.\n" "Otherwise modal analysis is performed." ), + locked=True, ) obj.addProperty( - "App::PropertyBool", "UpdateTransientSystem", "Elasticity", "See Elmer manual for info" + "App::PropertyBool", + "UpdateTransientSystem", + "Elasticity", + "See Elmer manual for info", + locked=True, ) obj.addProperty( "App::PropertyString", @@ -186,6 +227,7 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "Only change this if 'Incompressible' is set to true\n" "according to the Elmer manual." ), + locked=True, ) obj.addProperty( @@ -196,6 +238,7 @@ class Proxy(linear.Proxy, equationbase.ElasticityProxy): "Computes solution according to plane\nstress situation.\n" "Applies only for 2D geometry." ), + locked=True, ) obj.EigenSystemValues = 5 diff --git a/src/Mod/Fem/femsolver/elmer/equations/elasticity_writer.py b/src/Mod/Fem/femsolver/elmer/equations/elasticity_writer.py index 7dff410e77..64b06f5018 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/elasticity_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/elasticity_writer.py @@ -110,6 +110,7 @@ class ElasticityWriter: "Only change this if 'Incompressible' is set to true\n" "according to the Elmer manual." ), + locked=True, ) equation.Variable = "Displacement" if hasattr(equation, "Bubbles"): @@ -117,7 +118,11 @@ class ElasticityWriter: equation.removeProperty("Bubbles") if not hasattr(equation, "ConstantBulkSystem"): equation.addProperty( - "App::PropertyBool", "ConstantBulkSystem", "Elasticity", "See Elmer manual for info" + "App::PropertyBool", + "ConstantBulkSystem", + "Elasticity", + "See Elmer manual for info", + locked=True, ) if not hasattr(equation, "DisplaceMesh"): equation.addProperty( @@ -128,6 +133,7 @@ class ElasticityWriter: "If mesh is deformed by displacement field.\n" "Set to False for 'Eigen Analysis'." ), + locked=True, ) # DisplaceMesh is true except if DoFrequencyAnalysis is true equation.DisplaceMesh = True @@ -138,7 +144,11 @@ class ElasticityWriter: # DoFrequencyAnalysis was renamed to EigenAnalysis # to follow the Elmer manual equation.addProperty( - "App::PropertyBool", "EigenAnalysis", "Eigen Values", "If true, modal analysis" + "App::PropertyBool", + "EigenAnalysis", + "Eigen Values", + "If true, modal analysis", + locked=True, ) if hasattr(equation, "DoFrequencyAnalysis"): equation.EigenAnalysis = equation.DoFrequencyAnalysis @@ -152,6 +162,7 @@ class ElasticityWriter: "Should be true if eigen system is complex\n" "Must be false for a damped eigen value analysis." ), + locked=True, ) equation.EigenSystemComplex = True if not hasattr(equation, "EigenSystemComputeResiduals"): @@ -160,6 +171,7 @@ class ElasticityWriter: "EigenSystemComputeResiduals", "Eigen Values", "Computes residuals of eigen value system", + locked=True, ) if not hasattr(equation, "EigenSystemDamped"): equation.addProperty( @@ -170,6 +182,7 @@ class ElasticityWriter: "Set a damped eigen analysis. Can only be\n" "used if 'Linear Solver Type' is 'Iterative'." ), + locked=True, ) if not hasattr(equation, "EigenSystemMaxIterations"): equation.addProperty( @@ -177,6 +190,7 @@ class ElasticityWriter: "EigenSystemMaxIterations", "Eigen Values", "Max iterations for iterative eigensystem solver", + locked=True, ) equation.EigenSystemMaxIterations = (300, 1, int(1e8), 1) if not hasattr(equation, "EigenSystemSelect"): @@ -185,6 +199,7 @@ class ElasticityWriter: "EigenSystemSelect", "Eigen Values", "Which eigenvalues are computed", + locked=True, ) equation.EigenSystemSelect = elasticity.EIGEN_SYSTEM_SELECT equation.EigenSystemSelect = "Smallest Magnitude" @@ -197,6 +212,7 @@ class ElasticityWriter: "Convergence tolerance for iterative eigensystem solve\n" "Default is 100 times the 'Linear Tolerance'" ), + locked=True, ) equation.setExpression("EigenSystemTolerance", str(100 * equation.LinearTolerance)) if not hasattr(equation, "EigenSystemValues"): @@ -207,6 +223,7 @@ class ElasticityWriter: "EigenSystemValues", "Eigen Values", "Number of lowest eigen modes", + locked=True, ) if hasattr(equation, "EigenmodesCount"): equation.EigenSystemValues = equation.EigenmodesCount @@ -217,6 +234,7 @@ class ElasticityWriter: "FixDisplacement", "Elasticity", "If displacements or forces are set,\nthereby model lumping is used", + locked=True, ) if not hasattr(equation, "GeometricStiffness"): equation.addProperty( @@ -224,6 +242,7 @@ class ElasticityWriter: "GeometricStiffness", "Elasticity", "Consider geometric stiffness", + locked=True, ) if not hasattr(equation, "Incompressible"): equation.addProperty( @@ -234,6 +253,7 @@ class ElasticityWriter: "Computation of incompressible material in connection\n" "with viscoelastic Maxwell material and a custom 'Variable'" ), + locked=True, ) if not hasattr(equation, "MaxwellMaterial"): equation.addProperty( @@ -241,10 +261,11 @@ class ElasticityWriter: "MaxwellMaterial", "Elasticity", "Compute viscoelastic material model", + locked=True, ) if not hasattr(equation, "ModelLumping"): equation.addProperty( - "App::PropertyBool", "ModelLumping", "Elasticity", "Use model lumping" + "App::PropertyBool", "ModelLumping", "Elasticity", "Use model lumping", locked=True ) if not hasattr(equation, "ModelLumpingFilename"): equation.addProperty( @@ -252,6 +273,7 @@ class ElasticityWriter: "ModelLumpingFilename", "Elasticity", "File to save results from model lumping to", + locked=True, ) if not hasattr(equation, "PlaneStress"): equation.addProperty( @@ -262,6 +284,7 @@ class ElasticityWriter: "Computes solution according to plane\nstress situation.\n" "Applies only for 2D geometry." ), + locked=True, ) if not hasattr(equation, "StabilityAnalysis"): equation.addProperty( @@ -272,6 +295,7 @@ class ElasticityWriter: "If true, 'Eigen Analysis' is stability analysis.\n" "Otherwise modal analysis is performed." ), + locked=True, ) if not hasattr(equation, "UpdateTransientSystem"): equation.addProperty( @@ -279,6 +303,7 @@ class ElasticityWriter: "UpdateTransientSystem", "Elasticity", "See Elmer manual for info", + locked=True, ) def handleElasticityConstants(self): diff --git a/src/Mod/Fem/femsolver/elmer/equations/electricforce.py b/src/Mod/Fem/femsolver/elmer/equations/electricforce.py index da2cd30b77..165602a347 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/electricforce.py +++ b/src/Mod/Fem/femsolver/elmer/equations/electricforce.py @@ -54,6 +54,7 @@ class Proxy(linear.Proxy, equationbase.ElectricforceProxy): "That solver is only executed after solution converged\n" "To execute always, change to 'Always'" ), + locked=True, ) obj.ExecSolver = SOLVER_EXEC_METHODS diff --git a/src/Mod/Fem/femsolver/elmer/equations/electricforce_writer.py b/src/Mod/Fem/femsolver/elmer/equations/electricforce_writer.py index a3d6fe666d..df63d687aa 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/electricforce_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/electricforce_writer.py @@ -61,6 +61,7 @@ class EFwriter: "That solver is only executed after solution converged\n" "To execute always, change to 'Always'" ), + locked=True, ) equation.ExecSolver = electricforce.SOLVER_EXEC_METHODS equation.ExecSolver = "After Timestep" diff --git a/src/Mod/Fem/femsolver/elmer/equations/electrostatic.py b/src/Mod/Fem/femsolver/elmer/equations/electrostatic.py index 053d217820..11a3ce95ea 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/electrostatic.py +++ b/src/Mod/Fem/femsolver/elmer/equations/electrostatic.py @@ -45,17 +45,27 @@ class Proxy(linear.Proxy, equationbase.ElectrostaticProxy): def __init__(self, obj): super().__init__(obj) - obj.addProperty("App::PropertyBool", "CalculateCapacitanceMatrix", "Electrostatic", "") - obj.addProperty("App::PropertyBool", "CalculateElectricEnergy", "Electrostatic", "") - obj.addProperty("App::PropertyBool", "CalculateElectricField", "Electrostatic", "") - obj.addProperty("App::PropertyBool", "CalculateElectricFlux", "Electrostatic", "") - obj.addProperty("App::PropertyBool", "CalculateSurfaceCharge", "Electrostatic", "") + obj.addProperty( + "App::PropertyBool", "CalculateCapacitanceMatrix", "Electrostatic", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateElectricEnergy", "Electrostatic", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateElectricField", "Electrostatic", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateElectricFlux", "Electrostatic", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateSurfaceCharge", "Electrostatic", "", locked=True + ) """ obj.addProperty( "App::PropertyInteger", "CapacitanceBodies", "Electrostatic", - "" + "", locked=True ) """ obj.addProperty( @@ -66,12 +76,14 @@ class Proxy(linear.Proxy, equationbase.ElectrostaticProxy): "File where capacitance matrix is being saved\n" "Only used if 'CalculateCapacitanceMatrix' is true" ), + locked=True, ) obj.addProperty( "App::PropertyBool", "ConstantWeights", "Electrostatic", "Use constant weighting for results", + locked=True, ) obj.addProperty( "App::PropertyFloat", @@ -81,6 +93,7 @@ class Proxy(linear.Proxy, equationbase.ElectrostaticProxy): "Potential difference in Volt for which capacitance is\n" "calculated if 'CalculateCapacitanceMatrix' is false" ), + locked=True, ) obj.CapacitanceMatrixFilename = "cmatrix.dat" diff --git a/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py b/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py index bc49f4ee05..0d1e93903c 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/electrostatic_writer.py @@ -81,6 +81,7 @@ class ESwriter: "File where capacitance matrix is being saved\n" "Only used if 'CalculateCapacitanceMatrix' is true" ), + locked=True, ) equation.CapacitanceMatrixFilename = "cmatrix.dat" if not hasattr(equation, "ConstantWeights"): @@ -89,6 +90,7 @@ class ESwriter: "ConstantWeights", "Electrostatic", "Use constant weighting for results", + locked=True, ) if not hasattr(equation, "PotentialDifference"): equation.addProperty( @@ -99,6 +101,7 @@ class ESwriter: "Potential difference in Volt for which capacitance is\n" "calculated if 'CalculateCapacitanceMatrix' is false" ), + locked=True, ) equation.PotentialDifference = 0.0 diff --git a/src/Mod/Fem/femsolver/elmer/equations/equation.py b/src/Mod/Fem/femsolver/elmer/equations/equation.py index a7b748fd96..0547869c26 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/equation.py +++ b/src/Mod/Fem/femsolver/elmer/equations/equation.py @@ -50,6 +50,7 @@ class Proxy(equationbase.BaseProxy): "The equation with highest number\n" "will be solved first." ), + locked=True, ) diff --git a/src/Mod/Fem/femsolver/elmer/equations/flow.py b/src/Mod/Fem/femsolver/elmer/equations/flow.py index f401a3a83a..c65265b7f4 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/flow.py +++ b/src/Mod/Fem/femsolver/elmer/equations/flow.py @@ -56,8 +56,11 @@ class Proxy(nonlinear.Proxy, equationbase.FlowProxy): "Set to true for incompressible flow for more stable\n" "discretization when Reynolds number increases" ), + locked=True, + ) + obj.addProperty( + "App::PropertyEnumeration", "FlowModel", "Flow", "Flow model to be used", locked=True ) - obj.addProperty("App::PropertyEnumeration", "FlowModel", "Flow", "Flow model to be used") obj.addProperty( "App::PropertyBool", "GradpDiscretization", @@ -66,13 +69,22 @@ class Proxy(nonlinear.Proxy, equationbase.FlowProxy): "If true pressure Dirichlet boundary conditions can be used.\n" "Also mass flux is available as a natural boundary condition." ), + locked=True, ) obj.addProperty( - "App::PropertyString", "Variable", "Flow", "Only for a 2D model change the '3' to '2'" + "App::PropertyString", + "Variable", + "Flow", + "Only for a 2D model change the '3' to '2'", + locked=True, ) obj.addProperty( - "App::PropertyEnumeration", "Convection", "Equation", "Type of convection to be used" + "App::PropertyEnumeration", + "Convection", + "Equation", + "Type of convection to be used", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -82,6 +94,7 @@ class Proxy(nonlinear.Proxy, equationbase.FlowProxy): "Magnetic induction equation will be solved\n" "along with the Navier-Stokes equations" ), + locked=True, ) obj.FlowModel = FLOW_MODEL obj.FlowModel = "Full" diff --git a/src/Mod/Fem/femsolver/elmer/equations/flow_writer.py b/src/Mod/Fem/femsolver/elmer/equations/flow_writer.py index 05df2f44d4..7c0fdbda45 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/flow_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/flow_writer.py @@ -73,6 +73,7 @@ class Flowwriter: "Convection", "Equation", "Type of convection to be used", + locked=True, ) equation.Convection = flow.CONVECTION_TYPE equation.Convection = "Computed" @@ -85,10 +86,15 @@ class Flowwriter: "Set to true for incompressible flow for more stable\n" "discretization when Reynolds number increases" ), + locked=True, ) if not hasattr(equation, "FlowModel"): equation.addProperty( - "App::PropertyEnumeration", "FlowModel", "Flow", "Flow model to be used" + "App::PropertyEnumeration", + "FlowModel", + "Flow", + "Flow model to be used", + locked=True, ) equation.FlowModel = flow.FLOW_MODEL equation.FlowModel = "Full" @@ -101,6 +107,7 @@ class Flowwriter: "If true pressure Dirichlet boundary conditions can be used.\n" "Also mass flux is available as a natural boundary condition." ), + locked=True, ) if not hasattr(equation, "MagneticInduction"): equation.addProperty( @@ -111,6 +118,7 @@ class Flowwriter: "Magnetic induction equation will be solved\n" "along with the Navier-Stokes equations" ), + locked=True, ) if not hasattr(equation, "Variable"): equation.addProperty( @@ -118,6 +126,7 @@ class Flowwriter: "Variable", "Flow", "Only for a 2D model change the '3' to '2'", + locked=True, ) equation.Variable = "Flow Solution[Velocity:3 Pressure:1]" diff --git a/src/Mod/Fem/femsolver/elmer/equations/flux.py b/src/Mod/Fem/femsolver/elmer/equations/flux.py index e2d897d2c0..75d410c3da 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/flux.py +++ b/src/Mod/Fem/femsolver/elmer/equations/flux.py @@ -57,28 +57,45 @@ class Proxy(linear.Proxy, equationbase.FluxProxy): "Enforces continuity within the same material\n" "in the 'Discontinuous Galerkin' discretization" ), + locked=True, ) - obj.addProperty("App::PropertyBool", "CalculateFlux", "Flux", "Computes flux vector") obj.addProperty( - "App::PropertyBool", "CalculateFluxAbs", "Flux", "Computes absolute of flux vector" + "App::PropertyBool", "CalculateFlux", "Flux", "Computes flux vector", locked=True + ) + obj.addProperty( + "App::PropertyBool", + "CalculateFluxAbs", + "Flux", + "Computes absolute of flux vector", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculateFluxMagnitude", "Flux", "Computes magnitude of flux vector field", + locked=True, ) obj.addProperty( - "App::PropertyBool", "CalculateGrad", "Flux", "Select calculation of gradient" + "App::PropertyBool", + "CalculateGrad", + "Flux", + "Select calculation of gradient", + locked=True, ) obj.addProperty( - "App::PropertyBool", "CalculateGradAbs", "Flux", "Computes absolute of gradient field" + "App::PropertyBool", + "CalculateGradAbs", + "Flux", + "Computes absolute of gradient field", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculateGradMagnitude", "Flux", "Computes magnitude of gradient field", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -88,6 +105,7 @@ class Proxy(linear.Proxy, equationbase.FluxProxy): "Enable if standard Galerkin approximation leads to\n" "unphysical results when there are discontinuities" ), + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -97,15 +115,21 @@ class Proxy(linear.Proxy, equationbase.FluxProxy): "If true, negative values of computed magnitude fields\n" "are a posteriori set to zero." ), + locked=True, ) obj.addProperty( "App::PropertyEnumeration", "FluxCoefficient", "Flux", "Proportionality coefficient\nto compute the flux", + locked=True, ) obj.addProperty( - "App::PropertyEnumeration", "FluxVariable", "Flux", "Variable name for flux calculation" + "App::PropertyEnumeration", + "FluxVariable", + "Flux", + "Variable name for flux calculation", + locked=True, ) obj.CalculateFlux = True diff --git a/src/Mod/Fem/femsolver/elmer/equations/flux_writer.py b/src/Mod/Fem/femsolver/elmer/equations/flux_writer.py index f860ecfbd6..e43d3707ce 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/flux_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/flux_writer.py @@ -79,13 +79,18 @@ class Fluxwriter: "Enforces continuity within the same material\n" "in the 'Discontinuous Galerkin' discretization" ), + locked=True, ) if hasattr(equation, "Bubbles"): # Bubbles was removed because it is unused by Elmer for the flux solver equation.removeProperty("Bubbles") if not hasattr(equation, "CalculateFluxAbs"): equation.addProperty( - "App::PropertyBool", "CalculateFluxAbs", "Flux", "Computes absolute of flux vector" + "App::PropertyBool", + "CalculateFluxAbs", + "Flux", + "Computes absolute of flux vector", + locked=True, ) if not hasattr(equation, "CalculateFluxMagnitude"): equation.addProperty( @@ -93,6 +98,7 @@ class Fluxwriter: "CalculateFluxMagnitude", "Flux", "Computes magnitude of flux vector field", + locked=True, ) if not hasattr(equation, "CalculateGradAbs"): equation.addProperty( @@ -100,6 +106,7 @@ class Fluxwriter: "CalculateGradAbs", "Flux", "Computes absolute of gradient field", + locked=True, ) if not hasattr(equation, "CalculateGradMagnitude"): equation.addProperty( @@ -107,6 +114,7 @@ class Fluxwriter: "CalculateGradMagnitude", "Flux", "Computes magnitude of gradient field", + locked=True, ) if not hasattr(equation, "DiscontinuousGalerkin"): equation.addProperty( @@ -117,6 +125,7 @@ class Fluxwriter: "Enable if standard Galerkin approximation leads to\n" "unphysical results when there are discontinuities" ), + locked=True, ) if not hasattr(equation, "EnforcePositiveMagnitude"): equation.addProperty( @@ -127,6 +136,7 @@ class Fluxwriter: "If true, negative values of computed magnitude fields\n" "are a posteriori set to zero." ), + locked=True, ) tempFluxCoefficient = "" if hasattr(equation, "FluxCoefficient"): @@ -141,6 +151,7 @@ class Fluxwriter: "FluxCoefficient", "Flux", "Name of proportionality coefficient\nto compute the flux", + locked=True, ) equation.FluxCoefficient = flux.COEFFICIENTS if tempFluxCoefficient: @@ -159,6 +170,7 @@ class Fluxwriter: "FluxVariable", "Flux", "Variable name for flux calculation", + locked=True, ) equation.FluxVariable = flux.VARIABLES equation.FluxVariable = tempFluxVariable diff --git a/src/Mod/Fem/femsolver/elmer/equations/heat.py b/src/Mod/Fem/femsolver/elmer/equations/heat.py index a3717bcafa..61ff68ed9f 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/heat.py +++ b/src/Mod/Fem/femsolver/elmer/equations/heat.py @@ -50,12 +50,20 @@ class Proxy(nonlinear.Proxy, equationbase.HeatProxy): # according to the Elmer models manual Bubbles is by default True # and Stabilize is False (Stabilize is added in linear.py) - obj.addProperty("App::PropertyBool", "Bubbles", "Heat", "") + obj.addProperty("App::PropertyBool", "Bubbles", "Heat", "", locked=True) obj.addProperty( - "App::PropertyEnumeration", "Convection", "Equation", "Type of convection to be used" + "App::PropertyEnumeration", + "Convection", + "Equation", + "Type of convection to be used", + locked=True, ) obj.addProperty( - "App::PropertyEnumeration", "PhaseChangeModel", "Equation", "Model for phase change" + "App::PropertyEnumeration", + "PhaseChangeModel", + "Equation", + "Model for phase change", + locked=True, ) obj.Bubbles = True diff --git a/src/Mod/Fem/femsolver/elmer/equations/heat_writer.py b/src/Mod/Fem/femsolver/elmer/equations/heat_writer.py index 58849c34ec..628385775f 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/heat_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/heat_writer.py @@ -81,12 +81,17 @@ class Heatwriter: "Convection", "Equation", "Type of convection to be used", + locked=True, ) equation.Convection = heat.CONVECTION_TYPE equation.Convection = "None" if not hasattr(equation, "PhaseChangeModel"): equation.addProperty( - "App::PropertyEnumeration", "PhaseChangeModel", "Equation", "Model for phase change" + "App::PropertyEnumeration", + "PhaseChangeModel", + "Equation", + "Model for phase change", + locked=True, ) equation.PhaseChangeModel = heat.PHASE_CHANGE_MODEL equation.PhaseChangeModel = "None" diff --git a/src/Mod/Fem/femsolver/elmer/equations/linear.py b/src/Mod/Fem/femsolver/elmer/equations/linear.py index 354c0165ed..7f9781b70a 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/linear.py +++ b/src/Mod/Fem/femsolver/elmer/equations/linear.py @@ -53,18 +53,30 @@ class Proxy(equation.Proxy): "BiCGstablDegree", "Linear System", "Polynom degree for iterative method 'BiCGstabl'", + locked=True, ) obj.addProperty( "App::PropertyIntegerConstraint", "IdrsParameter", "Linear System", "Parameter for iterative method 'Idrs'", + locked=True, + ) + obj.addProperty( + "App::PropertyEnumeration", "LinearDirectMethod", "Linear System", "", locked=True + ) + obj.addProperty( + "App::PropertyIntegerConstraint", "LinearIterations", "Linear System", "", locked=True + ) + obj.addProperty( + "App::PropertyEnumeration", "LinearIterativeMethod", "Linear System", "", locked=True + ) + obj.addProperty( + "App::PropertyEnumeration", "LinearPreconditioning", "Linear System", "", locked=True + ) + obj.addProperty( + "App::PropertyEnumeration", "LinearSolverType", "Linear System", "", locked=True ) - obj.addProperty("App::PropertyEnumeration", "LinearDirectMethod", "Linear System", "") - obj.addProperty("App::PropertyIntegerConstraint", "LinearIterations", "Linear System", "") - obj.addProperty("App::PropertyEnumeration", "LinearIterativeMethod", "Linear System", "") - obj.addProperty("App::PropertyEnumeration", "LinearPreconditioning", "Linear System", "") - obj.addProperty("App::PropertyEnumeration", "LinearSolverType", "Linear System", "") obj.addProperty( "App::PropertyBool", "LinearSystemSolverDisabled", @@ -74,15 +86,19 @@ class Proxy(equation.Proxy): "Only use for special cases\n" "and consult the Elmer docs." ), + locked=True, ) obj.addProperty( "App::PropertyFloat", "LinearTolerance", "Linear System", "Linear preconditioning method", + locked=True, + ) + obj.addProperty("App::PropertyBool", "Stabilize", "Base", "", locked=True) + obj.addProperty( + "App::PropertyFloat", "SteadyStateTolerance", "Steady State", "", locked=True ) - obj.addProperty("App::PropertyBool", "Stabilize", "Base", "") - obj.addProperty("App::PropertyFloat", "SteadyStateTolerance", "Steady State", "") obj.BiCGstablDegree = (2, 2, 10, 1) obj.IdrsParameter = (2, 1, 10, 1) diff --git a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic.py b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic.py index 47a627213f..0f2a6a6c59 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic.py +++ b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic.py @@ -49,12 +49,14 @@ class Proxy(nonlinear.Proxy, equationbase.MagnetodynamicProxy): "IsHarmonic", "Magnetodynamic", "If the magnetic source is harmonically driven", + locked=True, ) obj.addProperty( "App::PropertyFrequency", "AngularFrequency", "Magnetodynamic", "Frequency of the driving current", + locked=True, ) obj.addProperty( "App::PropertyBool", @@ -63,67 +65,79 @@ class Proxy(nonlinear.Proxy, equationbase.MagnetodynamicProxy): "Must be True if basis functions for edge element interpolation\n" "are selected to be members of optimal edge element family\n" "or if second-order approximation is used.", + locked=True, ) obj.addProperty( "App::PropertyBool", "QuadraticApproximation", "Magnetodynamic", "Enables second-order approximation of driving current", + locked=True, ) obj.addProperty( "App::PropertyBool", "StaticConductivity", "Magnetodynamic", "See Elmer models manual for info", + locked=True, ) obj.addProperty( "App::PropertyBool", "FixInputCurrentDensity", "Magnetodynamic", "Ensures divergence-freeness of current density", + locked=True, ) obj.addProperty( "App::PropertyBool", "AutomatedSourceProjectionBCs", "Magnetodynamic", "See Elmer models manual for info", + locked=True, ) obj.addProperty( "App::PropertyBool", "UseLagrangeGauge", "Magnetodynamic", "See Elmer models manual for info", + locked=True, ) obj.addProperty( "App::PropertyFloat", "LagrangeGaugePenalizationCoefficient", "Magnetodynamic", "See Elmer models manual for info", + locked=True, ) obj.addProperty( "App::PropertyBool", "UseTreeGauge", "Magnetodynamic", "See Elmer models manual for info\nWill be ignored if 'UsePiolaTransform' is True", + locked=True, + ) + obj.addProperty( + "App::PropertyBool", "LinearSystemRefactorize", "Linear System", "", locked=True ) - obj.addProperty("App::PropertyBool", "LinearSystemRefactorize", "Linear System", "") obj.IsHarmonic = False obj.AngularFrequency = 0 obj.Priority = 10 # the post processor options - obj.addProperty("App::PropertyBool", "CalculateCurrentDensity", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateElectricField", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateElementalFields", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateHarmonicLoss", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateJouleHeating", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateMagneticFieldStrength", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateMaxwellStress", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateNodalFields", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateNodalForces", "Results", "") - obj.addProperty("App::PropertyBool", "CalculateNodalHeating", "Results", "") - obj.addProperty("App::PropertyBool", "DiscontinuousBodies", "Results", "") + obj.addProperty("App::PropertyBool", "CalculateCurrentDensity", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateElectricField", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateElementalFields", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateHarmonicLoss", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateJouleHeating", "Results", "", locked=True) + obj.addProperty( + "App::PropertyBool", "CalculateMagneticFieldStrength", "Results", "", locked=True + ) + obj.addProperty("App::PropertyBool", "CalculateMaxwellStress", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateNodalFields", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateNodalForces", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "CalculateNodalHeating", "Results", "", locked=True) + obj.addProperty("App::PropertyBool", "DiscontinuousBodies", "Results", "", locked=True) obj.CalculateCurrentDensity = False obj.CalculateElectricField = False # FIXME: at the moment FreeCAD's post processor cannot display elementary field diff --git a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic2D.py b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic2D.py index b12bcb3eaa..c58f833998 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic2D.py +++ b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic2D.py @@ -49,30 +49,54 @@ class Proxy(nonlinear.Proxy, equationbase.Magnetodynamic2DProxy): "IsHarmonic", "Magnetodynamic2D", "If the magnetic source is harmonically driven", + locked=True, ) obj.addProperty( "App::PropertyFrequency", "AngularFrequency", "Magnetodynamic2D", "Frequency of the driving current", + locked=True, ) obj.IsHarmonic = False obj.AngularFrequency = 0 obj.Priority = 10 # the post processor options - obj.addProperty("App::PropertyBool", "CalculateCurrentDensity", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateElectricField", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateElementalFields", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateHarmonicLoss", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateJouleHeating", "Magnetodynamic2D", "") obj.addProperty( - "App::PropertyBool", "CalculateMagneticFieldStrength", "Magnetodynamic2D", "" + "App::PropertyBool", "CalculateCurrentDensity", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateElectricField", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateElementalFields", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateHarmonicLoss", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateJouleHeating", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", + "CalculateMagneticFieldStrength", + "Magnetodynamic2D", + "", + locked=True, + ) + obj.addProperty( + "App::PropertyBool", "CalculateMaxwellStress", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateNodalFields", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateNodalForces", "Magnetodynamic2D", "", locked=True + ) + obj.addProperty( + "App::PropertyBool", "CalculateNodalHeating", "Magnetodynamic2D", "", locked=True ) - obj.addProperty("App::PropertyBool", "CalculateMaxwellStress", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateNodalFields", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateNodalForces", "Magnetodynamic2D", "") - obj.addProperty("App::PropertyBool", "CalculateNodalHeating", "Magnetodynamic2D", "") obj.CalculateCurrentDensity = False obj.CalculateElectricField = False # FIXME: at the moment FreeCAD's post processor cannot display elementary field diff --git a/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py b/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py index 1c2bafb64c..8bead252bd 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py +++ b/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py @@ -47,17 +47,25 @@ class Proxy(linear.Proxy): "NonlinearIterations", "Nonlinear System", "Maximum number of iterations", + locked=True, ) obj.addProperty( "App::PropertyIntegerConstraint", "NonlinearNewtonAfterIterations", "Nonlinear System", "", + locked=True, ) obj.addProperty( - "App::PropertyFloat", "NonlinearNewtonAfterTolerance", "Nonlinear System", "" + "App::PropertyFloat", + "NonlinearNewtonAfterTolerance", + "Nonlinear System", + "", + locked=True, + ) + obj.addProperty( + "App::PropertyFloat", "NonlinearTolerance", "Nonlinear System", "", locked=True ) - obj.addProperty("App::PropertyFloat", "NonlinearTolerance", "Nonlinear System", "") obj.addProperty( "App::PropertyFloatConstraint", "RelaxationFactor", @@ -66,6 +74,7 @@ class Proxy(linear.Proxy): "Value below 1.0 might be necessary to achieve convergence\n" "Typical values are in the range [0.3, 1.0]" ), + locked=True, ) obj.NonlinearIterations = (20, 1, int(1e6), 10) diff --git a/src/Mod/Fem/femsolver/elmer/equations/staticcurrent.py b/src/Mod/Fem/femsolver/elmer/equations/staticcurrent.py index bda914f9bc..187b1031a0 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/staticcurrent.py +++ b/src/Mod/Fem/femsolver/elmer/equations/staticcurrent.py @@ -44,43 +44,58 @@ class Proxy(nonlinear.Proxy, equationbase.StaticCurrentProxy): def __init__(self, obj): super().__init__(obj) - obj.addProperty("App::PropertyBool", "CalculateVolumeCurrent", "StaticCurrent", "") + obj.addProperty( + "App::PropertyBool", "CalculateVolumeCurrent", "StaticCurrent", "", locked=True + ) obj.CalculateVolumeCurrent = True - obj.addProperty("App::PropertyBool", "CalculateJouleHeating", "StaticCurrent", "") + obj.addProperty( + "App::PropertyBool", "CalculateJouleHeating", "StaticCurrent", "", locked=True + ) obj.addProperty( "App::PropertyBool", "ConstantWeights", "StaticCurrent", "Used to turn constant weighting on for the results", + locked=True, ) obj.addProperty( "App::PropertyBool", "CalculateNodalHeating", "StaticCurrent", "Calculate nodal heating that may be used to couple the heat equation optimally when using conforming finite element meshes", + locked=True, ) obj.addProperty( "App::PropertyBool", "HeatSource", "StaticCurrent", "Use Joule heating as a heat source in combination with heat equation", + locked=True, ) obj.addProperty( "App::PropertyBool", "PowerControl", "StaticCurrent", "Apply power control with the desired heating power", + locked=True, ) obj.addProperty( "App::PropertyBool", "CurrentControl", "StaticCurrent", "Apply current control with the desired current", + locked=True, ) obj.addProperty( - "App::PropertyElectricCurrent", "Current", "StaticCurrent", "Current control value" + "App::PropertyElectricCurrent", + "Current", + "StaticCurrent", + "Current control value", + locked=True, + ) + obj.addProperty( + "App::PropertyPower", "Power", "StaticCurrent", "Power control value", locked=True ) - obj.addProperty("App::PropertyPower", "Power", "StaticCurrent", "Power control value") class ViewProxy(nonlinear.ViewProxy, equationbase.StaticCurrentViewProxy): diff --git a/src/Mod/Fem/femsolver/elmer/solver.py b/src/Mod/Fem/femsolver/elmer/solver.py index 3b376086d3..077ddfd490 100644 --- a/src/Mod/Fem/femsolver/elmer/solver.py +++ b/src/Mod/Fem/femsolver/elmer/solver.py @@ -88,7 +88,9 @@ class Proxy(solverbase.Proxy): def __init__(self, obj): super().__init__(obj) - obj.addProperty("App::PropertyEnumeration", "CoordinateSystem", "Coordinate System", "") + obj.addProperty( + "App::PropertyEnumeration", "CoordinateSystem", "Coordinate System", "", locked=True + ) obj.CoordinateSystem = COORDINATE_SYSTEM obj.CoordinateSystem = "Cartesian" @@ -97,6 +99,7 @@ class Proxy(solverbase.Proxy): "BDFOrder", "Timestepping", "Order of time stepping method 'BDF'", + locked=True, ) # according to the Elmer manual recommended is order 2 # possible range is 1 - 5 @@ -107,6 +110,7 @@ class Proxy(solverbase.Proxy): "OutputIntervals", "Timestepping", "After how many time steps a result file is output", + locked=True, ) obj.OutputIntervals = [1] @@ -115,6 +119,7 @@ class Proxy(solverbase.Proxy): "TimestepIntervals", "Timestepping", ("List of times if 'Simulation Type'\nis either 'Scanning' or 'Transient'"), + locked=True, ) obj.addProperty( "App::PropertyFloatList", @@ -124,6 +129,7 @@ class Proxy(solverbase.Proxy): "List of time steps sizes if 'Simulation Type'\n" "is either 'Scanning' or 'Transient'" ), + locked=True, ) # there is no universal default, it all depends on the analysis, however # we have to set something and set 10 seconds in steps of 0.1s @@ -139,6 +145,7 @@ class Proxy(solverbase.Proxy): "SteadyStateMaxIterations", "Type", "Maximal steady state iterations", + locked=True, ) obj.SteadyStateMaxIterations = 1 @@ -147,20 +154,29 @@ class Proxy(solverbase.Proxy): "SteadyStateMinIterations", "Type", "Minimal steady state iterations", + locked=True, ) obj.SteadyStateMinIterations = 0 - obj.addProperty("App::PropertyLink", "ElmerResult", "Base", "", 4 | 8) + obj.addProperty("App::PropertyLink", "ElmerResult", "Base", "", 4 | 8, locked=True) - obj.addProperty("App::PropertyLink", "ElmerOutput", "Base", "", 4 | 8) + obj.addProperty("App::PropertyLink", "ElmerOutput", "Base", "", 4 | 8, locked=True) obj.addProperty( - "App::PropertyBool", "BinaryOutput", "Result File", "Save result in binary format" + "App::PropertyBool", + "BinaryOutput", + "Result File", + "Save result in binary format", + locked=True, ) obj.BinaryOutput = False obj.addProperty( - "App::PropertyBool", "SaveGeometryIndex", "Result File", "Save geometry IDs" + "App::PropertyBool", + "SaveGeometryIndex", + "Result File", + "Save geometry IDs", + locked=True, ) obj.SaveGeometryIndex = False @@ -170,14 +186,22 @@ class Proxy(solverbase.Proxy): obj.getPropertyByName("BinaryOutput") except FreeCAD.Base.PropertyError: obj.addProperty( - "App::PropertyBool", "BinaryOutput", "Result File", "Save result in binary format" + "App::PropertyBool", + "BinaryOutput", + "Result File", + "Save result in binary format", + locked=True, ) obj.BinaryOutput = False try: obj.getPropertyByName("SaveGeometryIndex") except FreeCAD.Base.PropertyError: obj.addProperty( - "App::PropertyBool", "SaveGeometryIndex", "Result File", "Save geometry IDs" + "App::PropertyBool", + "SaveGeometryIndex", + "Result File", + "Save geometry IDs", + locked=True, ) obj.SaveGeometryIndex = False diff --git a/src/Mod/Fem/femsolver/elmer/writer.py b/src/Mod/Fem/femsolver/elmer/writer.py index b55833c754..8e54b2b972 100644 --- a/src/Mod/Fem/femsolver/elmer/writer.py +++ b/src/Mod/Fem/femsolver/elmer/writer.py @@ -350,7 +350,7 @@ class Writer: # updates older simulations if not hasattr(self.solver, "CoordinateSystem"): solver.addProperty( - "App::PropertyEnumeration", "CoordinateSystem", "Coordinate System", "" + "App::PropertyEnumeration", "CoordinateSystem", "Coordinate System", "", locked=True ) solver.CoordinateSystem = solverClass.COORDINATE_SYSTEM solver.CoordinateSystem = "Cartesian" @@ -360,6 +360,7 @@ class Writer: "BDFOrder", "Timestepping", "Order of time stepping method 'BDF'", + locked=True, ) solver.BDFOrder = (2, 1, 5, 1) if not hasattr(self.solver, "OutputIntervals"): @@ -368,10 +369,13 @@ class Writer: "OutputIntervals", "Timestepping", "After how many time steps a result file is output", + locked=True, ) solver.OutputIntervals = [1] if not hasattr(self.solver, "SimulationType"): - solver.addProperty("App::PropertyEnumeration", "SimulationType", "Type", "") + solver.addProperty( + "App::PropertyEnumeration", "SimulationType", "Type", "", locked=True + ) solver.SimulationType = solverClass.SIMULATION_TYPE solver.SimulationType = "Steady State" if not hasattr(self.solver, "TimestepIntervals"): @@ -383,6 +387,7 @@ class Writer: "List of maximum optimization rounds if 'Simulation Type'\n" "is either 'Scanning' or 'Transient'" ), + locked=True, ) solver.TimestepIntervals = [100] if not hasattr(self.solver, "TimestepSizes"): @@ -394,6 +399,7 @@ class Writer: "List of time steps of optimization if 'Simulation Type'\n" "is either 'Scanning' or 'Transient'" ), + locked=True, ) solver.TimestepSizes = [0.1] @@ -661,6 +667,7 @@ class Writer: "Only use for special cases\n" "and consult the Elmer docs." ), + locked=True, ) if not hasattr(equation, "IdrsParameter"): equation.addProperty( @@ -668,6 +675,7 @@ class Writer: "IdrsParameter", "Linear System", "Parameter for iterative method 'Idrs'", + locked=True, ) equation.IdrsParameter = (2, 1, 10, 1) diff --git a/src/Mod/Fem/femsolver/equationbase.py b/src/Mod/Fem/femsolver/equationbase.py index 6d405b2908..e1bc885e66 100644 --- a/src/Mod/Fem/femsolver/equationbase.py +++ b/src/Mod/Fem/femsolver/equationbase.py @@ -40,7 +40,7 @@ class BaseProxy: def __init__(self, obj): obj.Proxy = self - obj.addProperty("App::PropertyLinkSubList", "References", "Base", "") + obj.addProperty("App::PropertyLinkSubList", "References", "Base", "", locked=True) def execute(self, obj): return True diff --git a/src/Mod/Fem/femsolver/mystran/solver.py b/src/Mod/Fem/femsolver/mystran/solver.py index a6573a77b3..0dc4947977 100644 --- a/src/Mod/Fem/femsolver/mystran/solver.py +++ b/src/Mod/Fem/femsolver/mystran/solver.py @@ -59,7 +59,9 @@ class Proxy(solverbase.Proxy): # mystran_prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Fem/Mystran") - obj.addProperty("App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis") + obj.addProperty( + "App::PropertyEnumeration", "AnalysisType", "Fem", "Type of the analysis", locked=True + ) obj.AnalysisType = ANALYSIS_TYPES obj.AnalysisType = ANALYSIS_TYPES[0]