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

Parallel User Defined Real Gas Model

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 7, 2010, 15:11
Default Parallel User Defined Real Gas Model
  #1
New Member
 
Join Date: Jul 2009
Posts: 22
Rep Power: 17
aeroman is on a distinguished road
I am trying to implement the Abel-Nobel equation of state for a problem thus requiring me to write a UDRGM. I took the example for the Ideal Gas Equation of State from the fluent12.0 users Manuel (the version I'm using) and made some changes to it to suit my purposes.

In serial it works great! Problem is I need to run this problem on multiple processors. I've checked out the UDF manual for this but it seems to have left me even more lost than when I started.

Having viewed quite a few posts on this site, I'm not sure if I even need to parallize this at all! However, it works fine in the GUI, and does not work at all when I submit the job for a multi-processor run.

For reference, here is the real gas code from the fluent Manuel. Any help would be greatly appreciated.


/************************************************** ********************/
/* User Defined Real Gas Model : */
/* For Ideal Gas Equation of State */
/* */
/************************************************** ********************/
#include "udf.h"
#include "stdio.h"
#include "ctype.h"
#include "stdarg.h"
#define MW 28.966 /* molec. wt. for single gas (Kg/Kmol) */
#define RGAS (UNIVERSAL_GAS_CONSTANT/MW)
#define TDatum 288.15
#define PDatum 1.01325e5
static int (*usersMessage)(char *,...);
static void (*usersError)(char *,...);

DEFINE_ON_DEMAND(I_do_nothing)
{
/* This is a dummy function to allow us to use */
/* the Compiled UDFs utility */
}

void IDEAL_error(int err, char *f, char *msg)
{
if (err)
usersError("IDEAL_error (%d) from function: %s\n%s\n",err,f,msg);
}
void IDEAL_Setup(Domain *domain, cxboolean vapor_phase, char *filename,
int (*messagefunc)(char *format, ...),
void (*errorfunc)(char *format, ...))
{
/* Use this function for any initialization or model setups*/
usersMessage = messagefunc;
usersError = errorfunc;
usersMessage("\nLoading Real-Ideal Library: %s\n", filename);
}

double IDEAL_density(double Temp, double press, double yi[])
{
double r = press/(RGAS*Temp); /* Density at Temp & press */
return r; /* (Kg/m^3) */
}
double IDEAL_specific_heat(double Temp, double density, double P, double yi[])
{
double cp=1006.43;
return cp; /* (J/Kg/K) */
}
double IDEAL_enthalpy(double Temp, double density, double P, double yi[])
{
double h=Temp*IDEAL_specific_heat(Temp, density, P, yi);
return h; /* (J/Kg) */
}

double IDEAL_entropy(double Temp, double density, double P, double yi[])
{
double s=IDEAL_specific_heat(Temp,density,P,yi)*log(fabs( Temp/TDatum))+
RGAS*log(fabs(PDatum/P));
return s; /* (J/Kg/K) */
}

double IDEAL_mw(double yi[])
{
return MW; /* (Kg/Kmol) */
}
double IDEAL_speed_of_sound(double Temp, double density, double P, double yi[])
{
double cp=IDEAL_specific_heat(Temp,density,P,yi);
return sqrt(Temp*cp*RGAS/(cp-RGAS)); /* m/s */
}
double IDEAL_viscosity(double Temp, double density, double P, double yi[])
{
double mu=1.7894e-05;
return mu; /* (Kg/m/s) */
}
double IDEAL_thermal_conductivity(double Temp, double density, double P,
double yi[])
{
double ktc=0.0242;
return ktc; /* W/m/K */
}
double IDEAL_rho_t(double Temp, double density, double P, double yi[])
{
/* derivative of rho wrt. Temp at constant p */
double rho_t=-density/Temp;
return rho_t; /* (Kg/m^3/K) */
}
double IDEAL_rho_p(double Temp, double density, double P, double yi[])
{
/* derivative of rho wrt. pressure at constant T */
double rho_p=1.0/(RGAS*Temp);
return rho_p; /* (Kg/m^3/Pa) */
}
double IDEAL_enthalpy_t(double Temp, double density, double P, double yi[])
{
/* derivative of enthalpy wrt. Temp at constant p */
return IDEAL_specific_heat(Temp, density, P, yi);
}
double IDEAL_enthalpy_p(double Temp, double density, double P, double yi[])
{
/* derivative of enthalpy wrt. pressure at constant T */
/* general form dh/dp|T = (1/rho)*[ 1 + (T/rho)*drho/dT|p] */
/* but for ideal gas dh/dp = 0 */
return 0.0 ;
}

UDF_EXPORT RGAS_Functions RealGasFunctionList =
{
IDEAL_Setup, /* initialize */
IDEAL_density, /* density */
IDEAL_enthalpy, /* enthalpy */
IDEAL_entropy, /* entropy */
IDEAL_specific_heat, /* specific_heat */
IDEAL_mw, /* molecular_weight */
IDEAL_speed_of_sound, /* speed_of_sound */
IDEAL_viscosity, /* viscosity */
IDEAL_thermal_conductivity, /* thermal_conductivity */
IDEAL_rho_t, /* drho/dT |const p */
IDEAL_rho_p, /* drho/dp |const T */
IDEAL_enthalpy_t, /* dh/dT |const p */
IDEAL_enthalpy_p /* dh/dp |const T */
};
/************************************************** ************/
aeroman is offline   Reply With Quote

Old   October 19, 2010, 23:41
Default Figured it out
  #2
New Member
 
Join Date: Jul 2009
Posts: 22
Rep Power: 17
aeroman is on a distinguished road
All,

This was simply a case of my not having my submit script save the .c file to the working folder. it was not necessary for this to be altered. Thought I'd post to this in case someone else was having a similar problem.
aeroman is offline   Reply With Quote

Old   October 20, 2010, 07:09
Default
  #3
New Member
 
sreenivasa rao gubba
Join Date: Sep 2010
Location: Leeds University, UK
Posts: 28
Rep Power: 16
sreerao is on a distinguished road
Hi Aeroman,

We had similar problems in parallel as well. We found a way for this by compiling the udf after reading the case and data files in your batch mode. You can use a journal file to define these commands and before starting calculations.

Hope this work with you as well.

Sree
sreerao is offline   Reply With Quote

Old   October 21, 2010, 16:04
Default Thanks for the reply
  #4
New Member
 
Join Date: Jul 2009
Posts: 22
Rep Power: 17
aeroman is on a distinguished road
Hey Sree,

Yes, I didn't mention that part but I also used the journal file to compile and impliment it.

Thanks again for the reply.
aeroman is offline   Reply With Quote

Old   July 1, 2015, 07:09
Default
  #5
New Member
 
faegheh
Join Date: Jun 2015
Posts: 8
Rep Power: 11
fafa_blues is on a distinguished road
Quote:
Originally Posted by aeroman View Post
Hey Sree,

Yes, I didn't mention that part but I also used the journal file to compile and impliment it.

Thanks again for the reply.
hi
i have a question about running my UDRGM i appreciate for helping me
i compile and load my code successfully in parallel (8 processors) version of fluent 6.3

Loading Real-EQUILIBRIUM_GAS Library:
Setting material "air" to a real-gas...
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:
Loading Real-EQUILIBRIUM_GAS Library:

but when i want to use it (start iteretion) some error apears :

unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
unable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
999999 (..\..\src\mpsystem.c@1123): mpt_read: failed: errno = 10054
999999: mpt_read: error: read failed trying to read 4 bytesunable to read the cmd header on the pmi context, generic socket failure, error stack:
MPIDU_Sock_wait(2533): The specified network name is no longer available. (errno 64).
: No such file or directory
received suspend command for a pmi context that doesn't exist: unmatched id = 7
received suspend command for a pmi context that doesn't exist: unmatched id = 6
received suspend command for a pmi context that doesn't exist: unmatched id = 5
received suspend command for a pmi context that doesn't exist: unmatched id = 3
job aborted:
rank: node: exit code[: error message]
0: msc9.aero.edu: -1073741819: process 0 exited without calling finalize
1: msc9.aero.edu: -1073741819: process 1 exited without calling finalize
2: msc9.aero.edu: -1073741819: process 2 exited without calling finalize
3: msc9.aero.edu: -1073741819: process 3 exited without calling finalize
4: msc9.aero.edu: -1073741819: process 4 exited without calling finalize
5: msc9.aero.edu: -1073741819: process 5 exited without calling finalize
6: msc9.aero.edu: -1073741819: process 6 exited without calling finalize
7: msc9.aero.edu: -1073741819: process 7 exited without calling finalize
received suspend command for a pmi context that doesn't exist: unmatched id = 2
received suspend command for a pmi context that doesn't exist: unmatched id = 1
received suspend command for a pmi context that doesn't exist: unmatched id = 0
The Parallel FLUENT process could not be started.

I don't know that is wrong, could you please help
fafa_blues 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
User fortran error when running CFX-10 in parallel CFDworker CFX 3 September 22, 2015 09:59
Gradient of a User defined Variable Ramadas CFX 2 August 21, 2007 10:19
Real Gas Mixture With Reactions Jake Cannon Main CFD Forum 0 January 16, 2007 12:46
User Defined Scalars - Returning Values Carlos V. FLUENT 0 April 19, 2006 19:18
CFX 5.5 Roued CFX 1 October 2, 2001 17:49


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