UDF to modify underrelaxation factor

Client wants to set URF for temperature at iteration 0 to 0.9 and gradually increase it to 1.0 over a set number of iterations.

The following UDF does this.

You must set function hooks for the adjust and init functions, and you need to add an execute-command statement. Instructions are in the source code.


UDF to linearly scale the temperuatre relaxation factor by the
iteration number....

You must hook the ADJUST and INIT functions through th Define->Function Hooks panel.

This UDF is used in conjunction with a TUI COMMAND:

(rpsetvar 'temperature/relax (%rp-var-value 'temperature/relax))

This updates FLUENT's copy of temperature/relax from the value cached
to the user-defined function

Add this command to Solve->Execute Commands and put it into the "command"
text box

by William Wangard, Ph.D.

FLUENT does not guarantee any UDFs supplied through regular technical support.


#include "udf.h"

void init_counter(void);

/* Global iteration counter */
static real iter = 0.;

/* Function to set the counter to zero */
void init_counter(void)
iter = 0.0;

/* Automatically called when you click Solve->Initialize-Initialize */

/* Automaticlly called at the beginning of each iteration */
DEFINE_ADJUST(adjust, d)

real a, imax, b, urf;


a = urf at first iteration
b = urf at end if imax iterations


urf = a + i/imax * (b-a)

a = 0.9;
b = 1.0;
imax = 50.0;

if (first_iteration)

/* Assume URF = a + i/imax * b */
if (iter > imax)
urf = 1.0;
urf = a + (iter/imax) * (b-a);

/* Message("iteration = %f urf = %fn", iter, urf); */

/* Set the RPVAR */
RP_Set_Real("temperature/relax", urf);


Show Form
No comments yet. Be the first to add a comment!