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

UDF save data to a file!!

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 19, 2010, 06:38
Default
  #21
Member
 
Ivan
Join Date: Aug 2009
Posts: 63
Rep Power: 4
IvanCFD is on a distinguished road
Hi,

I've checked many times that what there is in that journal file is what I want Fluent to pick up...

What I'm gonna do is to smash both the .cas and .dat files and start over. I'll even delete the folder where they're located.

I haven't run your script because I don't understand the meaning of
13 () no pressure () no
I'll let you know where I end up.
IvanCFD is offline   Reply With Quote

Old   May 19, 2010, 07:25
Default
  #22
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 619
Rep Power: 8
dmoroian is on a distinguished road
Quote:
Originally Posted by IvanCFD View Post
Hi,

I've checked many times that what there is in that journal file is what I want Fluent to pick up...

What I'm gonna do is to smash both the .cas and .dat files and start over. I'll even delete the folder where they're located.

I haven't run your script because I don't understand the meaning of
13 () no pressure () no
I'll let you know where I end up.
Before you continue with your gui script, try to type in the text interface:
Code:
/file/export
then you will understand the meaning of the entire command from above.
The GUI record macro was just a pedagogical exercise.
dmoroian is offline   Reply With Quote

Old   May 19, 2010, 09:58
Default
  #23
Member
 
Ivan
Join Date: Aug 2009
Posts: 63
Rep Power: 4
IvanCFD is on a distinguished road
I know what you mean.

Well it doesn't seem to work either.

I've created the journal file attached to this post, following your instructions ad you'll be able to see. However, I keep getting the same error message related to out of malloc memory (see picture attached).

On the other hand, just to see if that malloc memory issue could be solved somehow, I'm running a single precision simulation based on the same case and it seems to work.

I don't know what else I can do.

Do you have idea how many extra iterations per time step I have to run compared to a double precision case?

Cheers,

Ivan.
Attached Images
File Type: jpg error3.jpg (68.9 KB, 11 views)
Attached Files
File Type: zip store_data_ascii.jou.zip (1.3 KB, 6 views)
IvanCFD is offline   Reply With Quote

Old   May 19, 2010, 11:36
Default
  #24
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 619
Rep Power: 8
dmoroian is on a distinguished road
The journal file looks ok, at first glance. Most likely there is something wrong with the case file.
You could ask fluent support for that error.
I don't think it matters how many iterations you run in single precision, if both calculations are converged, the double precision should always be more accurate. However, the difference may sometimes be insignificant.
dmoroian is offline   Reply With Quote

Old   March 8, 2011, 08:28
Default
  #25
Member
 
Join Date: Sep 2009
Posts: 52
Rep Power: 4
DarrenC is on a distinguished road
HI dmoroian

I am having a slightly different problem and I was wondering if you know of any other way around it. I need to monitor approximately 5000 points in my simulation per time step.

1.Surface point monitors do not work as they crash due to too many individual points

2. I tried file/transient-export TUI, this works in my PC. But when I load the simulation into a cluster, it does not give me the option to write it into 'ascii' format. Further investigation points out that Fluent Parallel dosent support transient-export in 'ascii' format.

Do you have any idea how else I can monitor so many individual points??

Thanks in advance.
DarrenC is offline   Reply With Quote

Old   March 9, 2011, 04:13
Default
  #26
Senior Member
 
dmoroian's Avatar
 
Dragos
Join Date: Mar 2009
Posts: 619
Rep Power: 8
dmoroian is on a distinguished road
Code:
void mapCell(real *x, cell_t *cell, Thread **thread)
{
   Domain *d = Get_Domain(1);
   Thread *t;
   cell_t c;
   real centroid[ND_ND];
   real dist2[ND_ND];
   real min = 1.0e6;

   thread_loop_c(t,d)
   {
      begin_c_loop(c,t)
      {
         C_CENTROID(centroid,c,t);
         NV_VV(dist2,=,centroid,-,x);
         if (min > NV_MAG2(dist2))
         {
            min = NV_MAG2(dist2);
            *cell = c;
            *thread = t;
         }
      }
   }
}

DEFINE_EXECUTE_AT_END(bubu)
{
   static cell_c *mapCells = NULL;
   static Thread **mapThreads = NULL;
   static real points[5000][3] = {{0,0,0},{1,1,1}......};/*this is the vector defining the monitoring points*/
   int i;
   char name[100];
   
   if(NULL == (mapCells = (cell_c*)calloc(5000,sizeof(cell_c))))
      Error("Could not allocate the memory!\n");
   if(NULL == (mapThreads = (Thread**)calloc(5000,sizeof(Thread*))))
      Error("Could not allocate the memory!\n");
   
   for(i = 0; i < 5000; i++)
   {
      mapCell(points[i], &mapCells[i], &mapThreads[i]);
      sprintf(name,"m-%05d.out",i);
      pf = fopen(name,"a");
      fprintf(pf,"%f\n",C_T(mapCells[i],mapThreads[i]));
      fclose(pf);
   }   
}
I didn't know about the limitation with the high number of monitors. So here it is an example using an udf.
Take the above code as it is "just an example". I did not try it, it is not optimized, nor it correctly works in parallel.
Basically it finds the corresponding cell for each monitor and prints out the temperature in a separate file.

I hope this is helpful!
dmoroian is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working directory via command line Luiz CFX 4 March 6, 2011 20:02
UDF Getting data from file jreig FLUENT 0 July 10, 2009 08:07
Smallest binary file format to save large data Zonexo Main CFD Forum 2 June 2, 2008 20:25
Axisymmetrical mesh Rasmus Gjesing (Gjesing) OpenFOAM Native Meshers: blockMesh 10 April 2, 2007 14:00
UDF (write a data file) problem lichun Dong FLUENT 2 July 29, 2005 11:39


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