Specifies species source per unit mass for a species transport equation.


AcuSolve Command


MASS_SPECIES_SOURCE("name") {parameters...}


User-given name.


type (enumerated) [=none]
Type of mass species source.
No mass species source.
constant or const
Constant mass species source. Requires mass_species_source.
piecewise_linear or linear
Piecewise linear curve fit. Requires curve_fit_values and curve_fit_variable.
cubic_spline or spline
Cubic spline curve fit. Requires curve_fit_values and curve_fit_variable.
user_function or user
User-defined function. Requires user_function, user_values and user_strings.
mass_species_source (real) [=0]
The constant value of the mass-species source per unit mass. Used with constant type.
curve_fit_values or curve_values (array) [={0,0}]
A two-column array of independent-variable/species-source data values. Used with piecewise_linear and cubic_spline types.
curve_fit_variable or curve_var (enumerated) [=temperature]
Independent variable of the curve fit. Used with piecewise_linear and cubic_spline types.
x_coordinate or xcrd
X-component of coordinates.
y_coordinate or ycrd
Y-component of coordinates.
z_coordinate or zcrd
Z-component of coordinates.
x_reference_coordinate or xrefcrd
X-component of reference coordinates.
y_reference_coordinate or yrefcrd
Y-component of reference coordinates.
z_reference_coordinate or zrefcrd
Z-component of reference coordinates.
x_velocity or xvel
X-component of velocity.
y_velocity or yvel
Y-component of velocity.
z_velocity or zvel
Z-component of velocity.
velocity_magnitude or vel_mag
Velocity magnitude.
pressure or pres
temperature or temp
eddy_viscosity or eddy
Turbulence eddy viscosity.
kinetic_energy or tke
Turbulence kinetic energy.
velocity_scale or tvel
Transition velocity scale.
dissipation_rate or teps
Turbulence dissipation rate.
eddy_frequency or tomeg
Turbulence frequency.
intermittency or tintc
Transition intermittency.
transition_re_theta or treth
Transition Re-Theta.
eddy_frequency or tomega
Turbulence frequency.
species_1 or spec1
Species 1.
species_2 or spec2
Species 2.
species_3 or spec3
Species 3.
species_4 or spec4
Species 4.
species_5 or spec5
Species 5.
species_6 or spec6
Species 6.
species_7 or spec7
Species 7.
species_8 or spec8
Species 8.
species_9 or spec9
Species 9.
mesh_x_displacement or mesh_xdisp
X-component of mesh displacement.
mesh_y_displacement or mesh_ydisp
Y-component of mesh displacement.
mesh_z_displacement or mesh_zdisp
Z-component of mesh displacement.
mesh_displacement_magnitude or mesh_disp_mag
Mesh displacement magnitude.
mesh_x_velocity or mesh_xvel
X-component of mesh velocity.
mesh_y_velocity or mesh_yvel
Y-component of mesh velocity.
mesh_z_velocity or mesh_zvel
Z-component of mesh velocity.
mesh_velocity_magnitude or mesh_vel_mag
Mesh velocity magnitude.
user_function or user (string) [no default]
Name of the user-defined function. Used with user_function type.
user_values (array) [={}]
Array of values to be passed to the user-defined function. Used with user_function type.
user_strings (list) [={}]
Array of strings to be passed to the user-defined function. Used with user_function type.
multiplier_function (string) [=none]
User-given name of the multiplier function for scaling the viscosity. If none, no scaling is performed.


This command specifies the volumetric source per unit mass term applied to the transport equation for a species :(1)
where ρ is the density, u is the velocity vector, Ψ is the diffusive flux and σ is the species source per unit mass term defined here. This command is equivalent to the SPECIES_SOURCE command of AcuSolve version 1.6 and earlier, and the parameter mass_species_source corresponds to the earlier species_source. Both of these aliases may still be used, but they will be obsoleted eventually. MASS_SPECIES_SOURCE commands are referenced by BODY_FORCE commands, which in turn are referenced by ELEMENT_SET commands:
MASS_SPECIES_SOURCE( "my species source" ) {
   type                                = constant 
   mass_species_source                 = 10
BODY_FORCE( "my body force" ) {
   mass_species_1_source               = "my species source"
ELEMENT_SET( "fluid with species source" ) {
   body_force                          = "my body force"

This example defines a constant volumetric species source per unit mass. Positive values add species to the system, while negative values remove species from the system.

A constant mass species source applies a spatially uniform volumetric species source per unit mass, as in the above example.

Mass species source models of types piecewise_linear and cubic_spline may be used to define the species source as a function of a single independent variable. For example,
MASS_SPECIES_SOURCE( "curve fit species source" ) {
   type                                = piecewise_linear
   curve_fit_values                    = { 0., 0. ;    
                                           1., 1. ;    
                                           2., 4. ; }
   curve_fit_variable                  = species_1

defines a species source as a function of the first species. The curve_fit_values parameter is a two-column array corresponding to the independent variable and the species source values. The independent variable values must be in ascending order. The limit point values of the curve fit are used when curve_fit_variable falls outside of the curve fit limits.

The curve_fit_values data may be read from a file. For the above example, the curve fit values may be placed in a file, say
0.      0.
1.      1.
2.      3.
and read by:
MASS_SPECIES_SOURCE( "curve fit species source" ) {
   type                                = piecewise_linear
   curve_fit_values                    = Read( "" )
   curve_fit_variable                  = species_1

A mass species source of type user_function may be used to model more complex behaviors; see the AcuSolve User-Defined Functions Manual for a detailed description of user-defined functions.

For example, consider the case where species source is a second order polynomial of species 1. Then the input command may be given by:
MASS_SPECIES_SOURCE( "UDF species source" ) {
   type                                = user_function
   user_function                       = "usrSpeciesSourceExample"
   user_values                         = { 1.0,  # constant coef.    
                                           0.5,  # linear coef.
                                           0.1 } # quadratic coef
where the user-defined function "usrSpeciesSourceExample" may be implemented as follows:
#include "acusim.h"
#include "udf.h"
UDF_PROTOTYPE( usrSpeciesSourceExample ) ;                           /* function prototype              */          
Void usrSpeciesSourceExample (
    UdfHd                 udfHd,                                     /* Opaque handle for accessing data */
    Real*                 outVec,                                    /* Output vector                    */
    Integer               nItems,                                    /* Number of elements               */
    Integer               vecDim                                     /* = 1                              */
) {
    Integer               elem ;                                     /* an element counter               */
    Real                  coef0 ;                                    /* constant coefficient             */
    Real                  coef1 ;                                    /* linear coefficient               */
    Real                  coef2 ;                                    /* quadratic coefficient            */
    Real*                 spec ;                                     /* species vector                   */
    Real*                 usrVals ;                                  /* user values                      */
udfCheckNumUsrVals( udfHd, 3 ) ;                                     /* check for error                  */
    usrVals               = udfGetUsrVals( udfHd ) ;                 /* get the user vals                */
    coef0                 = usrVals[0] ;                             /* get coef                         */
    coef1                 = usrVals[1] ;                             /* get coef 2                       */
    coef2                 = usrVals[2] ;                             /* get coef 3                       */
    spec                  = udfGetElmData( udfHd,UDF_ELM_SPECIES ) ; /* get the species                  */
    for ( elem = 0 ; elem < nItems ; elem++ ) {
        outVec[elem] = coef0
                     + coef1 * spec[elem]
                     + coef2 * spec[elem] * spec[elem] ;
} /* end of usrSpeciesSourceExample() */

The dimension of the returned mass species source vector, outVec, is the number of elements.

The multiplier_function parameter may be used to uniformly scale the mass species source values. The value of this parameter refers to the user-given name of a MULTIPLIER_FUNCTION command in the input file. For example, to slowly increase a source term from zero to the full amount by time step 10, you can specify:
MASS_SPECIES_SOURCE( "ramped species source" ) {
    type                               = constant
    mass_species_source                = 10
    multiplier_function                = "ramped"
    type                               = piecewise_linear
    curve_fit_values                   = { 0, 0 ; 10, 1 }
    curve_fit_variable                 = time_step