FELiCS.Fields.meanFlowClass#

Module Contents#

Classes#

meanFlowClass

Container and handler for mean-flow fields on a given mesh.

meanFlowVertexValues

Vertex-based representation of mean-flow fields.

Attributes#

FELiCS.Fields.meanFlowClass.logger#
class FELiCS.Fields.meanFlowClass.meanFlowClass(param, FEMSpaces, mesh)#

Bases: FELiCS.Fields.fieldProperties.fieldProperties, FELiCS.Equation.dependentVariables.energyHandler.energyHandler, FELiCS.Equation.dependentVariables.reactionHandler.reactionHandler, FELiCS.Equation.dependentVariables.equationOfStateHandler.equationOfStateHandler

Container and handler for mean-flow fields on a given mesh.

This class manages reading, storing, and post-processing of mean-flow quantities from external files and provides auxiliary fields and thermodynamic/transport properties required by FELiCS solvers.

Initialize the meanFlowClass object

Parameters:
  • param (object) – Global parameter object providing case, mixture and I/O configuration, e.g. param.FlowInput, param.Case, and param.Mixture.

  • FEMSpaces (object) – Collection of finite element function spaces, expected to provide attributes such as P2 and FunctionSpaceVectorVelocity.

  • mesh (object) – Mesh object used to define the function spaces, expected to provide attributes such as coordinateSystem and exportMesh.

Variables:
  • _isMean (bool) – Flag indicating that this instance represents a mean flow (always True).

  • _isFluctuation (bool) – Flag indicating that this instance represents a fluctuation field (always False for mean flow).

  • _param (object) – Reference to the global parameter object used for configuration.

  • _FEMSpaces (object) – Reference to the FEM spaces used for field definitions.

  • _mesh (object) – Reference to the mesh used for the fields.

  • _coordinateSystem (str or object) – Coordinate system information taken from the mesh.

  • _meanflowFilename (str or None) – Optional path to the processed mean-flow file (set when exporting).

  • _mixture (object) – Mixture model taken from param.Mixture.

  • _zeroVectorField (Field) – Vector field initialized to zero on the velocity space.

  • _zeroField (Field) – Scalar field initialized to zero on the scalar space.

  • _oneField (Field) – Scalar field initialized to one on the scalar space.

  • _customMeanFlowQuantities (list of str) – List of additional mean-flow quantity names requested by the user.

  • _fieldDict (dict of {str: Field}) – Dictionary of all mean-flow fields after import.

  • _notInFileList (list of str) – Names of requested fields that were not found in the input file.

  • _ScalarFunctionSpace (object) – Scalar function space used for viscosity and diffusion fields.

  • _VectorFunctionSpace (object) – Vector function space used for velocity-related fields.

  • xmfHeader (object) – Metadata returned by the writer when exporting mean fields.

Notes

The class delegates the specification of additional required fields to the handler base classes (energyHandler, equationOfStateHandler, reactionHandler). These base classes provide lists of extra field names needed for their respective models.

importDataFromFileAndExportToH5(writer)#

Import mean-flow fields from the configured input file and export them.

This method reads the mean-flow quantities from the file specified in param.FlowInput.MeanFlowFilePath, constructs Field instances for all required variables, computes additional transport and thermodynamic quantities, and exports the assembled set of fields to an HDF5 file.

Parameters:

writer (object) – Writer object providing an exportListOfFieldsToH5 method used to export the list of mean-flow fields.

Notes

The set of fields to be read is assembled from:

  • the mean-flow field names defined in param,

  • additional fields required by the energy, equation-of-state, and reaction handlers and

  • any custom mean-flow quantities added by the user.

If the density field rho is requested but not present in the file, its values are initialized to a constant of 1.0. If a turbulent velocity field ut exists, it is initialized to zero.

After import, transport coefficients and thermodynamic quantities are initialized via initLamDiff() and initThermodynamicQuantities().

initLamDiff()#

Initialize molecular viscosity and species diffusion coefficients.

Based on the selected molecular viscosity model and the mixture data, this method constructs the laminar viscosity field nulam (if a constant model is used) and computes species diffusion coefficients D_<specie> using the corresponding Schmidt numbers.

The effective kinematic viscosity for each species is assembled from the available contributions: nulam, nuturb and nuSGS, if present in _fieldDict.

Notes

This routine populates the following entries in _fieldDict:

  • 'nulam'Field

    Constant laminar viscosity (for constant viscosity models).

  • 'D_<specie>'Field

    Species diffusion coefficients for transported species.

initThermodynamicQuantities()#

Initialize thermodynamic mean-flow quantities.

Currently this method creates and initializes the Prandtl number field 'Pr' in _fieldDict using the value from param.Case.PrandtlNumber.

Notes

The 'Pr' field is defined on the scalar P2 function space.

calculateSpeciesEnthalpy()#

Compute and store species sensible enthalpies.

This method constructs JANAF thermodynamic species for several common gas components and evaluates their sensible enthalpy expressions at the current temperature field T. The resulting enthalpy fields are projected onto the P2 space and stored in the _hSpec dictionary.

Notes

The following species are currently supported:

  • CH₄

  • O₂

  • CO

  • CO₂

  • H₂O (gaseous)

The resulting dictionary entries are:

  • _hSpec['CH4']

  • _hSpec['O2']

  • _hSpec['CO']

  • _hSpec['CO2']

  • _hSpec['H2O']

Each entry holds a finite element function representing the sensible enthalpy of the corresponding species.

getVertexValues()#

Return vertex-based values of all mean-flow fields.

The method converts the internal dictionary of finite element fields to vertex-based arrays and wraps them into a meanFlowVertexValues instance.

Returns:

Object containing vertex values for all fields in _fieldDict, based on the mesh exported by self._mesh.exportMesh.

Return type:

meanFlowVertexValues

addCustomMeanFlowQuantity(key)#

Register an additional mean-flow quantity to be read.

Parameters:

key (str) – Name of the additional mean-flow quantity that should be included when assembling the list of fields to import.

Notes

The key is appended to the internal list _customMeanFlowQuantities and will be included by _getMeanFieldsToBeRead(). Duplicates are removed when the final list of field names is constructed.

class FELiCS.Fields.meanFlowClass.meanFlowVertexValues(fieldDict, mesh)#

Bases: FELiCS.Fields.fieldProperties.fieldProperties

Vertex-based representation of mean-flow fields.

This class converts Field objects storing finite element solutions into arrays of vertex values, providing a convenient interface for post-processing and exporting mean-flow quantities on the mesh vertices.

Initialize the meanFlowVertexValues object

Parameters:
  • fieldDict (dict of {str: Field}) – Dictionary of mean-flow fields whose vertex values will be extracted.

  • mesh (object) – Mesh object providing coordinates for the vertex arrays (typically mesh.exportMesh from the mean-flow class).

Variables:
  • _fieldDict (dict) – Dictionary mapping field names to vertex-value arrays. For scalar fields, the values are stored as 1D arrays. For vector-valued fields, the values are stored as 2D arrays with shape (num_components, num_vertices).

  • _isMean (bool) – Flag indicating that these values correspond to mean-flow quantities.

  • _zeroField (ndarray) – Convenience array of zeros with length equal to the number of mesh vertices.

  • _oneField (ndarray) – Convenience array of ones with length equal to the number of mesh vertices.

Notes

Vector-valued fields are handled by extracting each component from the corresponding subspace and assembling them into a single stacked array.