# MASS_HEAT_SOURCE

Specifies heat source per unit mass for the energy equation.

## Type

AcuSolve Command

## Syntax

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

## Qualifier

User-given name.

## Parameters

- type (enumerated) [=none]
- Type of heat source per unit mass.
- none
- No mass heat source.
- constant or const
- Constant mass heat source. Requires mass_heat_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_heat_source (real) [=0]
- The constant value of the heat source per unit mass. Used with constant type.
- curve_fit_values or curve_values (array) [={0,0}]
- A two-column array of independent-variable/heat-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
- Pressure.
- temperature or temp
- Temperature.
- 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 mass heat source. If none, no scaling is performed.

## Description

**u**is the velocity vector,

**q**is the diffusive heat flux vector and s is the heat source per unit mass defined here. This command is equivalent to the HEAT_SOURCE command of AcuSolve version 1.6 and earlier, and the parameter mass_heat_source corresponds to the earlier heat_source. Both of these aliases may still be used, but they will be obsoleted eventually. MASS_HEAT_SOURCE commands are referenced by BODY_FORCE commands, which in turn are referenced by ELEMENT_SET commands:

```
MASS_HEAT_SOURCE( "my heat source" ) {
type = constant
mass_heat_source = 10
}
BODY_FORCE( "my body force" ) {
mass_heat_source = "my heat source"
...
}
ELEMENT_SET( "fluid with heat source" ) {
body_force = "my body force"
...
}
```

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

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

```
MASS_HEAT_SOURCE( "curve fit heat source" ) {
type = piecewise_linear
curve_fit_values = { 0., 0. ;
1., 1. ;
2., 4. ; }
curve_fit_variable = species_1
}
```

defines a mass heat source as a function of the first species. In this case, the problem must contain species transport equations; see the EQUATION command. The curve_fit_values parameter is a two-column array corresponding to the independent variable and the heat 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.

```
0. 0.
1. 1.
2. 3.
```

```
MASS_HEAT_SOURCE( "curve fit heat source" ) {
type = piecewise_linear
curve_fit_values = Read( "heat_source.fit" )
curve_fit_variable = species_1
}
```

A mass heat 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.

```
MASS_HEAT_SOURCE( "UDF heat source" ) {
type = user_function
user_function = "usrHeatSourceExample"
user_function = "usrHeatSourceExample"
user_values = { 2.5, # species scaling
10. } # time to apply in full
}
```

```
#include "acusim.h"
#include "udf.h"
UDF_PROTOTYPE( usrHeatSourceExample ) ; /* function prototype */
Void usrHeatSourceExample (
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 fTime ; /* final time */
Real scale ; /* scaling factor */
Real time ; /* run time */
Real* spec ; /* species vector */
Real* usrVals ; /* user values */
udfCheckNumUsrVals( udfHd, 2 ) ; /* check for error */
usrVals = udfGetUsrVals( udfHd ) ; /* get the user vals */
scale = usrVals[0] ; /*get the factor */
fTime = usrVals[1] ; /* get the final time */
time = udfGetTime( udfHd ) ; /* get the run time */
spec = udfGetElmData( udfHd, UDF_ELM_SPECIES ) ; /* get the species */
if ( time < fTime ) {
scale = scale * time / fTime ; /* reduce scaling */
}
for ( elem = 0 ; elem < nItems ; elem++ ) {
outVec[elem] = scale * spec[elem] ;
}
} /* end of usrHeatSourceExample() */
```

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

```
MASS_HEAT_SOURCE( "equivalent to UDF heat source" ) {
type = piecewise_linear
curve_fit_values = { 0, 0 ;
10, 25 ; }
curve_fit_variable = species_1
multiplier_function = "ramped"
}
MULTIPLIER_FUNCTION( "ramped" ) {
type = piecewise_linear
curve_fit_values = { 0, 0 ; 10, 1 }
curve_fit_variable = time
}
```