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/)
-   -   UDF Parallel problem (http://www.cfd-online.com/Forums/fluent-udf/106177-udf-parallel-problem.html)

startup0820 August 21, 2012 09:47

UDF Parallel problem
 
Hello! Guys!

Thanks to you, I was able to complete the UDF.

Is not a problem in the serial condition, but an error occurs in the parallel condition.

If you know Please advise me.

Thanks for your help everytime.

FLUENT 14, 64bit

-------------------------------------------------------------------


#include "udf.h"

#include "dpm.h"

DEFINE_EXECUTE_AT_END(MonkeyMagic)

{

CX_Cell_Id *c;

cell_t ct;

Thread *t;

real x[3] = {0.0, 0.0, 0.0};

real W_Velocity;

int N,i;

FILE *output,*points;

Domain *d = Get_Domain(1);

points = fopen("points.txt","r");

output = fopen("results.out","a");

fscanf(points,"%d \n",&N);



for ( i=0;i<N;i++ )

{

fscanf(points,"%e%e%e\n",&x[0],&x[1],&x[2]);

SV_locate_point(x,c);

ct = c->ct.c;

t = c->ct.t;

C_CENTROID(x, ct, t);

W_Velocity=C_W(ct,t);

fprintf(output, "%.6f\n",W_Velocity);

}

fclose(output);

fclose(points);

}


-----------------------------------------------------------

startup0820 August 23, 2012 14:37

Plz... help me.

Daniel Tanner August 24, 2012 04:13

What was the error?

startup0820 August 24, 2012 04:19

I got the following error.


----------------------------------------------------------------------------------
999999 (..\src\mpsystem.c@1173): mpt_read: failed: errno = 10054

999999: mpt_read: error: read failed trying to read 4 bytes: No such file or directory
MPI Application ranMk PI Appli0 ecatxiiotedn r beank fore4 ex ited bMPIefor_Fie naliMzeP() Iwit_h sFtaituns a-lize() with status 107-10737374181941819

The Parallel FLUENT process could not be started.
----------------------------------------------------------------------------------

startup0820 August 24, 2012 04:22

Quote:

Originally Posted by Daniel Tanner (Post 378485)
What was the error?

I got the following error.


----------------------------------------------------------------------------------
999999 (..\src\mpsystem.c@1173): mpt_read: failed: errno = 10054

999999: mpt_read: error: read failed trying to read 4 bytes: No such file or directory
MPI Application ranMk PI Appli0 ecatxiiotedn r beank fore4 ex ited bMPIefor_Fie naliMzeP() Iwit_h sFtaituns a-lize() with status 107-10737374181941819

The Parallel FLUENT process could not be started.
----------------------------------------------------------------------------------



Changed as follows. However, the error has occurred.

---------------------------------------------------------------------------------
#include "udf.h"
#include "dpm.h"


DEFINE_EXECUTE_AT_END(MonkeyMagic)

{
#if !RP_HOST
CX_Cell_Id *c;
cell_t ct;
Thread *t;
Domain *d = Get_Domain(1);
#endif


real x[3] = {0.0, 0.0, 0.0};
real W_Velocity;
int N,i;


#if !RP_NODE
FILE *output,*points;
points = fopen("points.txt","r");
output = fopen("results.txt","a");
#endif

#if !RP_NODE
fscanf(points,"%d \n",&N);
#endif

for ( i=0;i<N;i++ )

{
#if !RP_NODE
fscanf(points,"%e%e%e\n",&x[0],&x[1],&x[2]);
#endif

#if !RP_HOST
SV_locate_point(x,c);

ct = c->ct.c;

t = c->ct.t;

C_CENTROID(x, ct, t);

W_Velocity=C_W(ct,t);
#endif


node_to_host_float_1(W_Velocity);


#if !RP_NODE
fprintf(output, "%.6f\n",W_Velocity);
#endif
}
#if !RP_NODE
fclose(output);
fclose(points);
#endif
}
----------------------------------------------------------------------------

Daniel Tanner August 24, 2012 04:26

Maybe this is the problem.

real x[3] = {0.0, 0.0, 0.0};

The index starts at 0 so this has four elements (0,1,2,3).

startup0820 August 24, 2012 04:45

Quote:

Originally Posted by Daniel Tanner (Post 378492)
Maybe this is the problem.

real x[3] = {0.0, 0.0, 0.0};

The index starts at 0 so this has four elements (0,1,2,3).

but the problem does not occur in the serial interpretation,.

only parallel occur..

Just before the modification, but the problem still occurs.

antonk67 August 31, 2012 08:52

Writing the parallel code you should be aware about a lot of things. In your case think about the following:
1) you can write only from host, but you can read from any node
2) if you have the distributed memory, it means that the data read at only one node should be send to another or all others to be available there. Otherwise you will have the default value or uninitialised value.
3) the cell you are seeking can be located on the other node.
4) maybe I am wrong, but it sounds like your seek function is for the oct-tree mesh.


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