CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Is there an equivalent of "NODE_POS_NEED_UPDATE" for face values? (https://www.cfd-online.com/Forums/fluent-udf/157280-there-equivalent-node_pos_need_update-face-values.html)

Leb July 24, 2015 12:21

Is there an equivalent of "NODE_POS_NEED_UPDATE" for face values?
 
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...

gearboy July 24, 2015 16:02

Quote:

Originally Posted by Leb (Post 556873)
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.

Leb July 24, 2015 16:36

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...


All times are GMT -4. The time now is 14:19.