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/)
-   -   apply relaxation factors for chemical reaction of species in reactingFoam? (https://www.cfd-online.com/Forums/openfoam-programming-development/143190-apply-relaxation-factors-chemical-reaction-species-reactingfoam.html)

atoof October 18, 2014 08:07

apply relaxation factors for chemical reaction of species in reactingFoam?
 
Quote:

Originally Posted by gschaider (Post 418351)
Yes. That is what I was saying with that line.

Just add "libswakChemistryModelFunctionPlugin.so" to the libs-entry in controlDict. Now if you use any swak-thing (function-object or also funkySetFields) that uses the Field-parser for the first time you see an output like this:
Code:

Creating expression field muEff ...
"Loaded plugin functions for 'FieldValueExpressionDriver':"
psiChem_RR:
"volScalarField psiChem_RR(primitive/word speciesName)"
psiChem_RRError:
"volScalarField psiChem_RRError()"
psiChem_RRSumPositive:
"volScalarField psiChem_RRSumPositive()"
psiChem_Sh:
"volScalarField psiChem_Sh()"
psiChem_dQ:
"volScalarField psiChem_dQ()"
psiChem_deltaTChem:
"volScalarField psiChem_deltaTChem()"
psiChem_tc:
"volScalarField psiChem_tc()"
psiChem_updateChemistry:
"volScalarField psiChem_updateChemistry(primitive/scalar timestep)"


Dear Bernhard,

Is it possible to apply relaxation factors for chemical reaction of species in YEqn.H of solver reactingFoam?
I'm working with OF2.1.x now.

Thank you in advance for any hint.

atoof October 18, 2014 08:29

Dears,

Is it possible to apply relaxation factors for chemical reaction of species in YEqn.H of solver reactingFoam?
I'm working with OF2.1.x now.
The things I did:
I've defined a volScalarField in createFields;
Code:

volScalarField sYi
(
    IOobject
    (
        "sYi",
        runTime.timeName(),
        mesh,
        IOobject::NO_READ,
        IOobject::NO_WRITE
    ),
    mesh,
    dimensionSet (1, -3, -1, 0, 0, 0, 0)
);

and in YEqn.H I've added the following
Code:

sYi = combustion->R(Yi);
            sYi.relax();         
            fvScalarMatrix YiEqn
            (
                fvm::ddt(rho, Yi)
              + mvConvection->fvmDiv(phi, Yi)
//              - fvm::laplacian(turbulence->muEff(), Yi)
              - fvm::laplacian(diffCo, Yi)
            ==
//                combustion->R(Yi)
                sYi
            );

but after compiling the following error appears:
Code:

In file included from reactingDymFoamModTrans.C:97:0:
YEqn.H: In function ‘int main(int, char**)’:
YEqn.H:24:35: error: no match for ‘operator=’ in ‘sYi = Foam::combustionModel::R((*(const volScalarField*)Yi))’
YEqn.H:24:35: note: candidates are:
In file included from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.H:583:0,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricScalarField.H:38,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricFields.H:34,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/volFields.H:37,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/surfaceInterpolationScheme.C:30,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/surfaceInterpolationScheme.H:234,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/surfaceInterpolate.H:41,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvc.H:39,
                from /home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/fvCFD.H:8,
                from reactingDymFoamModTrans.C:32:
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1083:6: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1083:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&’
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1108:6: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1108:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >&’
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1144:6: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::dimensioned<Form>&) [with Type = double; PatchField = Foam::fvPatchField; GeoMesh = Foam::volMesh]
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/OpenFOAM/lnInclude/GeometricField.C:1144:6: note:  no known conversion for argument 1 from ‘Foam::tmp<Foam::fvMatrix<double> >’ to ‘const Foam::dimensioned<double>&’
In file included from reactingDymFoamModTrans.C:51:0:
/home/mohammad/OpenFOAM/OpenFOAM-2.1.x/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
make: *** [Make/linuxGccDPOpt/reactingDymFoamModTrans.o] Error 1

How can I remove the error?
Thank you in advance for any hint.

gschaider October 18, 2014 09:14

Quote:

Originally Posted by atoof (Post 514934)
Dear Bernhard,

Is it possible to apply relaxation factors for chemical reaction of species in YEqn.H of solver reactingFoam?
I'm working with OF2.1.x now.

Thank you in advance for any hint.

No. But the Y-Eqn in the standard OF-solvers (reactingFoam for instance) already has relaxation built in

atoof October 18, 2014 09:35

Quote:

Originally Posted by gschaider (Post 514942)
No. But the Y-Eqn in the standard OF-solvers (reactingFoam for instance) already has relaxation built in

Thanks Bernhard,

During running reactinFoam, I noticed that the iterations for one of species reaches to 1001 and has no convergence for that species. Therefore, the heat source value in some cells is calculated so that the temperatures in that cells are below 200 or above 3000K. So I decided to apply a relaxation factor on the chemical source term of all species. I've even run the cases with Courant No. equal to 0.2 and a relation factor equals to 0.5 for Yi with no success for standard reactingfoam.

Any Hint?

Hossein


All times are GMT -4. The time now is 13:10.