# ufpGetUdfData()

Get the pointer to the user equation solution.

## Syntax

data = ufpGetUdfData ( ufpHd, eqnName ) ;

## Type

AcuTrace User-Defined Function Particle Routine

## Parameters

ufpHd (pointer)
The opaque handle which was passed to the user function.
eqnName (string)
The name of the user equation. If the integer 0 is used instead of a string, the current user equation is used.

## Return Value

The return value is a pointer to a one dimensional array containing the solution for the user equation eqnName.

eqnName should correspond to the qualifier used in the USER_EQUATION command in the trace input file. If the integer 0 is used instead of a string, the solution vector of the current user equation is returned. The example in the previous section illustrates this usage.

## Description

This routine returns the pointer to the user equation solution at the current particle position and time.

In this example there is one user equation for particle energy and a second one for particle temperature. The temperature is given by ${T}_{p}=\frac{{e}_{p}}{{c}_{p}}$ where ${T}_{p}$ is the particle temperature, ${e}_{p}$ is the particle energy, and ${c}_{p}$ is the particle specific heat.

The definitions of these two equations in the trace input file could be be written as
USER_EQUATION( "energy" ) {
user_function              = "usrEnergy"
num_variables              = 1
...
}
USER_EQUATION( "temp" ) {
user_function              = "usrTemp"
num_variables              = 1
type                       = evaluate
user_values                = {C_P}
}

usrTemp could be written as

UFP_PROTOTYPE(usrTemp);
Void usrTemp (
UfpHd   ufpHd,
Real*   outVec,
Integer nItems,
Integer vecDim
)
{
Real*      e_particle ;
Real*      c_p ;
Real*      usrVals ;
usrVals                    = ufpGetUsrVals( ufpHd ) ;
c_p                        = usrVals[0] ;
e_particle                 = ufpGetUdfData( ufpHd, "energy" ) ;
outVec[0]                  = e_particle[0] / cp_p ;
}

## Errors

This routine expects valid ufpHd and eqnName as arguments; invalid arguments return an error.