CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (http://www.cfd-online.com/Forums/fluent-udf/)
-   -   F_UDMI how to postprocess? (http://www.cfd-online.com/Forums/fluent-udf/40509-f_udmi-how-postprocess.html)

Kasper Skriver April 10, 2006 08:01

F_UDMI how to postprocess?
 
Hello everybody

I'm working on a case where I need to store some face values using F_UDMI. I also need to use C_UDMI to store some cell center values.

My questions are:

- does the index in the C_UDMI and F_UDMI need to be different from each other. (will it conflict if I use C_UDMI(c,t,0) and F_UDMI(f,t,0) different from F_UDMI(f,t,1)) ?

- is it correct understood that the F_UDMI only applies for boundary faces?

- and finally, how do I access the F_UDMI values once done with the iterations? How do I postprocess(plot) it?

Regards Kasper Skriver FLS Airtech - Denmark

-------------------------------------------------------- Some initializing code

#include "udf.h"

DEFINE_INIT( initialize, d) {

Thread *t;

cell_t c;

face_t f;

thread_loop_c(t,d)

{

begin_c_loop(c,t)

{

/* INITIALISERER C_UDMI'ER OG C_UDSI'ER */

C_UDMI(c,t,0) = 2; /* Vey FOR CELLER */

//C_UDSI(c,t,0) = 1; /* POTENTIALET */

//C_UDSI(c,t,1) = 1; /* KONCENTRATIONEN C */

}

end_c_loop(c,t)

}

thread_loop_f(t,d)

{

if (BOUNDARY_FACE_THREAD_P(t))

{

begin_f_loop(f,t)

{

/* INITIALISERER F_UDMI'ER */

F_UDMI(f,t,1) = 1; /* Vey FOR FACES */

Message("f_udmi(f,t,1)=%g\n",F_UDMI(f,t,1));

}

end_f_loop(f,t)

}

else

{

}

} }

Ugur April 20, 2006 11:55

Re: F_UDMI how to postprocess?
 
Have you compiled this code and does it work? If I'm not mistaken, you cannot modify F_UDMI but they are interpolated from C_UDMI values. Therefore, there is a possibility that this code gives you a SEGMENTATION VIOLATION or ACCESS VIOLATION type of error.

Kasper Skriver April 20, 2006 12:09

Re: F_UDMI how to postprocess?
 
Yes, I have compiled it and it works fine.

I don't think that F_UDMI is interpolated from C_UDMI, and it works for the same index i in both F_UDMI and C_UDMI.

I can even check the values with Message('blabla',F_UDMI(f,t,0)); and it prints what I previously set it to be - no interpolation!

Im confused about the indexing, so are my FLUENT supporter in Sweden. Also confused about why you can't assign values to the F_UDMI inside the domain - here I think you are right about the interpolation. On boundaries it's different.

Kasper

Ugur April 20, 2006 16:54

Re: F_UDMI how to postprocess?
 
I meant just like any other face values they are not accessible inside the domain. The boundary faces are a different story. I think when you use F_UDMI(f,t,*), it should work when t is a pointer for face thread. For any other faces inside the domain, I don't think it will work.

lx33101128 March 24, 2009 05:17

Quote:

Originally Posted by Kasper Skriver
;131457
Yes, I have compiled it and it works fine.

I don't think that F_UDMI is interpolated from C_UDMI, and it works for the same index i in both F_UDMI and C_UDMI.

I can even check the values with Message('blabla',F_UDMI(f,t,0)); and it prints what I previously set it to be - no interpolation!

Im confused about the indexing, so are my FLUENT supporter in Sweden. Also confused about why you can't assign values to the F_UDMI inside the domain - here I think you are right about the interpolation. On boundaries it's different.

Kasper

does it work? in my systerm it can be complied, but when it works, there will be an error?

coglione March 24, 2009 05:59

Hi Kasper,

1) as soon as you define a UDM with index i memory gets allocated for it in each cell and on boundary face threads. Thus there is no need to define two different UDMI's if the purpose is to store a single quantity in cells and on boundaries.

2) to postprocess F_UDMI: i understand it as follows: if you plot contours on a boundary surface with node values on you will see actually F_UDMI, with node values off you get the value of C_UDMI in the adjacent cell to your boundary.

cheers

isabel November 25, 2009 12:50

Hello everybody,

I want to program a F_UDMI with the value of 10*temperature. First, I programmed it as a C_UDMI and it worked Ok. But when I program it as a F_UDMI, I have this error:

Error: FLUENT received fatal signal (ACCESS_VIOLATION)
  • Note exact events leading to error.
  • Savee case/data under new name.
  • Exit program and restart to continue.
  • Report error to your distributor.
Error Object: ()

The C++ program as C_UDMI (which works Ok) is this:

#include "udf.h"
DEFINE_ON_DEMAND(function)
{
Domain *d;
Thread *t;
cell_t c;
d=Get_Domain(1);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0)=10*C_T(c,t);
}
end_c_loop(c,t)
}
}



The C++ program as F_UDMI (which fives the violation error) is this:

#include "udf.h"
DEFINE_ON_DEMAND(function)
{
Domain *d;
Thread *t;
face_t f;
d=Get_Domain(1);
thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
F_UDMI(f,t,0)=10*F_T(f,t);
}
end_f_loop(f,t)
}
}



Does anybody know why the code runs Ok as a C_UDMI and not as a F_UDMI ???

Agnieszka November 26, 2009 04:37

Hello,
I have also problem with postprocessing. In detail, I need write some date from Fluent to Microsoft Excel. Those data: axial velocity, radial velocity and tangential velocity dependent on dimenssionless radius r/R. I don't know where I can find those data and how I can read them. Please help me.
Best regards,
Agnieszka

dmoroian November 26, 2009 06:59

Quote:

Originally Posted by isabel (Post 237706)
I want to program a F_UDMI with the value of 10*temperature. First, I programmed it as a C_UDMI and it worked Ok. But when I program it as a F_UDMI, I have this error:

Error: FLUENT received fatal signal (ACCESS_VIOLATION)
  • Note exact events leading to error.
  • Savee case/data under new name.
  • Exit program and restart to continue.
  • Report error to your distributor.
Error Object: ()

...


Does anybody know why the code runs Ok as a C_UDMI and not as a F_UDMI ???

Hi Isabel,
In the UDF Manual, it is specified that F_UDMI is defined only on boundary faces, and not interior! If you try to use the interior faces you will get the kind of errors you see above.
As a general note, not all the variables are defined on the faces.

Dragos

dmoroian November 26, 2009 07:04

Quote:

Originally Posted by Agnieszka (Post 237775)
Hello,
I have also problem with postprocessing. In detail, I need write some date from Fluent to Microsoft Excel. Those data: axial velocity, radial velocity and tangential velocity dependent on dimenssionless radius r/R. I don't know where I can find those data and how I can read them. Please help me.
Best regards,
Agnieszka

Hi Agnieszka,
You don't really need to write a udf for this purpose. There is a menu option (File->Export) that lets you export the data in many different formats.
Try that first!

isabel November 26, 2009 07:14

I only want the temperature on the face, so I defined 10*F_T(f,t).
This code is to take values at the faces. It compiles Ok, but when I try to iterate it gives a violation error.

#include "udf.h"
DEFINE_ON_DEMAND(function)
{
Domain *d;
Thread *t;
face_t f;
d=Get_Domain(1);
thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
F_UDMI(f,t,0)=10*F_T(f,t);
}
end_f_loop(f,t)
}
}

dmoroian November 26, 2009 07:35

You are looping over the faces in the entire domain, not only on the boundaries, whereas the F_UDMI is defined only on the boundary faces. If you intended to set the values only on the boundaries, then a quick fix should be to replace:
Code:

F_UDMI(f,t,0)=10*F_T(f,t);
with:
Code:

if(N_UDM > 0 && BOUNDARY_FACE_THREAD_P(t))
  F_UDMI(f,t,0)=10*F_T(f,t);

It is very important to understand the difference (check the UDF Manual section 3.2.4), otherwise you will end-up with segmentation faults, all the time.

isabel November 26, 2009 08:09

Sorry, but I have added the line you suggested to me but I have the violation error when I do the define-->user defined --> execute on demand

My new code is as follows:

#include "udf.h"
DEFINE_ON_DEMAND(function)
{
Domain *d;
Thread *t;
face_t f;
d=Get_Domain(1);
thread_loop_f(t,d)
{
begin_f_loop(f,t)
{
if(N_UDM > 0 && BOUNDARY_FACE_THREAD_P(t))
F_UDMI(f,t,0)=10*F_T(f,t);
}
end_f_loop(f,t)
}
}

dmoroian November 27, 2009 03:41

I don't see anything wrong with the last udf, so probably you are executing the old one. Try to erase the directory "libudf" and compile again.

Kanarya November 30, 2012 11:35

Quote:

Originally Posted by dmoroian (Post 237804)
Hi Isabel,
In the UDF Manual, it is specified that F_UDMI is defined only on boundary faces, and not interior! If you try to use the interior faces you will get the kind of errors you see above.
As a general note, not all the variables are defined on the faces.

Dragos

Hi,
Hi,
it seems like F_UDMI doesnt save anything! value is always "0"!
is there any one who can explain this?
thanks in advance!

dmoroian December 1, 2012 05:21

Please give more details, in order for the rest of the community to be able to help you. F_UDMI is just a storage place, and you have to put something in it before you want to see any change.

Kanarya December 1, 2012 07:33

Quote:

Originally Posted by dmoroian (Post 395135)
Please give more details, in order for the rest of the community to be able to help you. F_UDMI is just a storage place, and you have to put something in it before you want to see any change.

Hi Dmoroian,
thanks for the answer. this program is reading outlet solid mass flow and I would like to save it and then use it in the inlet profile but it seems F_UDMI doesnt save anything. thanks for the help
#include "udf.h"
DEFINE_EXECUTE_AT_END(measure_mass_flow)
{
real mass_flow;
real mass_flow_g;
Domain *d=Get_Domain(1);
cell_t c;
face_t f;
Thread *mixture_thread = Lookup_Thread(d,4);
Thread **pt = THREAD_SUB_THREADS(mixture_thread);
Thread *tp = pt[0];
Thread *ts = pt[1];

mass_flow=0.;
//mass_flow=0.;
mp_thread_loop_f(mixture_thread,d,pt)

if( THREAD_ID(mixture_thread) == 4 )

{
begin_f_loop(f,mixture_thread)

{
mass_flow+=F_FLUX(f,ts);


F_UDMI(f,t,0)=mass_flow;
}
end_f_loop(f,mixture_thread)
}


Message("mass_flow:%g/n",mass_flow);

}

dmoroian December 8, 2012 21:15

I think that the mass flux is defined only at mixture level. Consequently, you should use
mass_ flow += F_ FLUX(f,mixture_ thread);
and weigh the value with a vof value averaged between the 2 cells sharing the face "f".

Kanarya January 18, 2013 05:24

C_udmi
 
Hi Dmoroian,

I saved massflow rate at outlet and I want to use it like inlet it seems doesnt work. inlet always is zero?

begin_f_loop(f,t)
{
c0 = F_C0(f, t);
t0 = THREAD_T0(t);
mass_flow +=F_FLUX(f,pt[SOLID_PHASE_ID]);
C_UDMI(c0,t0,0)=mass_flow;
}
end_f_loop(f,t)

and my inlet profile is:

DEFINE_PROFILE(B0, t, i)
{ cell_t c0; face_t f; Thread *ct;
begin_f_loop(f, t)
{ c0 = F_C0(f,t); ct = t->t0;
F_PROFILE(f,t,i) = C_UDMI(c0,ct,0); }
end_f_loop(f,t) }

but it doesnt work :(

thanks in advance!!!

dmoroian January 19, 2013 20:00

You store values in C_ UDMI's next to the outlet, and then use other C_ UDMI's next to the inlet to set the inlet b.c. The two sets of C_ UDMI's are different, so there is no surprise that it ' does not work'.


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