CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   varying rho in twoPhaseEulerFoam (http://www.cfd-online.com/Forums/openfoam-programming-development/104094-varying-rho-twophaseeulerfoam.html)

shash July 3, 2012 04:03

varying rho in twoPhaseEulerFoam
 
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
);

ARTem July 9, 2012 08:33

Hello, shash.
I haven't found an error message in your post. Could you post it here?


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