CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

DEFINE_ADJUST Application

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2016, 12:35
Default DEFINE_ADJUST Application
  #1
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 10
Student_GF is on a distinguished road
Hi All,

I am confused on the DEFINE_ADJUST macro as there is not much in the UDF manual. Would it be possible to alter material properties (e.g. diffusivity) via DEFINE_ADJUST? In addition, can someone please explain how the DEFINE_ADJUST macro works?

Thanks all!
Student_GF is offline   Reply With Quote

Old   June 14, 2016, 05:02
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
Quote:
Originally Posted by Student_GF View Post
Hi All,

I am confused on the DEFINE_ADJUST macro as there is not much in the UDF manual. Would it be possible to alter material properties (e.g. diffusivity) via DEFINE_ADJUST? In addition, can someone please explain how the DEFINE_ADJUST macro works?

Thanks all!
DEFINE_ADJUST macro solves everything you put inside it for each iteration. You can add functions to your code and call for these inside the DEFINE_ADJUST. The diffusivity has its one macro. You can use it to alter/define the diffusivity for each iteration.
Bruno Machado is offline   Reply With Quote

Old   June 14, 2016, 09:51
Default
  #3
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 10
Student_GF is on a distinguished road
Hi Bruno,

Thank you for the reply. Can elaborate when you say "add functions to your code and call for these inside the DEFINE_ADJUST"? Do you mean I could call on the DEFINE_ADJUST code from a DEFINE_DIFFUSIVITY code? I am asking because I am not exactly sure how DEFINE_ADJUST works as I am not sure how it can alter values in specific fields such as boundary conditions.

Thank you for the help! Much appreciated.
Student_GF is offline   Reply With Quote

Old   June 14, 2016, 10:02
Default
  #4
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 12
Bruno Machado is on a distinguished road
Quote:
Originally Posted by Student_GF View Post
Hi Bruno,

Thank you for the reply. Can elaborate when you say "add functions to your code and call for these inside the DEFINE_ADJUST"? Do you mean I could call on the DEFINE_ADJUST code from a DEFINE_DIFFUSIVITY code? I am asking because I am not exactly sure how DEFINE_ADJUST works as I am not sure how it can alter values in specific fields such as boundary conditions.

Thank you for the help! Much appreciated.
define adjust does not alter values in boundary conditions. there is a specific macros for it.

You can have different functions in your code, eg

real function1(c,t)
{ . . . }

real function2(c,t)
{ . . . }

real function3(c,t)
{ . . . }

In your define adjust, you can call these functions and it will be computed each iteration

DEFINE_ADJUST(whatever,d)
{
Thread *t;
cell_t c;
real variable;
thread_loop_c (t,d)
{
begin_c_loop (c,t)
C_UDMI(c,t,0) = function1(c,t) + function2(c,t) + function3(c,t);
end_c_loop (c,t)
}
}

In this piece of code, you have 3 distinct functions and in your define adjust, you are defining an UDM as the sum of the three. This is one example, but you can apply many other purposes at it. You can also call the functions you define in the DEFINE_DIFFUSIVITY. Again, thousands of examples on internet.
Bruno Machado is offline   Reply With Quote

Old   June 14, 2016, 10:20
Default
  #5
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 10
Student_GF is on a distinguished road
Hi Bruno,

Thank you for the help. I believe I am understanding what you are saying. Can you elaborate on if the the following is possible via the DEFINE_ADJUST macro?

I would like to alter kinetic theory results from diffusivity by a factor (e.g. 1/x^2). Would this be possible via DEFINE_ADJUST or would I have to store the values via UDMI and then somehow recall it via DEFINE_DIFFUSIVITY and something like C_PROFILE?
Student_GF is offline   Reply With Quote

Old   June 14, 2016, 18:53
Default
  #6
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
There are a number of macros available within most hooks such as the x-velocity: C_U(c,t). However, if you alter the velocity, for example by setting it to uniform flow:

Code:
C_U(c,t) = 1.;
C_V(c,t) = 0.;
C_W(c,t) = 0.;
The solver will start with this value at the first iteration but then converge the flow field: losing your uniform flow field (technically, the DEFINE_ADJUST macro is called at the beginning of each iteration; the residuals will either be zero or never converge -- instead, say you only enabled this uniform flow at the beginning of each time step). For your case with defining the diffusivity, this material property can be modified with the DEFINE_DIFFUSIVITY macro. You shouldn't require using the DEFINE_ADJUST macro for modifying the diffusivity; what exactly is your equation you're implementing?
`e` is offline   Reply With Quote

Old   June 15, 2016, 10:04
Default
  #7
New Member
 
Join Date: Nov 2015
Posts: 16
Rep Power: 10
Student_GF is on a distinguished road
Hi e,

thank you for the reply. Here is what I am trying to do. I am trying to implement something to this extent in the diffusivity field

kinetic theory * some multiplicative factor (e.g. 0.5)

I do not want to rewrite the kinetic theory equation in a UDF as it will take a long time so I was wondering if the DEFINE_ADJUST can accomplish this. The problem I am running into is that all DEFINE_ADJUST macro example I can find are storing the values via UDSI or UDMI which will then require a UDF (most likely DEFINE_DIFFUSIVITY macro) to use this value for diffusivity. Doing this will remove the kinetic theory field for diffusivity, thus this process seems like it is invalid.

If this is not possible, please tell me, so I may go along another route.

Thank you so much,
GF
Student_GF is offline   Reply With Quote

Old   June 16, 2016, 08:27
Default
  #8
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Check if the laminar species (C_DIFF_L) or effective species (C_DIFF_EFF) diffusivity macros return the value you're after.
`e` is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in compute process - No Active Application yetlyg FLUENT 8 October 27, 2018 23:30
Results application error mich_K ANSYS 2 December 16, 2016 08:07
uninstall the user application milad653279 OpenFOAM Programming & Development 2 April 8, 2016 09:04
Problem with mpi_waitAll in application using openfoam shivaramakrishna OpenFOAM Programming & Development 0 March 9, 2016 08:20
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 15:53


All times are GMT -4. The time now is 04:07.