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

Trouble with Storing Values with F_UDMI

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 8, 2016, 15:36
Default Trouble with Storing Values with F_UDMI
  #1
Member
 
Joshua
Join Date: Aug 2014
Posts: 49
Rep Power: 12
jbo214 is on a distinguished road
I want to store some variables using F_UDMI so I can access them later, however I'm having issues with having Fluent store any data.

This is my test UDF:

Code:
#include "udf.h"
#include "storage.h"
#include "mem.h"


DEFINE_EXECUTE_AT_END(pos_write)
{	
	real pos[ND_ND];
	int zone_ID;

	face_t f; 
	cell_t c;

	Domain *d;
	Thread *t;
	
	zone_ID = 7;

	d = Get_Domain(1);
	t = Lookup_Thread(d,zone_ID);	// choose BC zone ID from BC panel in Fluent
	
	begin_f_loop(f,t)
		{
			F_CENTROID(pos,f,t);
			Message("X = , %f\n",pos[0]);
			F_UDMI(f,t,0) = pos[0];

		}
	end_f_loop(f,t)
}
The UDF prints out the accurate values for the x value of the face centroid in the console, but when I plot the data in the User Defined Memory, everything is just 0. I've double checked that I initialized enough UDM and that I am storing it to the correct index. I also verified that I am using the correct zone ID from the BC panel. I'm using this for a wall BC so F_UDMI is applicable here.

Any ideas?
jbo214 is offline   Reply With Quote

Old   November 9, 2016, 04:34
Default
  #2
`e`
Senior Member
 
Join Date: Mar 2015
Posts: 892
Rep Power: 18
`e` is on a distinguished road
Fluent is a cell centred solver, and its postprocessing takes values from the cells (either directly, or linearly interpolating for node values). You'll need to apply the same value to the adjacent cell as well to visualise in Fluent with contour plots etc. The adjacent cell and cell thread is retrieved with:

Code:
c = F_C0(f,t);
ct = F_C0_THREAD(f,t);
`e` is offline   Reply With Quote

Old   November 9, 2016, 12:13
Default
  #3
Member
 
Joshua
Join Date: Aug 2014
Posts: 49
Rep Power: 12
jbo214 is on a distinguished road
Quote:
Originally Posted by `e` View Post
... to visualise in Fluent with contour plots etc. ...

What about just a regular X-Y plot? I followed the steps in the manual and it doesn't seem to assign any values to adjacent cells. They just assign a value using F_UDMI.

Code:
/* Compute face temperature and store in user-defined memory */
begin_f_loop(f,t)
     {
          temp = F_T(f,t);
          F_UDMI(f,t,0) = (temp - tmin) / (tmax-tmin);
     }
end_f_loop(f,t)
jbo214 is offline   Reply With Quote

Old   November 9, 2016, 13:03
Default
  #4
Member
 
Joshua
Join Date: Aug 2014
Posts: 49
Rep Power: 12
jbo214 is on a distinguished road
I changed my UDF to use the adjacent cell and cell thread. It seems to store the proper information now.

Code:
#include "udf.h"
#include "storage.h"
#include "mem.h"

DEFINE_EXECUTE_AT_END(pos_write)
{	
	real pos[ND_ND];
	int zone_ID;

	face_t f; 
	cell_t c;
	

	Domain *d;
	Thread *t;

	Thread *ct;
	
	zone_ID = 7;

	d = Get_Domain(1);
	t = Lookup_Thread(d,zone_ID);	// choose BC zone ID from BC panel in Fluent
	
	c = F_C0(f,t);
	ct = F_C0_THREAD(f,t);


	begin_c_loop(c,ct)
		{
			C_CENTROID(pos,c,ct);
			Message("x =  %f\n",pos[0]);

			C_UDMI(c,ct,0) = pos[0];
		}
	end_c_loop(c,ct)			
}
jbo214 is offline   Reply With Quote

Reply

Tags
fluent, fluent - udf, f_udmi, udf


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
using chemkin JMDag2004 OpenFOAM Pre-Processing 2 March 8, 2016 23:38
Setting patch field values equal to internal field values leroyv OpenFOAM Programming & Development 1 October 21, 2014 16:49
Loading Cell Values in Tecplot P1361 OpenFOAM Post-Processing 3 September 16, 2014 05:02
WARNINGS I don't want to have Gabriel Siemens 3 August 10, 2007 18:04
Plotting raw data values Wilesco Siemens 0 January 5, 2006 06:34


All times are GMT -4. The time now is 17:34.