Model.control_sum_print#

Model.control_sum_print(file_name='', comment='', output_format='scientific', method='from_surface_geom', shift_to_center=1)#

Outputs a control sum number to the specified text file. The control sum value is computed as a certain average using coordinates of the geometry and mesh present in the model. The options can be specified in any order.

Parameters:
  • file_name (hwString) – The full path and file name to write the result to. This is a mandatory option.

  • comment (hwString) – This specifies an optional comment to be written to the text file prior to the control number.

  • output_format (hwString) –

    This optional parameter specifies the output format for the control sum number. Valid values are:

    general - Write the output real number in general format

    scientific - Write the output real number in scientific format (default)

  • method (hwString) –

    This optional parameter specifies which points are to be used to compute the sum. Valid values are:

    from_surface_geom - The points are taken as all vertices of all surfaces, as well as one point per each surface inside the surface (default)

    from_surface_vertices - The points are taken from all surface vertices present in the model

    from_elements - The points are taken to be all elements’ centroids in the model

    from_nodes - The points are taken to be all nodes in the model

  • shift_to_center (int) –

    This optional parameter specifies whether the coordinates of the points are taken in global coordinate system or shifted to the center of the bounding box containing all the points. Valid values are:

    0 - Take the coordinates with respect to global coordinate system

    1 - Take the origin of the coordinate system to be the center of the bouding box containing all points (default)

Example#

Write the control number to “C:/test/test.txt”, taking the sum of coordinates of all nodes present in the model with respect to the global coordinate system, and write the output in scientific notation#
import hm
import hm.entities as ent

model = hm.Model()

model.control_sum_print(
    file_name="C:/test/text.txt",
    comment="My comment",
    output_format="scientific",
    method="from_nodes",
    shift_to_center=0,
)