CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

Problem in transferring flameletFoam to OpenFOAM 5.x

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 28, 2020, 20:55
Default Problem in transferring flameletFoam to OpenFOAM 5.x
  #1
New Member
 
Anjul Pandey
Join Date: Jul 2020
Posts: 10
Rep Power: 2
anjul is on a distinguished road
Hello everyone,
I wanted to use flameletFOAM solver developed by Hagen Muller in OpenFOAM 5.x. I copied YSLF Model and flamelet reading part from his code and copied it in combustionModels library. I did some changes here and there but now I am stuck. I am getting the following error:

Code:
In file included from YSLFModel/YSLFModel.H:167:0,
                 from YSLFModel/YSLFModels.C:35:
YSLFModel/YSLFModel.C: In instantiation of ‘Foam::combustionModels::YSLFModel<CombThermoType>::YSLFModel(const Foam::word&, const Foam::fvMesh&, const Foam::word&, const Foam::word&) [with CombThermoType = Foam::combustionModels:: psiThermoCombustion]’:
lnInclude/psiCombustionModel.H:79:5:   required from ‘static Foam::autoPtr<Foam::combustionModels:: psiCombustionModel> Foam::combustionModels:: psiCombustionModel::adddictionaryConstructorToTable<psiCombustionModelType>::New(const Foam::word&, const Foam::fvMesh&, const Foam::word&, const Foam::word&) [with psiCombustionModelType = Foam::combustionModels::YSLFModel<Foam::combustionModels:: psiThermoCombustion>]’
lnInclude/psiCombustionModel.H:79:5:   required from ‘Foam::combustionModels:: psiCombustionModel::adddictionaryConstructorToTable<psiCombustionModelType>::adddictionaryConstructorToTable(const Foam::word&) [with psiCombustionModelType = Foam::combustionModels::YSLFModel<Foam::combustionModels:: psiThermoCombustion>]’
YSLFModel/YSLFModels.C:49:1:   required from here
YSLFModel/YSLFModel.C:62:84: error: no matching function for call to ‘Foam::combustionModels:: psiThermoCombustion:: psiThermoCombustion(const Foam::word&, const Foam::fvMesh&)’
     useMixtureFractionVariance_(this->coeffs().lookup("useMixtureFractionVariance"))
                                                                                    ^
In file included from YSLFModel/YSLFModels.C:32:0:
lnInclude/psiThermoCombustion.H:79:9: note: candidate: Foam::combustionModels:: psiThermoCombustion:: psiThermoCombustion(const Foam::word&, const Foam::fvMesh&, const Foam::word&)
         psiThermoCombustion
         ^~~~~~~~~~~~~~~~~~~
lnInclude/psiThermoCombustion.H:79:9: note:   candidate expects 3 arguments, 2 provided
lnInclude/psiThermoCombustion.H:60:9: note: candidate: Foam::combustionModels:: psiThermoCombustion:: psiThermoCombustion(const Foam::combustionModels:: psiThermoCombustion&)
         psiThermoCombustion(const psiThermoCombustion&);
         ^~~~~~~~~~~~~~~~~~~
lnInclude/psiThermoCombustion.H:60:9: note:   candidate expects 1 argument, 2 provided
In file included from YSLFModel/YSLFModel.H:167:0,
                 from YSLFModel/YSLFModels.C:35:
YSLFModel/YSLFModel.C: In instantiation of ‘void Foam::combustionModels::YSLFModel<CombThermoType>::correct() [with CombThermoType = Foam::combustionModels:: psiThermoCombustion]’:
YSLFModel/YSLFModels.C:56:1:   required from here
YSLFModel/YSLFModel.C:104:18: error: binding reference of type ‘Foam::scalarField& {aka Foam::Field<double>&}’ to ‘const Foam::Field<double>’ discards qualifiers
     scalarField& heCells = he_.internalField();
                  ^~~~~~~
YSLFModel/YSLFModel.C:115:21: error: binding reference of type ‘Foam::scalarField& {aka Foam::Field<double>&}’ to ‘const Foam::Field<double>’ discards qualifiers
        scalarField& YCells = Y_[i].internalField();
                     ^~~~~~
YSLFModel/YSLFModel.C:144:31: error: binding reference of type ‘Foam::fvPatchScalarField& {aka Foam::fvPatchField<double>&}’ to ‘const Foam::fvPatchField<double>’ discards qualifiers
           fvPatchScalarField& phe = he_.boundaryField()[patchi];
                               ^~~
YSLFModel/YSLFModel.C:148:32: error: binding reference of type ‘Foam::fvPatchScalarField& {aka Foam::fvPatchField<double>&}’ to ‘const Foam::fvPatchField<double>’ discards qualifiers
            fvPatchScalarField& pY = Y_[i].boundaryField()[patchi];
                                ^~
/home/anjul/OpenFOAM/OpenFOAM-5.x/wmake/rules/General/transform:25: recipe for target 'Make/linux64GccDPInt64Opt/YSLFModel/YSLFModels.o' failed
make: *** [Make/linux64GccDPInt64Opt/YSLFModel/YSLFModels.o] Error 1
I have to do some changes here but right now, my YSLFModel.C looks like this:


Code:
/*---------------------------------------------------------------------------*\
  =========                 |
  \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
   \\    /   O peration     |
    \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
     \\/     M anipulation  |
-------------------------------------------------------------------------------
License

    OpenFOAM is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    for more details.

    You should have received a copy of the GNU General Public License
    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.

Contributors/Copyright
    2014 Hagen Müller <hagen.mueller@unibw.de> Universität der Bundeswehr München
    2014 Likun Ma <L.Ma@tudelft.nl> TU Delft

\*---------------------------------------------------------------------------*/

#include "YSLFModel.H"
#include "reactingMixture.H"
#include "volFields.H"
#include "hashedWordList.H"

namespace Foam
{
namespace combustionModels
{

// * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //

template<class CombThermoType>
YSLFModel<CombThermoType>::YSLFModel
(
    const word& modelType, 
    const fvMesh& mesh, 
    const word& combustionProperties,
    const word& phaseName
)
:
    CombThermoType(modelType, mesh),
    solver_(tableSolver(mesh, tables())),
    Y_(this->thermo().composition().Y()),
    he_(this->thermo().he()),             
    Z_(this->thermo().Z()),
    Zvar_(this->thermo().Zvar()),
    chi_(this->thermo().chi()),
    ubIF_(mesh.cells().size()),
    ubP_(),
    posIF_(mesh.cells().size()),
    posP_(),
    useScalarDissipation_(this->coeffs().lookup("useScalarDissipation")),
    useMixtureFractionVariance_(this->coeffs().lookup("useMixtureFractionVariance"))
{
	const polyBoundaryMesh& patches = mesh.boundaryMesh();
	int patchSize = 0;
    forAll(patches, patchI)
    {
    	const polyPatch& pp = patches[patchI];
    	if (pp.size() > patchSize) patchSize = pp.size();
    }

    ubP_.setSize(patchSize);
    posP_.setSize(patchSize);
}
  /* phaseName_(phaseName)
{}*/
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //

template<class CombThermoType>
YSLFModel<CombThermoType>::~YSLFModel()
{}

// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

template<class CombThermoType>
hashedWordList YSLFModel<CombThermoType>::tables()
{
	hashedWordList tableNames = this->thermo().composition().species();
	tableNames.append("he");

	return tableNames;
}

template<class CombThermoType>
void YSLFModel<CombThermoType>::correct()
{
    // limit the scalar dissipation rate to avoid instabilities at extinction
    scalar chiLimiter = solver_.maxChi();

    const scalarField& ZCells = Z_.internalField();
    const scalarField& ZvarCells = Zvar_.internalField();
    const scalarField& chiCells = chi_.internalField();

    scalarField& heCells = he_.internalField();

    //- Update the species and enthalpy field
    if(this->active())
    {
       scalarList x(3, 0.0);
       double Zeta;

       // Interpolate for internal Field
       forAll(Y_, i)
       {
    	  scalarField& YCells = Y_[i].internalField();

          forAll(ZCells, cellI)
          {
        	 if (i == 0)
        	 {
        		// Zeta = sqrt(ZvarCells[cellI]/max(ZCells[cellI]*(1 - ZCells[cellI]), SMALL));
                 Zeta=ZvarCells[cellI];
                 if (useScalarDissipation_)   x[0] = min(chiCells[cellI], chiLimiter);
                 if (useMixtureFractionVariance_) x[1] = min(Zeta, 0.99);
                 x[2] = ZCells[cellI];

                 ubIF_[cellI] = solver_.upperBounds(x);
                 posIF_[cellI] = solver_.position(ubIF_[cellI], x);

            	 heCells[cellI] = solver_.interpolate(ubIF_[cellI], posIF_[cellI], (solver_.sizeTableNames() - 1));
        	 }

        	 YCells[cellI] = solver_.interpolate(ubIF_[cellI], posIF_[cellI], i);
          }
       }

       // Interpolate for patches
       forAll(he_.boundaryField(), patchi)   
       {
          const fvPatchScalarField& pchi = chi_.boundaryField()[patchi];
          const fvPatchScalarField& pZvar = Zvar_.boundaryField()[patchi];
          const fvPatchScalarField& pZ = Z_.boundaryField()[patchi];

          fvPatchScalarField& phe = he_.boundaryField()[patchi];

          forAll(Y_, i)
          {
        	  fvPatchScalarField& pY = Y_[i].boundaryField()[patchi];

              forAll(pY , facei)
              {
             	 if (i == 0)
             	 {
                     //Zeta = sqrt(pZvar[facei]/max(pZ[facei]*(1 - pZ[facei]), SMALL));
                     Zeta = pZvar[facei];
                     if (useScalarDissipation_) x[0] = min(pchi[facei], chiLimiter);
                     if (useMixtureFractionVariance_) x[1] = min(Zeta, 0.99);
                     x[2] = pZ[facei];

                     ubP_[facei] = solver_.upperBounds(x);
                     posP_[facei] = solver_.position(ubP_[facei], x);

                     phe[facei] = solver_.interpolate(ubP_[facei], posP_[facei], (solver_.sizeTableNames() - 1));
             	 }

            	 pY[facei] = solver_.interpolate(ubP_[facei], posP_[facei], i);
             }
          }
       }

       // Calculate thermodynamic Properties
       this->thermo().correct();
    }
}

template<class CombThermoType>
Switch YSLFModel<CombThermoType>::correctDensity()
{
	return true;
}

template<class CombThermoType>
Foam::tmp<Foam::fvScalarMatrix>
YSLFModel<CombThermoType>::R
(
    volScalarField& Y              
) const
{
    tmp<fvScalarMatrix> tSu(new fvScalarMatrix(Y, dimMass/dimTime));
    return tSu;
}

/*template<class CombThermoType>
Foam::tmp<Foam::volScalarField>
YSLFModel< CombThermoType>::Sh() const
{
    tmp<volScalarField> tSh
    (
        new volScalarField
        (
            IOobject
            (
                "Sh",
                this->mesh().time().timeName(),
                this->mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            ),
            this->mesh(),
            dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0),
            zeroGradientFvPatchScalarField::typeName
        )
    );

    return tSh;
}
*/
template<class CombThermoType>
Foam::tmp<Foam::volScalarField>
YSLFModel< CombThermoType>::Qdot() const
{
    tmp<volScalarField> tQdot
    (
        new volScalarField
        (
            IOobject
            (
                "Qdot",
                this->mesh().time().timeName(),
                this->mesh(),
                IOobject::NO_READ,
                IOobject::NO_WRITE,
                false
            ),
            this->mesh(),
            dimensionedScalar("Qdot", dimEnergy/dimTime, 0.0),
            zeroGradientFvPatchScalarField::typeName
        )
    );

    return tQdot;
}

template<class CombThermoType>
bool YSLFModel<CombThermoType>::read()
{
    if (CombThermoType::read())
    {
        this->coeffs().lookup("useScalarDissipation") >> useScalarDissipation_;
        this->coeffs().lookup("useMixtureFractionVariance") >> useMixtureFractionVariance_;
        return true;
    }
    else
    {
        return false;
    }
}

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

} // End namespace combustionModels
} // End namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
I did required changes in thermophysicalModels library and it compiled correctly. I have very less experience in C++ and OpenFOAM so I might have made some dumb mistakes. Could you guys please point out where I did mistake?

Modified by Tobi: Code-Tags Added...

Last edited by Tobi; January 12, 2021 at 05:57. Reason: I have given a space between :: and p as writing it without space gave an emoji here.
anjul is offline   Reply With Quote

Old   January 12, 2021, 03:31
Default I am facing difficulty in compiling flameletFoam in OpenFOAM 6
  #2
Senior Member
 
KGN
Join Date: Oct 2009
Location: Chennai, India
Posts: 120
Rep Power: 13
mecbe2002 is on a distinguished road
Hi,


I am trying to compile flameletFoam in OpenFOAM 6, but its giving error because of some header files missing?


You are able to convert for OpenFOAM v5?
mecbe2002 is offline   Reply With Quote

Old   January 12, 2021, 05:51
Default
  #3
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Augsburg
Posts: 2,456
Blog Entries: 6
Rep Power: 46
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Well, in different FOAM version the c++ classes (names) changes or vanishes and are replaced by others. Hence, you cannot simply compile libraries and solvers from one version to another (in most cases).

Hence, you have to resolve the errors. I don´t have time to update both, the CRECK flamelet model and the Hagen Flamelet solver. Hence, if you are not able to resovle the errors, you can ask Hagen Müller but I guess he will not work on that stuff anymore and - as it is common - after a project is done, its stuck and no-one works on it.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 12, 2021, 09:14
Default
  #4
New Member
 
Anjul Pandey
Join Date: Jul 2020
Posts: 10
Rep Power: 2
anjul is on a distinguished road
No, I am still working on it and as Tobias said, there are a lot of changes to be done in order to get it working.
anjul is offline   Reply With Quote

Old   January 12, 2021, 09:16
Default
  #5
New Member
 
Anjul Pandey
Join Date: Jul 2020
Posts: 10
Rep Power: 2
anjul is on a distinguished road
Thanks for your response Tobi. I tried contacting Hagen but it seems he is not interested in updating the solver and you gave a valid reason for it. I am currently making the changes. Hope it works.
anjul is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM.com] Problem installation OpenFOAM 6 wamars OpenFOAM Installation 0 June 23, 2020 10:01
OpenFOAM v1912 Green Water Loading Case Implementation Problem leuthar OpenFOAM Running, Solving & CFD 2 March 12, 2020 17:42
[Other] Openfoam for windows 16.02 [CFD support] -problem with paraview ditmeyer OpenFOAM Installation 3 May 15, 2017 13:04
OpenFOAM Training Jan-Jul 2017, Virtual, London, Houston, Berlin CFDFoundation OpenFOAM Announcements from Other Sources 0 January 4, 2017 07:15
[OpenFOAM.org] Problem in installing OpenFOAM 2.3.0 !!! omid20110 OpenFOAM Installation 6 August 1, 2016 12:20


All times are GMT -4. The time now is 19:47.