Upload
anonymous-kbgmtmgolj
View
213
Download
0
Embed Size (px)
DESCRIPTION
Em
Citation preview
External flow correlations © KAPPA 1990 - 2011 Emeraude v2.60 - p 1/5
External flow correlations: developing
your own models for Emeraude.
1. Introduction
In Emeraude, starting with version 2.50, the user is offered the possibility to use, in the
calculation kernel, any flow correlation developed by a third party. Several external
correlations can be connected at the same time and each correlation is plugged to Emeraude
by the means of a dynamic link library (DLL).
The present toolkit is designed to provide the guidelines necessary to develop such a DLL for
a specific correlation. Together with the current document, the installation package contains:
- An executable allowing to test the DLLs (CorrelationTester.exe).
- A sample DLL corresponding to the Hagedorn and Brown correlation
(WellDpCor_HagedornBrown.dll).
- A “Sample” directory, with the source code used to generate WellDpCor_HagedornBrown.dll.
Please note that you must have a valid Emeraude license to be allowed to test your
developments with CorrelationTester.exe.
2. Toolkit
The sample DLL characteristics are:
- Language: C ANSI.
- Compiler: Microsoft Visual Studio 2005©.
Under the Microsoft© environment, the source code will appear as a Visual Studio 2005©
project (file WellDpCor_HagedornBrown.vcproj). This project contains two files:
- WellDpCorAPI.h, which holds the definition of the correlation parameters recognized
by Emeraude.
- WellDpCor_HagedornBrown.c, which holds the exported functions that will be accessed
by Emeraude.
External flow correlations © KAPPA 1990 - 2011 Emeraude v2.60 - p 2/5
3. API
3.1 I/O structures
3.1.a Specific parameters
typedef enum
{
REAL_TYPE,
ENUM_TYPE,
BOOL_TYPE,
} EXTERNAL_PARAMETER_TYPE;
typedef struct
{
char Name [100];
} CName;
struct EXTERNAL_PARAMETER
{
double m_Min;
double m_Max;
PROPERTY m_Property;
double m_Value;
CName* m_EnumChoices;
size_t m_nEnum;
CName m_Name;
EXTERNAL_PARAMETER_TYPE m_Type;
};
Each parameter of the correlation handled by the DLL will be stored in an
EXTERNAL_PARAMETER struct. It must be of one type out of the of the three following ones:
REAL, BOOLEAN or ENUMERATOR.
- For the REAL type, a minimum value, a maximum value and a property must be provided.
- For the BOOLEAN type, the expected value will be 0 for false or 1 for true.
- For the ENUMERATOR type, an array of strings must be filled to specify the available
choices.
The construction of this structure is done in the FillParameters() method described below.
External flow correlations © KAPPA 1990 - 2011 Emeraude v2.60 - p 3/5
3.1.b Correlation Inputs
struct EXTERNAL_INPUTS
{
//Superficial velocities
double m_VsOil; //- superficial oil velocity (m/s)
double m_VsGas; //- superficial gas velocity (m/s)
double m_VsWater; //- superficial water velocity (m/s)
//Pvt dependant variables
double m_P; //- Pressure (Pa)
double m_T; //- Temperature (°C)
double m_RhoOil; //- oil density (kg/m3)
double m_RhoGas; //- gas density (kg/m3)
double m_RhoWater; //- water density (kg/m3)
double m_MuOil; //- oil viscosity (Ns/m2)
double m_MuGas; //- gas viscosity (Ns/m2)
double m_MuWater; //- water viscosity (Ns/m2)
double m_SigGO; //- surface tension Gas/Oil (N/m)
double m_SigOW; //- surface tension Oil/Water (N/m)
double m_SigGW; //- surface tension Gas/Water (N/m)
//2-phase variables used in 2-phase context
//(if GetCorrelationType() return LIQUID_LIQUID or LIQUID_GAS)
double m_VsHeavy; //- superficial heavy fluid velocity (m/s)
double m_VsLight; //- superficial light fluid velocity (m/s)
double m_RhoHeavy; //- heavy fluid density (kg/m3)
double m_RhoLight; //- light fluid density (kg/m3)
double m_MuHeavy; //- heavy fluid viscosity (Ns/m2)
double m_MuLight; //- light fluid viscosity (Ns/m2)
double m_SigHeavyLight; //- surface tension heavy/light (N/m)
//Parameters
//Geometry
double m_DiaPipe; //- Hydrolic Pipe diameter (4. * Area / Perimeter) (m)
double m_Deviation; //- Deviation from vertical
double m_TubingRelativeRoughness; //- Relative Roughness
//What the model should compute
WELLDPCOR_COMPUTE m_Compute;
//Array of specific parameters
struct EXTERNAL_PARAMETER* m_ExternalParameters;
};
Correlation inputs are filled by Emeraude before each call to the WellDpCorrelation()
method. All variables are in S.I. units (except temperature). Some are constant (specific
parameters) and others depend of the context. One should note that for a three phase
correlation, the 2-phase variables will not be filled by Emeraude. The m_Compute variable is
used to specify the kind of output expected (flow pattern, holdup or gradients).
External flow correlations © KAPPA 1990 - 2011 Emeraude v2.60 - p 4/5
3.1.c Correlation outputs
struct EXTERNAL_OUTPUTS
{
WELLDPCOR_FLOWPAT m_FlowpatLG; //- Flow pattern for Liquid-Gas
WELLDPCOR_FLOWPAT m_FlowpatLL; //- Flow pattern for Liquid-Liquid
double m_Yo; //- Holdup Oil
double m_Yw; //- Holdup water
double m_VslipLG; //- slip velocity Liquid / Gas (m/s)
double m_VslipWO; //- slip velocity Oil / Water (m/s)
double m_Fdpdl; //- Friction pressure gradient (Pa/m)
double m_Edpdl; //- Elevation pressure gradient (Pa/m)
double m_Adpdl; //- Acceleration pressure gradient (Pa/m)
double m_Mff; //- Moody friction factor
};
The WellDpCorrelation() method must fill this structure. In 2-phase context, the liquid
holdup can be affected either to oil or water holdup.
3.2 Methods
Some methods are required:
void GetParameterSizes(int* nParam, int* maxNumberOfEnum);
void FillParameters(struct EXTERNAL_PARAMETER* Parameters);
void GetCorrelationName( char* Name, size_t NameSize)
WELLDPCOR_TYPE GetCorrelationType();
void WellDpCorrelation(struct EXTERNAL_INPUTS* Inputs, struct
EXTERNAL_OUTPUTS* Outputs);
GetParameterSizes() and FillParameters() are called by Emeraude to fill the structure that will
allow the user to input the specific parameters used by the correlation. In the file
“WellDpCor_HagedornBrown.c” an example of the implementation of these methods is given.
Other methods are optional:
BOOL GetIsStratified();
void SetClientID(UINT ID);
BOOL GetIsClientAllowed();
void Unload();
BOOL CheckCorrelKey(int* iOwnerIndex);
GetIsStratified() specifies if the correlation handles stratified flow pattern, but it is not used in
the current version of Emeraude.
SetClientID() and GetIsClientAllowed() allow to restrict the usage of this DLL to specific clients.
Unload() is used to optimize the calculation when the DLL developped on the current basis
uses a third party DLL: third party DLL can be unloaded only when the calculation loops have
been completed.
External flow correlations © KAPPA 1990 - 2011 Emeraude v2.60 - p 5/5
CheckCorrelKey() is used to lock the correlation usage on specific Emeraude files: if such a file
TVD survey is modified, the correlation will not be available anymore to the user. The
iOwnerIndex is the DLL developer client index. Please contact KAPPA if you want to activate
this additional security feature for your correlation.
4. CorrelationTester.exe
This small application allows the testing of the external DLLs developed on the basis of the
previously described API.
Once the application has been launched, the path of the directory containing the DLLs has to
be given:
Clicking on the “Correlation list” button, a dialog will popup. It will allow the user to select a
flow model and some mixture properties and to choose the combination of flow correlations to
be considered (Liquid-Liquid, Liquid-Gas or Three phases). Depending on the flow model, only
the relevant flow correlations will be available. Several correlations can be selected for
comparison purposes and the results of each combination will be plotted in the main dialog.
Two default 2-phase correlations (no slippage) are provided to be combined with external ones
(e.g. the DLLs).
The geometrical and the PVT parameters can be changed from their default values, as well as
the mixture velocity, in the main dialog. Please note that the PVT button will access the same
PVT as Emeraude PVT.
To take into account three phase effects, it is possible to input the water ratio in the Liquid-
Gas context (liquid is then a mixture of Oil and Water) or the gas ratio in the Liquid-Liquid
context (gas is added to the flow keeping Vm and Water/Oil ratio constant, the output is then
water holdup over liquid holdup).
Four different outputs can be displayed, depending on the user’s choice:
- The flow patterns maps (Vs heavy vs Vs light),
- The holdups (heavy holdup vs no slip holdup),
- The pressure gradients (vs no slip holdup),
- The integration of the pressure vs depth.