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 to patch at each time step?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 14, 2014, 06:32
Default DEFINE_ADJUST to patch at each time step?
  #1
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
Hi all,
I have a problem with a udf (I'm not very expert).

Problem: 2D problem with 2 fluids and one solid, as in the attached picture.
Only energy is solved, no motion.
Problem is transient: total time 7200 seconds, time step: 1 second

I want to patch water at each time step with a temperature which is function of time (linear function, from 5 ˚C at time 0 s to 8 ˚C at time 7200 s).

I think I should go with the DEFINE_ADJUST macro but I don't know how to assign temperature to water domain.

Any help is appreciated.

Thank you,

Daniele
Attached Images
File Type: png cfd.png (10.0 KB, 25 views)
ghost82 is offline   Reply With Quote

Old   March 14, 2014, 07:42
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
Solved, if anyone else needs it:

Code:
#include "udf.h"

DEFINE_ADJUST(my_adjust,d)
{
     cell_t c;
     Thread *t;
     real xc[ND_ND];
     real time = CURRENT_TIME;

     thread_loop_c(t,d)
     {
            begin_c_loop_all(c,t)
            {
                     C_CENTROID(xc,c,t);
                     
                     /*put here the temperature function of time such as C_T(c,t)=(3.0/7200.0*time+36000.0/7200.0)+273.15; Use if && || to define zones by system geometry to patch */

             }
             end_c_loop_all(c,t)
     }
}
ghost82 is offline   Reply With Quote

Reply


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
InterFoam negative alpha karasa03 OpenFOAM 7 December 12, 2013 03:41
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28
plot over time fferroni OpenFOAM Post-Processing 7 June 8, 2012 07:56
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 02:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 18:07


All times are GMT -4. The time now is 03:45.