ufpGetJac()
Get the pointer to the source Jacobian.
Syntax
jac = ufpGetJac ( ufpHd ) ;
Type
AcuTrace User-Defined Function Particle Routine
Parameters
- ufpHd (pointer)
- The opaque handle which was passed to the user function.
Return Value
The return value is a pointer to a one-dimensional array. Once the pointer is obtained, you should fill it with the values of the Jacobian with respect to the user function variables. The size of the Jacobian is square of the number of user equation variables.
If the source term does not depend on the user function variable, the Jacobian is identically 0 and does not need to be set.
It is your responsibility to determine the correct formulation of the Jacobian.
Description
This routine returns the pointer to the source Jacobian.
A user defined function providing the source term for heat transfer between the fluid and the
particle could be written
as:
Void usrTemp (
UfpHd ufpHd,
Real* outVec,
Integer nItems,
Integer vecDim
)
{
Real* jac ;
Real* usrVals ;
Real* t_fluid ;
Real* t_particle ;
Real cond ;
...
usrVals = ufpGetUsrVals ( ufpHd ) ;
jac = ufpGetJac ( ufpHd, UFP_JAC_UDF_VARIABLES ) ;
t_fluid = ufpGetFlowData( ufpHd,UFP_FLOW_TEMPERATURE ) ;
t_particle = ufpGetUdfData ( ufpHd,0 ) ;
cond = usrVals[0];
outVec[0) = cond * ( t_fluid[0] – t_particle[0]
/*---------------------------------------------------------------------------
* The jacobian is the derivative of the source with respect to the particle
* temperature
*---------------------------------------------------------------------------
*/
jac[0] = -cond ;
...
}
In this case, the evolution equation is
where
is the particle temperature,
the fluid temperature, and
the conductivity. The Jacobian is
Errors
This routine expects a valid ufpHd as an argument; an invalid arguments returns an error.