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 = e p c p MathType@MTEF@5@5@+= feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamivamaaBa aaleaacaWGWbaabeaakiabg2da9maalaaabaGaamyzamaaBaaaleaa caWGWbaabeaaaOqaaiaadogadaWgaaWcbaGaamiCaaqabaaaaaaa@3D2E@ where T p MathType@MTEF@5@5@+= feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamivamaaBa aaleaacaWGWbaabeaaaaa@37F0@ is the particle temperature, e p MathType@MTEF@5@5@+= feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaamyzamaaBa aaleaacaWGWbaabeaaaaa@3801@ is the particle energy, and c p MathType@MTEF@5@5@+= feaagKart1ev2aaatCvAUfeBSjuyZL2yd9gzLbvyNv2CaerbuLwBLn hiov2DGi1BTfMBaeXatLxBI9gBaerbd9wDYLwzYbItLDharqqtubsr 4rNCHbGeaGqiVu0Je9sqqrpepC0xbbL8F4rqqrFfpeea0xe9Lq=Jc9 vqaqpepm0xbba9pwe9Q8fs0=yqaqpepae9pg0FirpepeKkFr0xfr=x fr=xb9adbaqaaeGaciGaaiaabeqaamaabaabaaGcbaGaam4yamaaBa aaleaacaWGWbaabeaaaaa@37FF@ 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.