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

MPI Application rank 0 exited before MPI_Finalize() with status 2

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 2 Post By pakk
  • 1 Post By pakk
  • 1 Post By pakk
  • 1 Post By pakk
  • 1 Post By pakk

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2021, 02:26
Default MPI Application rank 0 exited before MPI_Finalize() with status 2
  #1
Member
 
Amirreza Niazmehr
Join Date: Nov 2018
Posts: 40
Rep Power: 7
Amirreza_pro is on a distinguished road
Hi guys
I'm using user defined real gas model which is a kind of udf.
For Cp I have a interpolation function which comes from our own descrete data for Cp.
In a part of our udf we are calculatig numerically the enthalpy which has this formulation:

The numerical Scheme which we are using is: Trapezoidal Rule as follow:

Code:
double Air_enthalpy(cell_t c, Thread *t, double temp, double density, double P, double yi[])
{
	Thread *tf,*t0,*t1;
    face_t f;
    cell_t c0,c1;
    c0=F_C0(f,tf,0); // adjacent cell id
	//c1=F_C1(f,tf); // adjacent cell id
    t0 = F_C0_THREAD(f,tf); // adjacent cell thread
	//t1 = F_C1_THREAD(f,tf); // adjacent cell thread
    double Cp = Air_specific_heat(c, t, temp, density, P, yi) ; 
    double tempb= C_T(c0,t0);
    //double tempf= C_T(c1,t1);
	double delT=(temp-tempb);
	double Cpb = Air_specific_heat(c0, t0, temp, density, P, yi);
	//double Cpf = Air_specific_heat(c1, t1, tempf, density, P, yi) ;
	
	double delta_h = ((Cp+Cpb)/2)*(delT) ;

    return H_REF+Air_H_ideal_gas(temp)+delta_h; //(J/Kg)
I can compile and load the udf successfully!
But when I'm going to run the calculations, I get this error from Fluent:
MPI Application rank 0 exited before MPI_Finalize() with status 2
LoadingMATERIALS
The fl process could not be started.


Does my UDF has some problems?
Does anybody has any idea, how to fix it?
Amirreza_pro is offline   Reply With Quote

Old   March 27, 2021, 03:28
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Let's see how the compiler reads this piece of code

Code:
face_t f;
    cell_t c0,c1;
    c0=F_C0(f,tf,0); // adjacent cell id
Line by line.
First line: f is a face. Nice to know, the compiler reserves some memory, for if you later tell him which face. Right now, there is garbage in the memory.
Second line: c0 and c1 are cells. Great, the compiler knows to reserve some memory. You did not yet say which cells they are, so there is still garbage in memory.
Third line: you assign c0. Nice, the compiler has some memory for that. What should be put in memory? The cell next to f. What is f? The compiler has some memory for f, so it looks there. Garbage! You did not say which face f should be! The program can not continue, and gives an error.
Amirreza_pro and CMIUCBS like this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 27, 2021, 03:30
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
And I think the compiler warned about this. You did not see the compiler error.
Amirreza_pro likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 27, 2021, 04:55
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
You understand that the function gives you a cell c, and that you have to give the enthalpy at that cell?
Because you are doing things with f and c0 that I don't understand. What is delT supposed to be? Temperature difference between what?

It's hard to fix a UDF if it's unclear what you are doing...
Amirreza_pro likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 28, 2021, 06:27
Default
  #5
Member
 
Amirreza Niazmehr
Join Date: Nov 2018
Posts: 40
Rep Power: 7
Amirreza_pro is on a distinguished road
Quote:
Originally Posted by pakk View Post
You understand that the function gives you a cell c, and that you have to give the enthalpy at that cell?
Because you are doing things with f and c0 that I don't understand. What is delT supposed to be? Temperature difference between what?

It's hard to fix a UDF if it's unclear what you are doing...
Thanks alot dear pakk.
Sorry for my late answer, I was not available yesterday evening!
First of all, I should say I'm new in using Udf in this way.
Actually I want to compute numerically this integral (it's Enthalpy):
Int.PNG

the numerical method which I'm using to calculate this Integral is: Trapezoidal Rule

I'm going to use the information of adjacent (neighbouring) cells to calculate
this integral.
For exmple double tempb= C_T(c0,t0) is the temperature of the left cell.
or double delT=(temp-tempb); is the Temperature difference between the left and current cell, whith these informations I'm going to calculate the integral formulation for Enthalpy.
Besides I have the function of Cp, because this function is the result of our
descrete data for Cp which be computed by interpolation!
So the only thing which I need is the informoatin of adjacent (neighbouring) cells to calculate the Integral numerically.
If my code to solve this problem is wrong, I would really appreciate if you can correct it! I'm really stuck in it!
Amirreza_pro is offline   Reply With Quote

Old   March 28, 2021, 09:04
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Don't use a UDF. Use Excel.

You have a table with Cp for various temperatures, right? Now use the trapezoidal rule in that table to calculate the integral. Do this for every temperature in your table.

Now you have a second table: temperature vs integral. Put that info in Fluent.

Summary: don't put the trapezoidal rule in Fluent, but put the result of the trapezoidal rule in Fluent.
Amirreza_pro likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   March 29, 2021, 10:35
Default
  #7
Member
 
Amirreza Niazmehr
Join Date: Nov 2018
Posts: 40
Rep Power: 7
Amirreza_pro is on a distinguished road
Quote:
Originally Posted by pakk View Post
Don't use a UDF. Use Excel.

You have a table with Cp for various temperatures, right? Now use the trapezoidal rule in that table to calculate the integral. Do this for every temperature in your table.

Now you have a second table: temperature vs integral. Put that info in Fluent.

Summary: don't put the trapezoidal rule in Fluent, but put the result of the trapezoidal rule in Fluent.
Thanks dear pakk for your nice tips.
I got what you say, but we have instead of a table with Cp for various temperatures and pressures (because in our case it's a function of pressure and temperature) , we have the coefficients of interpolation functions.
That means right now I don't have any discrete data for Cp directly, instead it would be computed somehow indirectly by means of coefficients of interpolation functions).
I try to get also the discrete data of Cp itself to do what you suggested.
Besides the number of informations are too much! It takes too much time to do what you said for each Cp and corresponding Temperature and pressure!
But if I want to use udf of Fluent for this purpose and by the means of the file which I have (coefficients of interpolation functions), then do you have any suggestion?
Again thanks alot for your hints
Amirreza_pro is offline   Reply With Quote

Old   March 29, 2021, 13:47
Default
  #8
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Takes too much time? If you know Excel, and can do it for one T+p, you can do all with only a few more clicks...

But if you really want to use a UDF: your approach makes no sense. Your integral is from T0 to T, not from the temperature of the neighbor cell to the current cell. The neighbor cell is not in the definition, so ignore it!

Let Ttemp go from T0 to the cell temperature, calculate the Cp corresponding to Ttemp and the cell pressure, and use your favorite integration scheme to calculate the integral. You don't have to access other cells or faces.
Amirreza_pro likes this.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MPI Application rank 0 exited before MPI_Finalize() with status 2 in Crystallization JohnE Fluent UDF and Scheme Programming 2 June 21, 2020 17:04
MPI Application rank 0 exited before MPI_Finalize() with status 2 The fl process cou Ryo KIKU Fluent UDF and Scheme Programming 2 January 8, 2020 01:07
MPI Application rank 2 exited before MPI_Finalize() with status 2 The fl process cou Venu Angirekula FLUENT 0 June 7, 2019 04:36
MPI Application rank 0 exited before MPI_Finalize() with status -1073741819 zjuv9021 FLUENT 1 April 29, 2019 01:06
MPI Application rank 0 exited before MPI_Finalize() with status 1 mustafadeniz89 AVL FIRE 6 November 24, 2015 09:40


All times are GMT -4. The time now is 17:25.