CFD Online Discussion Forums

CFD Online Discussion Forums (
-   FLUENT (
-   -   Bug in the DEFINE_ADJUST macro? (

Senthil August 29, 2002 16:31

Bug in the DEFINE_ADJUST macro?
We need to modify flow variables (velocites and temperature) periodically in a time dependent simulation. Fluent 6.0 manual says that DEFINE_ADJUST macro can be used for this purpose. When we used this macro, we found out that the the solver behaved as if no change was made. It appears that despite using the UDF based on DEFINE_ADJUST macro the information about the change in the flow variables is not passed on to the solver correctly.

When we contacted the technical assistance people in fluent, they suggested to us to use solve--initialize--patch using a custom field function instead. i.e to calculate the new values for flow variables in the custom field function. However, in this approach one must stop the run, make the change manually using the solve---initialise--patch option, continue the run until next time instant, stop and make manual change, and so on. If everytime the change has to be made manually, it would not be feasible to use Fluent for our project. Since DEFINE_ADJUST macro was meant to change the flow variable values but it does not communicate the change to the solver correctly, this looks like a bug. Has anybody faced this problem before?.

Thanks Senthil

Greg Perkins September 1, 2002 22:53

Re: Bug in the DEFINE_ADJUST macro?
In a time-dependent simulation, you may need to be careful which values you update. Note that variables such as C_U have time-step info saved in C_U_M1 (and for 2nd order) C_U_M2 - see manual.

I'm not sure exactly how to do it, so here's some options:

1. since your update is periodic why not use a DEFINE_ON_DEMAND - this works the same as an adjust, but since you're outside the solver iterations, I imagine that using C_U could work.

2. If 1 doesn't work - try it with updating the _M1 variables instead.

3. If 1 & 2 doesn't work change the _M1 variables on the first iteration of the new timestep using your define_adjust.

4. If 1-3 fail, you can use the text interface to tell fluent explicitly when to change to a new timestep (rather than use the default method). For sure if you play with this and combine with 1-3 there will be a way to update the variables correctly. For this cause, you can write a scheme macro with which you can implement your iterative method. (I've developed my own scheme macros for a hybrid steady-unsteady (pseudo-steady) solution method and it works quite well!)

and yep no text interface to the patch command is a pain!

Good Luck


In a non-steady solution

mystic_cfd September 2, 2002 04:54

Re: Bug in the DEFINE_ADJUST macro?
off topic,

but picking up on Greg's last comment, how can we get Fluent to add a bit of code to allow the patch command in the text user interface?

Or is there a clever dude out there who already coded the scheme for it and would like to share?

may convergence be with you...

Vivek Buwa September 2, 2002 10:32

Re: Bug in the DEFINE_ADJUST macro?
Hey Senthil,

It worked well for my case. We have used DEFINE_ADJUST for changing fluent variables for time dependent solution. I wonder what could have gone wrong in your case!


Senthil September 3, 2002 18:29

Re: Bug in the DEFINE_ADJUST macro?
When we change the flow field values, we are always changing the corresponding values for previous time steps (_M1 and _M2). We have tried using various macros like DEFINE_ON_DEMAND, DEFINE_INIT macro. None of these macros worked for our case. I did not understand your suggestion 4. Can you please explain how to do that.



Greg Perkins September 3, 2002 22:26

Re: Bug in the DEFINE_ADJUST macro?
In the text interface you can break up a time step into the update new time level and solve iterations. This gives you more control over when the change to _M1 etc occurs.

Check out the user manual for the text interface and have a play around with the options.


All times are GMT -4. The time now is 20:32.