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

Is there an equivalent of "NODE_POS_NEED_UPDATE" for face values?

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

Reply
 
LinkBack Thread Tools Display Modes
Old   July 24, 2015, 12:21
Default Is there an equivalent of "NODE_POS_NEED_UPDATE" for face values?
  #1
Leb
New Member
 
V.Leb
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Leb is on a distinguished road
Hi,

I'm trying to use DEFINE_PROFILE in a transient case and the problem I encounter is that my velocity component data file (which has data for *all* time steps, not just a single one) is read every iteration as opposed to time step, so I was wondering if there is an equivalent to NODE_POS_NEED_UPDATE used in DEFINE_GRID_MOTION? Or is there an alternative way?

Code:
#include "udf.h"



DEFINE_PROFILE(v_component, thread, position)
{
face_t f;
real x[ND_ND];
real y;
double v;
real t = CURRENT_TIME;
FILE *v_values;
v_values = fopen("v_intp.txt","r");

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
y = x[1];

fscanf(v_values, "%lf\n", &v);
Message("The v is %lf\n", v);
Message("The x is %f\n", x[0]);
F_PROFILE(f, thread, position)  = v;
}
end_f_loop(f, thread)
}
In other words, I need to read next profile data lines every time step, not iteration...

Last edited by Leb; July 24, 2015 at 13:50. Reason: Clarification
Leb is offline   Reply With Quote

Old   July 24, 2015, 16:02
Default
  #2
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 106
Rep Power: 7
gearboy is on a distinguished road
Quote:
Originally Posted by Leb View Post
Hi,

I'm trying to use DEFINE_PROFILE in a transient case and the problem I encounter is that my velocity component data file (which has data for *all* time steps, not just a single one) is read every iteration as opposed to time step, so I was wondering if there is an equivalent to NODE_POS_NEED_UPDATE used in DEFINE_GRID_MOTION? Or is there an alternative way?

Code:
#include "udf.h"



DEFINE_PROFILE(v_component, thread, position)
{
face_t f;
real x[ND_ND];
real y;
double v;
real t = CURRENT_TIME;
FILE *v_values;
v_values = fopen("v_intp.txt","r");

begin_f_loop(f, thread)
{
F_CENTROID(x,f,thread);
y = x[1];

fscanf(v_values, "%lf\n", &v);
Message("The v is %lf\n", v);
Message("The x is %f\n", x[0]);
F_PROFILE(f, thread, position)  = v;
}
end_f_loop(f, thread)
}
In other words, I need to read next profile data lines every time step, not iteration...
I believe Fluent will run DEFINE_PROFILE every iteration. So,just put your reading/close file function in it. The profile will be updated every iteration.
gearboy is offline   Reply With Quote

Old   July 24, 2015, 16:36
Default
  #3
Leb
New Member
 
V.Leb
Join Date: Jun 2015
Posts: 7
Rep Power: 2
Leb is on a distinguished road
Thanks for your reply, but as I mentioned, I do *not* want to update the profile every iteration, but every time step.

I was hoping that I could use something like this:

Code:
if (t = 0.000000)
	u_values = fopen("u_comp_0.txt","r");
else
	{
	u_values = fopen(strcat(strcat(foo,str),bar ),"r");
	}
where
Code:
 strcat(strcat(foo,str),bar )
is simply the division of CURRENT_TIME by my time_step (which is fixed), but I got a fatal signal (ACCESS_VIOLATION) for some reason...
Leb 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
cyclic BC - modify boundary face values marluc OpenFOAM Programming & Development 0 May 4, 2015 16:50
Velocity values are normal but pressure values are too big rv82 OpenFOAM Running, Solving & CFD 4 April 13, 2015 03:59
using chemkin JMDag2004 OpenFOAM Pre-Processing 1 December 15, 2014 17:38
Setting patch field values equal to internal field values leroyv OpenFOAM Programming & Development 1 October 21, 2014 15:49
strange node values @ solid/fluid interface - help JB FLUENT 2 November 1, 2008 13:04


All times are GMT -4. The time now is 11:21.