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/)
-   -   Convection–diffusion equation solver (https://www.cfd-online.com/Forums/openfoam-solving/82381-convection-diffusion-equation-solver.html)

Daniele111 November 24, 2010 15:24

Convection–diffusion equation solver
 
Hi
I would create my solver for convectio-diffusion equation:

http://upload.wikimedia.org/math/5/4...779b9a954a.pngWhere v field is know. Where should I star to solve this problem? How can I create OpenFoam code? I would use simpleFoam to calculate U field and join simpleFoam solver with my solver to have only one solver to calculate scalar field c.
Thanks



akidess November 25, 2010 04:25

Your problem is pretty much equivalent to this one: http://openfoamwiki.net/index.php/Ho...ure_to_icoFoam. Just instead of adding the equation to icoFoam, do so with simpleFoam.

Daniele111 November 25, 2010 05:40

Thanks
Perfect, but in simpleFoam (or pisoFoam) where I add this line:

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

for my scalar transport properties?

akidess November 25, 2010 08:54

I would add the following code to createFields.H:

Code:

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

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

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

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


Daniele111 November 25, 2010 09:04

Yes I just do it.
Then I would join electrostaticFoam with my_simpleFoam, so I'll modify createFieds.h and my_simpleFoam.c adding electrostaticFoam. It's correct?
But can I impose different boundary condition on the same patch? Example:
symmetryPlane for potential (for electric fields) and
zeroGradient for U (Velocity fields)

Thanks

akidess November 26, 2010 05:21

Yes, of course boundary conditions are separate for every field. Otherwise you'd have a tough time even simulating a lid driven cavity ;)


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