CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   User defined bc (https://www.cfd-online.com/Forums/openfoam-solving/58834-user-defined-bc.html)

bhuve June 6, 2008 12:12

HI All, ...urs kind attenti
 
HI All,
...urs kind attention is required, actully my problem is calculation at boundary. so its similar to Anja Stretz's problem .his prob. is..


Here it is:
#include "fvCFD.H"
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/turbulenceModel/turbulenceModel.H"

int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"
# include "initContinuityErrs.H"

Info<< "\nStarting time loop\n" << endl;

// Change bc:

// Get index of patch
label inletPatchID = mesh.boundaryMesh().findPatchID("inlet");
// Get reference to boundary field value
fvPatchVectorField& inletu = U.boundaryField()[inletPatchID];
// get coordinate for cell centres
const fvPatchVectorField& centre = mesh.C().boundaryField()[inletPatchID];

scalarField x = centre.component(vector::X);
scalarField y = centre.component(vector::Y);
scalarField z = centre.component(vector::Z);

scalar n_1 = 0.159159;
scalar n_2 = -0.030791;

dimensionedScalar a
(
"a",
dimensionSet(0, -1, -1, 0, 0, 0, 0),
scalar(0.826871257),
);

dimensionedScalar s
(
"s",
dimensionSet(0, 1, -1, 0, 0, 0, 0),
scalar(4),
);

vector Cp = vector::zero;

dimensionedScalar d
(
"d",
dimensionSet(0, 1, 0, 0, 0, 0, 0),
scalarField(mag(mesh.C() - Cp)),
);

scalarField Ux = sqrt((s-d*d*a)*(s-d*d*a)/(n_1*n_1 + n_2*n_2))* n_1;
scalarField Uy = sqrt((s-d*d*a)*(s-d*d*a)/(n_1*n_1 + n_2*n_2))* n_2;
scalar Uz = 0.0;

inletu = vector(Ux, Uy, Uz);

U.write();

Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n\n" << endl;


Info<< "End\n" << endl;

return(0);
} .......in my case it is preesue , temperatures also ,...its error on inletu=vector(..);..i commented it. but even values are not updating of inletp for pressure ,and inlett for temperature which are scalars...someone tried such problem?..thanks


All times are GMT -4. The time now is 15:03.