MOMENTUM_SOURCE
Specifies the momentum source.
Type
AcuSolve Command
Syntax
MOMENTUM_SOURCE (“name”) {parameters...}
Qualifier
Usergiven name.
Parameters
 type (enumerated) [=constant]
 Type of the momentum_source.
 none
 No momentum_source.
 constant or const
 Constant momentum_source. Requires momentum_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
 Userdefined function. Requires user_function, user_values and user_strings.
 momentum_source (array) [={0,0,0}]
 The constant value of the momentum source. This array must have exactly
three components in the global xyz coordinate system. Used with
constant type.Note: momentum_source and gravitational_acceleration under EQUATION are cumulative.
 curve_fit_values or curve_values (array) [={0,0,0,0}]
 A fourcolumn array of independentvariable/momentum source data values. Used with piecewise_linear and cubic_spline types.
 curve_fit_variable or curve_var (enumerated) [no default]
 Independent variable of the curve fit. Used with
piecewise_linear and cubic_spline
types.
 x_coordinate or xcrd
 Xcomponent of coordinates.
 y_coordinate or ycrd
 Ycomponent of coordinates.
 z_coordinate or zcrd
 Zcomponent of coordinates.
 x_reference_coordinate or xrefcrd
 Xcomponent of reference coordinates.
 y_reference_coordinate or yrefcrd
 Ycomponent of reference coordinates.
 z_reference_coordinate or zrefcrd
 Zcomponent of reference coordinates.
 x_velocity or xvel
 Xcomponent of velocity.
 y_velocity or yvel
 Ycomponent of velocity.
 z_velocity or zvel
 Zcomponent 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 tomega
 Turbulence frequency.
 eddy_time or ttau
 Turbulence eddy time.
 intermittency or tintc
 Transition intermittency.
 transition_re_theta or treth
 Transition ReTheta.
 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
 Xcomponent of mesh displacement.
 mesh_y_displacement or mesh_ydisp
 Ycomponent of mesh displacement.
 mesh_z_displacement or mesh_zdisp
 Zcomponent of mesh displacement.
 mesh_displacement_magnitude or mesh_disp_mag
 Mesh displacement magnitude.
 mesh_x_velocity or mesh_xvel
 Xcomponent of mesh velocity
 mesh_y_velocity or mesh_yvel
 Ycomponent of mesh velocity.
 mesh_z_velocity or mesh_zvel
 Zcomponent of mesh velocity.
 mesh_velocity_magnitude or mesh_vel_mag
 Mesh velocity magnitude.
 user_function or user (string) [no default]

Name of the userdefined function. Used with user_function type.
 user_values (array) [={}]
 Array of values to be passed to the userdefined function. Used with user_function type.
 user_strings (list) [={}]
 Array of strings to be passed to the userdefined function. Used with user_function type.
 multiplier_function (string) [=none]
 Usergiven name of the multiplier function for scaling the momentum source values. If none, no scaling is performed.
Description
MOMENTUM_SOURCE( "my gravity" ) {
type = constant
momentum_source = { 0, 9.81, 0 }
}
BODY_FORCE( "my body force" ) {
momentum_source = "my gravity"
...
}
ELEMENT_SET( "fluid with gravity" ) {
body_force = "my body force"
...
}
This example defines a constant momentum source (acceleration) in the y direction.
A constant momentum_source applies a spatially uniform gravity vector to an element set, as shown in the example above.
GRAVITY( "curve fit momentum source" ) {
type = piecewise_linear
curve_fit_values = { 0., 0., 0., 0. ;
10., 0., 0., 1. ;
20., 0., 0., 0. ; }
curve_fit_variable = x_coordinate
}
defines a body force in the z direction as a function of the x coordinate. The curve_fit_values parameter is a fourcolumn array corresponding to the independent variable and the x, y and z components of body force in the global xyz coordinate system. The independent variable values must be given 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. 0. 0.
10. 0. 0. 1.
20. 0. 0. 0.
MOMENTUM_SOURCE( "curve fit gravity" ) {
type = piecewise_linear
curve_fit_values =Read( "momentum_source.fit" )
curve_fit_variable = x_coordinate
}
A body force of type user_function may be used to model more complex behaviors; see the AcuSolve UserDefined Functions Manual for a detailed description of userdefined functions.
GRAVITY( "UDF body force" ) {
type = user_function
user_function = "usrBodyForceExample"
user_values = { 1., 1.5 } # proportionality constants
}
#include "acusim.h"
#include "udf.h"
UDF_PROTOTYPE( usrBodyForceExample ) ; /* function prototype */
Void usrBodyForceExample (
UdfHd udfHd, /* Opaque handle for accessing data */
Real* outVec, /* Output vector */
Integer nItems, /* Number of elements */
Integer vecDim /* = 3 (for three components) */
) {
Integer elem ; /* an element counter */
Real coef1 ; /* scaling factor 1 */
Real coef2 ; /* scaling factor 2 */
Real* spec ; /* species vector */
Real* spec1 ; /* species 1 vector */
Real* spec2 ; /* species 2 vector */
Real* usrVals ; /* user values */
Real* xBodyF ; /* xcomponent of body force */
Real* yBodyF ; /* ycomponent of body force */
Real* zBodyF ; /* zcomponent of body force */
udfCheckNumUsrVals( udfHd, 2 ) ; /* check for error */
usrVals = udfGetUsrVals( udfHd ) ; /* get the user vals */
coef1 = usrVals[0] ; /* get coef. 1 */
coef2 = usrVals[1] ; /* get coef. 2 */
spec = udfGetElmData( udfHd, UDF_ELM_SPECIES ) ;
/* get the user vals */
spec1 = &spec[0*nItems] ; /* localize species1 */
spec2 = &spec[1*nItems] ; /* localize species2 */
xBodyF = &outVec[0*nItems] ; /* localized xBodyF */
yBodyF = &outVec[1*nItems] ; /* localized yBodyF */
zBodyF = &outVec[2*nItems] ; /* localized zBodyF */
for ( elem = 0 ; elem < nItems ; elem++ ) {
xBodyF[elem] = coef1 * spec1[elem] + coef2 * spec2[elem] ;
yBodyF[elem] = 0 ;
zBodyF[elem] = 0 ;
}
} /* end of usrBodyForceExample() */
The dimension of the returned momentum source vector, outVec, is the number of elements times three.
The multiplier_function parameter may be used to uniformly scale all momentum source values. The value of this parameter refers to the usergiven name of a MULTIPLIER_FUNCTION command in the input file; see the MULTIPLIER_FUNCTION command for an example.