Settings/Parameter

The Solver Framework has a great demand for user supplied settings because it interfaces with a lot of external software and every user envrionment is a little bit different. A more sophisticated abbroach than just using FreeCADs Parameter System directely was taken to tackle this problem.

All options are abstracted away behind functions of the femsolver.settings module. See the following module documentation for more information. All parameters used in the background are documented in Parameter Definitions.

The settings Module

Query FEM specific settings including solver settings.

Query settings from the hierarchically organized settings/parameter system of FreeCAD related to the FEM module. The collection of independed functions use the settings system as a backend and expose a easy to use interface for other modules of the FEM module.

Functions quering solver specific settings always take a solver name as a string to identify the solver in question. At the moment the following solvers are supported:

  • Calculix

  • ElmerSolver

  • Z88

To query settings about those solver the solver name must be given exactely in the form written in the list above. To make the solver recognize settings for a new solver have a look at _SolverDlg.

class femsolver.settings.DirSetting

Enum of possible directory setting values.

Strings used to indicate the solver directory setting set in FreeCADs setting system. Returned by get_dir_setting() for that purpose. There are three different possible values:

Variables
  • TEMPORARY – Let FreeCAD manage (create, delete) the working directories for all solver. Use temporary directories.

  • BESIDE – Create a directory in the same folder in which the FCStd file of the document is located. Use Subfolder for each solver (e.g. for a file ./mydoc.FCStd and a solver with the label Elmer002 use ./mydoc/Elmer002).

  • CUSTOM – Use directory set below. Create own subdirectory for every solver. Name directory after the solver label prefixed with the document name.

femsolver.settings.get_binary(name)

Find binary of solver name honoring user settings.

Return the specific path set by the user in FreeCADs settings/parameter system if set or the default binary name if no specific path is set. If no path was found because the solver name isn’t supported None is returned. This method does not check whether the binary actually exists and is callable.

Parameters

name – solver id as a str (see femsolver.settings)

femsolver.settings.get_custom_dir()

Get value for General/CustomDirectoryPath parameter.

femsolver.settings.get_dir_setting()

Return directory setting set by the user.

Return one of the three possible values of the DirSetting enum depending on the setting set in FreeCAD parameter system. Result dependes on the values of General/UseTempDirectory, General/UseBesideDirectory and General/UseCustomDirectory.

femsolver.settings.get_write_comments(name)

Check whether “write_comments” is set for solver.

Returns True if the “write_comments” setting/parameter is set for the solver with the id name. Returns False otherwise. If the solver isn’t supported None is returned.

Parameters

name – solver id as a str (see femsolver.settings)

Parameter Definitions

All parameers are children of User parameter:BaseApp/Preferences/Mod/Fem/.

General Settings

General/UseTempDirectory

Let FreeCAD manage (create, delete) the working directories for all solver. Use temporary directories. If set General/UseBesideDirectory and General/UseCustomDirectory are always unset.

General/UseBesideDirectory

Create a directory in the same folder in which the FCStd file of the document is located. Use Subfolder for each solver (e.g. for a file ./mydoc.FCStd and a solver with the label Elmer002 use ./mydoc/Elmer002). If set General/UseTempDirectory and General/UseCustomDirectory are always unset.

General/UseCustomDirectory

Use directory set below. Create own subdirectory for every solver. Name directory after the solver label prefixed with the document name. If set General/UseTempDirectory and General/UseBesideDirectory are always unset.

General/CustomDirectoryPath

If General/UseCustomDirectory is set this option specifies the directory path as a string. Can be empty (str) if a different option for directory management is used.

Elmer Settings

Elmer/UseStandardElmerLocation

If set the hardcoded default binary name will be used to execute ElmerSolver. The value of Elmer/elmerBinaryPath is ignored in that case. If unset the value of Elmer/elmerBinaryPath is used instead.

Elmer/elmerBinaryPath

User supplied path to the ElmerSolver binary. Used only if Elmer/UseStandardElmerLocation is unset.

Elmer/UseStandardGridLocation

If set the hardcoded default binary name will be used to execute ElmerGrid. The value of Elmer/gridBinaryPath is ignored in that case. If unset the value of Elmer/gridBinaryPath is used instead.

Elmer/gridBinaryPath

User supplied path to the ElmerGrid binary. Used only if Elmer/UseStandardGridLocation is unset.

Calculix Settings

Ccx/UseStandardCcxLocation

If set the hardcoded default binary name will be used to execute Calculix. The value of Ccx/ccxBinaryPath is ignored in that case. If unset the value of Ccx/ccxBinaryPath is used instead.

Ccx/ccxBinaryPath

User supplied path to the Calculix binary. Used only if Ccx/UseStandardCcxLocation is unset.

Z88 Settings

Z88/UseStandardZ88Location

If set the hardcoded default binary name will be used to execute Z88. The value of Z88/z88BinaryPath is ignored in that case. If unset the value of Z88/z88BinaryPath is used instead.

Z88/z88BinaryPath

User supplied path to the Z88 binary. Used only if Z88/UseStandardZ88Location is unset.