mesh_statistics#
Module for facilitating analysis of mesh statistics.
Classes:
|
Facilitates analysis of mesh statistics for the current mesh in a running session of TurboGrid. |
- class ansys.turbogrid.core.mesh_statistics.mesh_statistics.MeshStatistics(turbogrid_instance: PyTurboGrid, domain: str = 'ALL')#
Bases:
object
Facilitates analysis of mesh statistics for the current mesh in a running session of TurboGrid.
Methods:
__init__
(turbogrid_instance[, domain])Initialize the class using a connection to a running session of TurboGrid.
create_histogram
(variable[, domain, ...])Create a histogram of mesh statistics using Matplotlib.
get_domain_label
(domain)Get suitable label text for a domain.
get_mesh_statistics
([variable])Get the basic mesh statistics from the cached mesh statistics.
Get a text version of the mesh statistics table from the cached mesh statistics.
Get the mesh statistics table data from the cached mesh statistics.
update_mesh_statistics
([domain])Re-read the mesh statistics from TurboGrid.
write_table_to_csv
(file_name)Write the mesh statistics table to a CSV file.
Attributes:
Domain that was used for the last update of the mesh statistics.
Interface to a running session of TurboGrid.
Cache of the basic mesh statistics obtained by the last call to the
update_mesh_statistics()
method or from the initialization of the object if this method has not been called.- __init__(turbogrid_instance: PyTurboGrid, domain: str = 'ALL')#
Initialize the class using a connection to a running session of TurboGrid.
Parameters#
- turbogrid_instancepytg.pyturbogrid_core.PyTurboGrid
Running session of TurboGrid.
- domainstr, default:
"ALL"
Name of the domain to get the initial statistics from. The default is
"ALL"
, in which case statistics are read for all domains.
- create_histogram(variable: str, domain: str = 'ALL', use_percentages: bool = True, bin_units: str = '', image_file: str = '', show: bool = True) None #
Create a histogram of mesh statistics using Matplotlib.
Parameters#
- variablestr
Mesh statistics variable to use for the histogram.
- domainstr, default:
"ALL"
Domain name to get statistics for. The default is
"ALL"
, in which case statistics for all domains are read. If a specific domain name is supplied, statistics are read for only this domain. Cached mesh statistics are not used or affected.- use_percentagesbool, default:
False
Whether to display the percentage values of the bin counts for the histogram. The default is
False
, in which case the actual bin counts are shown.- bin_unitsstr, default:
""
Units for the mesh statistics values (x-axis labels). The default is
""
, in which case the current TurboGrid units are used.- image_filestr, default:
""
Name and extension for the image file to write the histogram to. The default is
""
, in which case no image file is written. The format is determined by the file extension (such as.png
) given in the file name. Available formats are those supported by Matplotlib, including".png"
,".pdf"
, and".svg"
.- showbool, default: True
Whether to display the image on the screen. If
False
, the image is not displayed on the screen, which is only useful if the image is being written to a file.
- current_domain: str = ''#
Domain that was used for the last update of the mesh statistics. See the
mesh_vars
attribute.
- get_domain_label(domain: str) str #
Get suitable label text for a domain.
Parameters#
- domainstr
Name of the domain to generate the label from.
Returns#
- str
"All Domains"
is returned if"ALL"
is the value specified for thedomain
parameter or"Domain: <name>"
is returned if the name of a single domain is specified.
- get_mesh_statistics(variable: str = 'ALL') dict #
Get the basic mesh statistics from the cached mesh statistics.
Parameters#
- variablestr, default:
"ALL"
Mesh statistics variable to get statistics for. The default is
"ALL"
, in which case a dictionary of all variables is returned.
Returns#
- dict
If a single variable is specified for the
variable
parameter, a dictionary of the current mesh statistics values for the selected variable is returned. Otherwise, if the default value of"ALL"
is used for thevariable
parameter, a dictionary of dictionaries (one per variable) is returned.
- variablestr, default:
- get_table_as_text() str #
Get a text version of the mesh statistics table from the cached mesh statistics.
Returns#
- str
Mesh statistics table in a text version.
- get_table_rows() list #
Get the mesh statistics table data from the cached mesh statistics.
Returns#
- list
List of row data. Each list item represents one table row. The list item contains a list of the cell contents for each cell in the row.
- interface: PyTurboGrid = 0#
Interface to a running session of TurboGrid.
- mesh_vars: dict = {}#
Cache of the basic mesh statistics obtained by the last call to the
update_mesh_statistics()
method or from the initialization of the object if this method has not been called. The name of the domain these statistics relate to is stored as thecurrent_domain
attribute.
- update_mesh_statistics(domain: str = 'ALL') None #
Re-read the mesh statistics from TurboGrid.
This method can be used either to update the cached mesh statistics after TurboGrid has remeshed or update the cached mesh statistics to use a different domain or domains.
Parameters#
- domainstr, default:
"ALL"
Name of the domain to get the statistics from. The default is
"ALL"
, in which case statistics are read for all domains.
- domainstr, default: