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/)
-   -   Problem w UDF parallel for porous media (https://www.cfd-online.com/Forums/fluent-udf/145073-problem-w-udf-parallel-porous-media.html)

Well November 27, 2014 11:23

Problem w UDF parallel for porous media
 
Hi there,

first post in this forum. Hope it does work!

I am having problems with a UDF for the calculation of viscous and intertial resistances, see the code later on. I am able to compile it for parallel use. The only warning I get is:
y:\libudf2\src\porosity02505ny.c(10) : warning C4700: uninitialized local variable 'c' used

I load the UDF and try to initialize the case, but get the following message:
MPI Application rank 0 exited before MPI_Finalize() with status -1073741819

999999: mpt_write: error: write failed trying to write 4 bytes: No such file or directory
The fl process could not be started.


Here is the UDF code:
#include "udf.h"

DEFINE_PROFILE(visc_resistance_ny, t, nv)
{
cell_t c;
#if !RP_HOST

real coordinate[ND_ND];

C_CENTROID(coordinate,c,t);
begin_c_loop(c,t)
{
C_PROFILE(c,t,nv)=-1884707.52662278*coordinate[2]+6577498.83890377;
}
end_c_loop(c,t)
#endif
}


DEFINE_PROFILE(inert_resistance_ny, t, nv)
{
cell_t c;
#if !RP_HOST

real coordinate[ND_ND];

C_CENTROID(coordinate,c,t);
begin_c_loop(c,t)
{
C_PROFILE(c,t,nv)=-1846.70361906*coordinate[2]+6770.36620687;
}
end_c_loop(c,t)
#endif
}


Any help is appreciated!!!
Cheers

pakk November 28, 2014 06:26

One of your problems is here:
Code:

C_CENTROID(coordinate,c,t);
begin_c_loop(c,t)
{
...
}

In the first line, you tell Fluent to calculate the coordinates of cell c, but Fluent has no idea which cell c is. That is what the warning "uninitialized local variable 'c' used" means.
In the second line, you tell Fluent that c should be all of the cells in thread t. Now Fluent knows which cell c should be, but that is too late.

The solution: change them: first tell Fluent which cell c is, and tell fluent to calculate the position of cell c. In code:
Code:

begin_c_loop(c,t)
{
C_CENTROID(coordinate,c,t);
...
}

The MPI problem might be something completely else, and might be much harder to solve. I don't know.

Well November 28, 2014 07:41

You are so right. This completely solved my problem, even the MPI one!
Thank you so much.

Cheers


All times are GMT -4. The time now is 22:03.