FELiCS.Fields.meanFlowClass#
Module Contents#
Classes#
Container and handler for mean-flow fields on a given mesh. |
|
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.equationOfStateHandlerContainer 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 asP2andFunctionSpaceVectorVelocity.mesh (
object) – Mesh object used to define the function spaces, expected to provide attributes such ascoordinateSystemandexportMesh.
- 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 (
strorobject) – Coordinate system information taken from the mesh._meanflowFilename (
strorNone) – Optional path to the processed mean-flow file (set when exporting)._mixture (
object) – Mixture model taken fromparam.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 (
listofstr) – List of additional mean-flow quantity names requested by the user._fieldDict (
dictof{str: Field}) – Dictionary of all mean-flow fields after import._notInFileList (
listofstr) – 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 anexportListOfFieldsToH5method 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
rhois requested but not present in the file, its values are initialized to a constant of 1.0. If a turbulent velocity fieldutexists, it is initialized to zero.After import, transport coefficients and thermodynamic quantities are initialized via
initLamDiff()andinitThermodynamicQuantities().
- 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 coefficientsD_<specie>using the corresponding Schmidt numbers.The effective kinematic viscosity for each species is assembled from the available contributions:
nulam,nuturbandnuSGS, if present in_fieldDict.Notes
This routine populates the following entries in
_fieldDict:'nulam'FieldConstant laminar viscosity (for constant viscosity models).
'D_<specie>'FieldSpecies diffusion coefficients for transported species.
- initThermodynamicQuantities()#
Initialize thermodynamic mean-flow quantities.
Currently this method creates and initializes the Prandtl number field
'Pr'in_fieldDictusing the value fromparam.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_hSpecdictionary.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
meanFlowVertexValuesinstance.- Returns:
Object containing vertex values for all fields in
_fieldDict, based on the mesh exported byself._mesh.exportMesh.- Return type:
- 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
_customMeanFlowQuantitiesand 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.fieldPropertiesVertex-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 (
dictof{str: Field}) – Dictionary of mean-flow fields whose vertex values will be extracted.mesh (
object) – Mesh object providing coordinates for the vertex arrays (typicallymesh.exportMeshfrom 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.