CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

varying rho in twoPhaseEulerFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   July 3, 2012, 04:03
Red face varying rho in twoPhaseEulerFoam
  #1
Member
 
shiv
Join Date: Jun 2012
Location: Lucknow, IN
Posts: 51
Rep Power: 5
shash is on a distinguished road
hi everyone,
i am new to openfoam , was setting up a case using twoPhaseEulerFoam solver in which phase a is water while phase b is gas and i have a salt gradient which leads to change in my rhoa (density of water) so instead of being constant its a scalar field .
solver showing error on compilation.

this is my createfields.H : (highlighted the required text)

Info<< "Reading transportProperties\n" << endl;

IOdictionary transportProperties
(
IOobject
(
"transportProperties",
runTime.constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);

autoPtr<phaseModel> phasea = phaseModel::New
(
mesh,
transportProperties,
"a"
);

autoPtr<phaseModel> phaseb = phaseModel::New
(
mesh,
transportProperties,
"b"
);

volVectorField& Ua = phasea->U();
surfaceScalarField& phia = phasea->phi();
// const dimensionedScalar& rhoa = phasea->rho();
const dimensionedScalar& nua = phasea->nu();

volVectorField& Ub = phaseb->U();
surfaceScalarField& phib = phaseb->phi();
const dimensionedScalar& rhob = phaseb->rho();
const dimensionedScalar& nub = phaseb->nu();

Info<< "Reading field alpha\n" << endl;
volScalarField alpha
(
IOobject
(
"alpha",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

volScalarField beta
(
IOobject
(
"beta",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
scalar(1) - alpha
//,alpha.boundaryField().types()
);

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


//****************************************defining new scalar tranport

Info<< "Reading field s1\n" << endl;
volScalarField s1
(
IOobject
(
"s1",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

const volVectorField& centres1 = mesh.C();
for (int i=0; i<mesh.nCells(); i++)
{
s1.internalField()[i] = 2000*centres1[i][1];
}
s1.write();


Info<< "Reading field s2\n" << endl;
volScalarField s2
(
IOobject
(
"s2",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field rhoa\n" << endl;
volScalarField rhoa
(
IOobject
(
"rhoa",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
((phasea->rho)+(1041* s1))/2
);



// ************************************** end */

volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
alpha*Ua + beta*Ub
);

// ****************************************** shashank -- including diffusivity for scalar transport equation
dimensionedScalar diffu1
(
transportProperties.lookup("diffu1")
);

dimensionedScalar diffu2
(
transportProperties.lookup("diffu2")
);
// ****************************************** end

dimensionedScalar Cvm
(
transportProperties.lookup("Cvm")
);

dimensionedScalar Cl
(
transportProperties.lookup("Cl")
);

dimensionedScalar Ct
(
transportProperties.lookup("Ct")
);

surfaceScalarField phi
(
IOobject
(
"phi",
runTime.timeName(),
mesh
),
fvc::interpolate(alpha)*phia + fvc::interpolate(beta)*phib
);

volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh
),
alpha*rhoa + beta*rhob
);
shash is offline   Reply With Quote

Old   July 9, 2012, 08:33
Default
  #2
Member
 
Artem Shaklein
Join Date: Feb 2010
Location: Russia, Izhevsk
Posts: 43
Rep Power: 7
ARTem is on a distinguished road
Hello, shash.
I haven't found an error message in your post. Could you post it here?
ARTem is offline   Reply With Quote

Reply

Tags
twophaseeulerfoam

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
SLTS+rhoPisoFoam: what is rDeltaT??? nileshjrane OpenFOAM Running, Solving & CFD 4 February 25, 2013 05:13
Low Mach number Compressible jet flow using LES ankgupta8um OpenFOAM Running, Solving & CFD 7 January 15, 2011 14:38
rho euation in rhoPisoFoam nileshjrane OpenFOAM Running, Solving & CFD 4 October 5, 2010 07:44
Error while running rhoPisoFoam.. nileshjrane OpenFOAM Running, Solving & CFD 8 August 26, 2010 12:50
Error log vw.cfd OpenFOAM 6 August 7, 2009 05:44


All times are GMT -4. The time now is 05:46.