CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Modified scalarTransportFoam, but result is not right , need help (https://www.cfd-online.com/Forums/openfoam/70676-modified-scalartransportfoam-but-result-not-right-need-help.html)

panda60 December 2, 2009 06:27

Modified scalarTransportFoam, but result is not right , need help
 
Dear all:
I want to simulate the gas difussion in the air. First I get the velocity "U" and turbulent viscosity "nut" using simpleFoam. Then I modified the scalarTransportFoam to solve a concentration equation. But the result is not right compared with my experiment data.
I need help. I don't know where I have mistakes. Thank you very much.
The following is my modified solver:

createFields.H

Info<< "Reading field C\n" << endl;

volScalarField C
(
IOobject
(
"C",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);

Info<< "Reading field nut\n" << endl;

volScalarField nut
(
IOobject
(
"nut",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


Info<< "Reading field U\n" << endl;

volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);


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

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


Info<< "Reading kinemetic vicosity nu\n" << endl;

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


# include "createPhi.H"


*.cpp

#include "fvCFD.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

int main(int argc, char *argv[])
{

# include "setRootCase.H"

# include "createTime.H"
# include "createMesh.H"
# include "createFields.H"


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Info<< "\nCalculating scalar transport\n" << endl;

# include "CourantNo.H"

volScalarField kappaEff
(
"kappaEff",
nu/0.5 + nut/0.5
);


while (runTime.loop())
{
Info<< "Time = " << runTime.timeName() << nl << endl;

# include "readSIMPLEControls.H"

for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
solve
(
fvm::ddt(C)
+ fvm::div(phi, C)
- fvm::laplacian(kappaEff,C)
);
}

runTime.write();
}

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

return 0;
}


Who can tell me where is my mistake.

panda60 December 2, 2009 06:34

When some time has going on , my residual didn't change at all, and the result is not wright, so I think my solver has proboem.

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.1567

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.15675

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.1568

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.15685

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.1569

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.15695

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.157

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.15705

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.1571

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.15715

DILUPBiCG: Solving for C, Initial residual = 9.99842e-07, Final residual = 9.99842e-07, No Iterations 0
Time = 0.1572

......................
......................

panda60 December 2, 2009 19:50

my diffusion coefficient changes with turbulent viscosity, so kappaEff=
nu/0.5 + nut/0.5


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