fairyfly_therm.simulation.mesh module

Meshing control parameters.

class fairyfly_therm.simulation.mesh.MeshControl(mesh_type='Simmetrix', parameter=20, run_error_estimator=True, max_error_percent=10, max_iterations=5)[source]

Bases: object

Meshing control parameters.

Parameters:
  • mesh_type

    Text to indicate the type of meshing algorithm to use. Choose from the following. Simmetrix is generally more flexible and capable of handling more complex geometry when compared with the QuatTree. However, the structure of QuadTree meshes is more predictable. (Default: Simmetrix).

    • Simmetrix

    • QuadTree

  • parameter – A positive integer for the minimum number of subdivisions to be performed while meshing the input geometry. The higher the mesh control parameter, the smaller the maximum size of finite elements in the model and the smoother the results will appear. However, higher mesh parameters will also require more time to run. (Default: 20).

  • run_error_estimator – Boolean to note whether the error estimator should be run as part of the finite element analysis. If the global error is above a specified value, then the error estimator signals the mes generator, and the mesh is refined in areas where the potential for error is high. The refined mesh is sent back to the finite element solver, and a new solution is obtained. (Default: True).

  • max_error_percent – A number between 0 and 100 for the percent error energy norm used by the error estimator. This is the maximum value of the error energy divided by the energy of the sum of the recovered fluxes and the error, multiplied by 100. (Default: 10).

  • max_iterations – A positive integer for the number of iterations between the error estimator and the solver to be performed before the finding a solution is abandoned and the program exits. (Default: 5).

Properties:
  • mesh_type

  • parameter

  • run_error_estimator

  • max_error_percent

  • max_iterations

ToString()[source]

Overwrite .NET ToString.

duplicate()[source]

Get a copy of this object.

classmethod from_dict(data)[source]

Create a MeshControl from a dictionary.

Parameters:

data – A python dictionary in the following format

{
"type": 'MeshControl',
"mesh_type": 'Simmetrix',
"parameter": 50,
"run_error_estimator": True,
"max_error_percent": 10,
"max_iterations": 5
}
classmethod from_therm_xml(xml_element)[source]

Create MeshControl from an XML element of a THERM MeshControl.

Parameters:

xml_element – An XML element of a THERM MeshControl.

classmethod from_therm_xml_str(xml_str)[source]

Create a MeshControl from an XML text string of a THERM MeshControl.

Parameters:

xml_str – An XML text string of a THERM MeshControl.

to_dict()[source]

MeshControl dictionary representation.

to_therm_xml(calculation_element=None)[source]

Get an THERM XML element of the MeshControl.

Parameters:

calculation_element – An optional XML Element for the CalculationOptions to which the generated objects will be added. If None, a new XML Element will be generated.

<MeshControl>
    <MeshType>QuadTree Mesher</MeshType>
    <MeshParameter>3</MeshParameter>
    <RunErrorEstimator>true</RunErrorEstimator>
    <ErrorEnergyNorm>10</ErrorEnergyNorm>
    <MaximumIterations>5</MaximumIterations>
</MeshControl>
to_therm_xml_str()[source]

Get an THERM XML string of the material.

TYPES = ('Simmetrix', 'QuadTree')
property max_error_percent

Get or set a number for the maximum accepted percentage of error.

property max_iterations

Get or set a positive integer for the iterations between the mesher and solver.

property mesh_type

Get or set text for the meshing algorithm to be used.

property parameter

Get or set a positive integer for the minimum number of mesh subdivisions.

property run_error_estimator

Get or set a boolean for whether to run the error estimator.