# VOLUME_HEAT_SOURCE

Specifies heat source per unit volume for the energy equation.

AcuSolve Command

## Syntax

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

User-given name.

## Parameters

type (enumerated) [=none]
Type of volume heat source.
none
No volume heat source.
constant or const
Constant volume heat source. Requires volume_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.
volume_heat_source (real) [=0]
The constant value of the volume heat source. 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 viscosity. If none, no scaling is performed.

## Description

This command specifies the heat source per unit volume applied to the energy equation:(1)
where $\rho$ is the density, h is the enthalpy, u is the velocity vector, q is the diffusive heat flux vector and s is the heat source per unit volume defined here. VOLUME_HEAT_SOURCE commands are referenced by BODY_FORCE commands, which in turn are referenced by ELEMENT_SET commands:
VOLUME_HEAT_SOURCE( "my heat source" ) {
type                                = constant
volume_heat_source                  = 10
}
BODY_FORCE( "my body force" ) {
volume_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 volume. Positive values add heat to the system, while negative values remove heat from the system.

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

Volume heat source models of types piecewise_linear and cubic_spline may be used to define the heat source as a function of a single independent variable. For example,
VOLUME_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 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.

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 heat_source.fit:
0.      0.
1.      1.
2.      3.
VOLUME_HEAT_SOURCE( "curve fit heat source" ) {
type                                = piecewise_linear
curve_fit_variable                  = species_1
}

A volume 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.

For example, consider the case where heat source is proportional to species one, but is applied slowly as a function of time. Then the input command may be given by:
VOLUME_HEAT_SOURCE( "UDF heat source" ) {
type                                = user_function
user_function                       = "usrHeatSourceExample"
user_values                         = { 2.5,  # species scaling
10.}  # time to apply in full
}
where the user-defined function "usrHeatSourceExample" may be implemented as follows:
#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                  = usrVals[2] ;                             /* 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 volume heat source vector, outVec, is the number of elements.

The multiplier_function parameter may be used to uniformly scale the volume heat source values. The value of this parameter refers to the user-given name of a MULTIPLIER_FUNCTION command in the input file. For example, assuming that species one remains between zero and 10, the above heat source using the user-defined function may be obtained by:
VOLUME_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
}