CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   adding Energy eqn to the porousSimpleFoam solver (https://www.cfd-online.com/Forums/openfoam-programming-development/131552-adding-energy-eqn-poroussimplefoam-solver.html)

adambarfi March 17, 2014 09:13

adding Energy eqn to the porousSimpleFoam solver
 
hi everybody,

I'm Trying to add Energy Eqn to the porousSimpleFoam solver and I'm encountering some problems. I want to solve natural convection in a porous zone. I added TEqn and necessary terms to momentum equation, but when I wmake it the below error appeared:

Code:

/home/mostafa/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/fvMatrix.C:1862:34: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator+(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::tmp<Foam::fvMatrix<Type> >&)
/home/mostafa/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/fvMatrix.C:2101:34: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator+(const Foam::fvMatrix<Type>&, const Foam::dimensioned<Type>&)
/home/mostafa/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/fvMatrix.C:2114:34: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator+(const Foam::tmp<Foam::fvMatrix<Type> >&, const Foam::dimensioned<Type>&)
/home/mostafa/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/fvMatrix.C:2127:34: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator+(const Foam::dimensioned<Type>&, const Foam::fvMatrix<Type>&)
/home/mostafa/OpenFOAM/OpenFOAM-2.1.0/src/finiteVolume/lnInclude/fvMatrix.C:2140:34: note: template<class Type> Foam::tmp<Foam::fvMatrix<Type> > Foam::operator+(const Foam::dimensioned<Type>&, const Foam::tmp<Foam::fvMatrix<Type> >&)
make: *** [Make/linux64GccDPOpt/bbpsfMy.o] Error 1

I can't understand where is the problem. anybody knows from where does this error originate?

Best,
Mostafa

adambarfi March 26, 2014 00:56

and finally, after lots of endeavor, I couldn't do that!!!! :(

so I decided to write the code in my way and don't using the porousZone of OF! but I have a big problem:
I don't know how to specify an equation for a region that I defined it in my mesh?!?! how can I tell OF that the zone, for example, named PorousZ have different governing equation with the other zone? or how can I use a source term in my equations that have a coefficient like 'beta':
beta=0 if zone=FluidZ
beta=1 if zone=PorousZ
?

thanks
Mostafa

chrisb2244 March 26, 2014 02:52

Dear Mostafa,

I haven't tried doing this, but my guess is that you might find your second method easier.

If you can write a set of equations which is applied to all of your mesh, with all of the mesh being affected by a source term, which is multiplied by zero for your FluidZ zone, then that should be fairly simple?

Assuming that your zones are constant in time, you can use something like
Code:

volScalarField betaMultiplier
(
        IOobject
        (
                "beta",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE,
                true
        ),
        mesh,
        dimensionedScalar
        (
                "beta",
                dimensionSet(0, 0, 0, 0, 0, 0, 0),
                0.0
        ),
        // Some boundary types here - I guess these might not matter?
);

and then set values using something like

Code:

forAll(mesh.cellCentres(), cellI)
{
    if (some test for zones)
    {
          betaMultiplier.internalField()[cellI] = 1;
    }
    else
    {
          betaMultiplier.internalField()[cellI] = 0;
    }
}

Like I said, I haven't tested this for what you're trying to do, and I don't know anything about cellZones, but I used a similar setup to generate an alpha field in a class I have recently written. (Seemingly the alphaGeneration class works nicely, although I have numerous other (I think unrelated) problems with my solver! :P )

yesaswi92 March 31, 2014 20:14

Hi,

I am also trying to do the same. Did you figure out how to do it??

olivierG April 1, 2014 04:17

Hello,

Why don't you use buoyantSimpleFoam / buoyantBoussinesqSimpleFoam ?
For porosity, just use fvOptions, with explicitPorositySource type.

Regards,
olivier

adambarfi April 1, 2014 04:29

Quote:

Originally Posted by olivierG (Post 483149)
Hello,

Why don't you use buoyantSimpleFoam / buoyantBoussinesqSimpleFoam ?
For porosity, just use fvOptions, with explicitPorositySource type.

Regards,
olivier

Hi Olivier,

AFAIK, fvOptions is just for OF-2.2.x, am I right?
It's a good idea, but I haven't enough information about how fvOptions works!

can you please give me some information?

Thanks a lot for your idea,
Mostafa

olivierG April 1, 2014 04:49

2 Attachment(s)
hello,
fvOption should work for at least OF 2.2 and 2.3
Here is an exemple file for fvOption with porosity, and also with the topoSetDict. Both should be in system.
Just run "topoSet" to create the cellZone before running the solver.

regards,
olivier


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