|
[Sponsors] |
February 5, 2019, 11:57 |
Error message
|
#1 |
New Member
Bruno Jorge Macedo dos Santos
Join Date: Feb 2019
Posts: 4
Rep Power: 7 |
Hello everyone.
I am beginner in OpenFOAM 4.1 and I am facing some problems. When I am going to run, OpenFOAM shows me this message: RAS/kEpsilonModelI/kEpsilonModelI.C:42:6: error: redefinition of ‘void Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::correctNut()’ void kEpsilonModelI<BasicTurbulenceModel>::correctNut() ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:42:6: note: ‘virtual void Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::correctNut()’ previously declared here void kEpsilonModelI<BasicTurbulenceModel>::correctNut() ^ RAS/kEpsilonModelI/kEpsilonModelI.C:79:21: error: redefinition of ‘Foam::tmp<Foam::fvMatrix<double> > Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::kSource() const’ tmp<fvScalarMatrix> kEpsilonModelI<BasicTurbulenceModel>::kSource() const ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:79:21: note: ‘virtual Foam::tmp<Foam::fvMatrix<double> > Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::kSource() const’ previously declared here tmp<fvScalarMatrix> kEpsilonModelI<BasicTurbulenceModel>::kSource() const ^ RAS/kEpsilonModelI/kEpsilonModelI.C:94:21: error: redefinition of ‘Foam::tmp<Foam::fvMatrix<double> > Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::epsilonSource() const’ tmp<fvScalarMatrix> kEpsilonModelI<BasicTurbulenceModel>::epsilonSourc e() const ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:94:21: note: ‘virtual Foam::tmp<Foam::fvMatrix<double> > Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::epsilonSource() const’ previously declared here tmp<fvScalarMatrix> kEpsilonModelI<BasicTurbulenceModel>::epsilonSourc e() const ^ RAS/kEpsilonModelI/kEpsilonModelI.C:108:20: error: redefinition of ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::alpha_DCoef()’ tmp<volScalarField>kEpsilonModelI<BasicTurbulenceM odel>::alpha_DCoef() ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:108:20: note: ‘virtual Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::alpha_DCoef()’ previously declared here tmp<volScalarField>kEpsilonModelI<BasicTurbulenceM odel>::alpha_DCoef() ^ RAS/kEpsilonModelI/kEpsilonModelI.C:138:1: error: redefinition of ‘Foam::RASModels::kEpsilonModelI<BasicTurbulenceMo del>::kEpsilonModelI(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&, const Foam::word&)’ kEpsilonModelI<BasicTurbulenceModel>::kEpsilonMode lI ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:138:1: note: ‘Foam::RASModels::kEpsilonModelI<BasicTurbulenceMo del>::kEpsilonModelI(const alphaField&, const rhoField&, const volVectorField&, const surfaceScalarField&, const surfaceScalarField&, const transportModel&, const Foam::word&, const Foam::word&)’ previously declared here kEpsilonModelI<BasicTurbulenceModel>::kEpsilonMode lI ^ RAS/kEpsilonModelI/kEpsilonModelI.C:403:6: error: redefinition of ‘bool Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::read()’ bool kEpsilonModelI<BasicTurbulenceModel>::read() ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:403:6: note: ‘virtual bool Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::read()’ previously declared here bool kEpsilonModelI<BasicTurbulenceModel>::read() ^ RAS/kEpsilonModelI/kEpsilonModelI.C:422:22: error: redefinition of ‘const volScalarField Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::Calculatef3(Foam::volScalarField)’ const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef3( volScalarField G ) ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:422:22: note: ‘const volScalarField Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::Calculatef3(Foam::volScalarField)’ previously declared here const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef3( volScalarField G ) ^ RAS/kEpsilonModelI/kEpsilonModelI.C:435:22: error: redefinition of ‘const volScalarField Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::Calculatef22()’ const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef22 () ^ In file included from RAS/kEpsilonModelI/kEpsilonModelI.H:232:0, from RAS/kEpsilonModelI/kEpsilonModelI.C:26: RAS/kEpsilonModelI/kEpsilonModelI.C:435:22: note: ‘const volScalarField Foam::RASModels::kEpsilonModelI<BasicTurbulenceMod el>::Calculatef22()’ previously declared here const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef22 () ^ I do not see any problem in the kEpsilonModelI.C file. This is the file: #include "kEpsilonModelI.H" #include "fvOptions.H" #include "bound.H" #include "wallDist.H" #include "wallFvPatch.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { namespace RASModels { // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template<class BasicTurbulenceModel> void kEpsilonModelI<BasicTurbulenceModel>::correctNut() { printf("\n nut\n"); const volScalarField& y_(wallDist::New(this->mesh_).y()); const tmp<volScalarField> tnuw = this->nu(); volScalarField &yPlus = Yplus.ref(); yPlus=this->rho_*uTau*y_/tnuw; volScalarField &fmi_ = fmi.ref(); fmi_=1-exp(-0.0002*yPlus-0.0006*pow(yPlus,2)-0.00000025*pow(yPlus,3)); tmp<volScalarField> Ry=y_*sqrt(k_)/(this->nu()); tmp<volScalarField> D=epsilon_*exp(-0.095*(Ry)); this->nut_ = fmi_*Cmu_*sqr(k_)/(max(epsilon_-D,VSMALL*epsilon_)); this->nut_.correctBoundaryConditions(); fv:ptions::New(this->mesh_).correct(this->nut_); const fvPatchList& patches = this->mesh_.boundary(); forAll(patches, patchi) { const fvPatch& patch = patches[patchi]; if (isA<wallFvPatch>(patch)) { scalarField &nutboundary=this->nut_.boundaryFieldRef()[patchi]; nutboundary=0; } } BasicTurbulenceModel::correctNut(); } template<class BasicTurbulenceModel> tmp<fvScalarMatrix> kEpsilonModelI<BasicTurbulenceModel>::kSource() const { return tmp<fvScalarMatrix> ( new fvScalarMatrix ( k_, dimVolume*this->rho_.dimensions()*k_.dimensions() /dimTime ) ); } template<class BasicTurbulenceModel> tmp<fvScalarMatrix> kEpsilonModelI<BasicTurbulenceModel>::epsilonSourc e() const { return tmp<fvScalarMatrix> ( new fvScalarMatrix ( epsilon_, dimVolume*this->rho_.dimensions()*epsilon_.dimensions() /dimTime ) ); } template<class BasicTurbulenceModel> tmp<volScalarField>kEpsilonModelI<BasicTurbulenceM odel>::alpha_DCoef() { //Correct the trace of the tensorial production to be consistent // with the near-wall generation from the wall-functions const volScalarField& y_(wallDist::New(this->mesh_).y()); const tmp<volScalarField> tnuw = this->nu(); volScalarField &yPlus = Yplus.ref(); yPlus=this->rho_*uTau*y_/tnuw; volScalarField &fmi_ = fmi.ref(); fmi_=1-exp(-0.0002*yPlus-0.0006*pow(yPlus,2)-0.00000025*pow(yPlus,3)); tmp<volScalarField> Ry=y_*sqrt(k_)/(this->nu()); tmp<volScalarField> D=epsilon_*exp(-0.095*(Ry)); this->AlphaD= Cmu_*sqr(k_)*fmi_/(epsilon_-D); this->AlphaD.correctBoundaryConditions(); fv:ptions::New(this->mesh_).correct(this->AlphaD); return this->AlphaD; } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class BasicTurbulenceModel> kEpsilonModelI<BasicTurbulenceModel>::kEpsilonMode lI ( const alphaField& alpha, const rhoField& rho, const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, const transportModel& transport, const word& propertiesName, const word& type ) : eddyViscosity<RASModel<BasicTurbulenceModel>> ( type, alpha, rho, U, alphaRhoPhi, phi, transport, propertiesName ), Ceps1_ ( dimensioned<scalar>::lookupOrAddToDict ( "Ceps1", this->coeffDict_, 1.44 ) ), Ceps2_ ( dimensioned<scalar>::lookupOrAddToDict ( "Ceps2", this->coeffDict_, 1.92 ) ), Cmu_ ( dimensioned<scalar>::lookupOrAddToDict ( "Cmu", this->coeffDict_, 0.075 ) ), C1_ ( dimensioned<scalar>::lookupOrAddToDict ( "C1", this->coeffDict_, 1.44 ) ), C2_ ( dimensioned<scalar>::lookupOrAddToDict ( "C2", this->coeffDict_, 1.92 ) ), C3_ ( dimensioned<scalar>::lookupOrAddToDict ( "C3", this->coeffDict_, -0.33 ) ), sigmak_ ( dimensioned<scalar>::lookupOrAddToDict ( "sigmak", this->coeffDict_, 1.3 ) ), sigmaEps_ ( dimensioned<scalar>::lookupOrAddToDict ( "sigmaEps", this->coeffDict_, 1.3 ) ), k_ ( IOobject ( IOobject::groupName("k", U.group()), this->runTime_.timeName(), this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), this->mesh_ ), epsilon_ ( IOobject ( IOobject::groupName("epsilon", U.group()), this->runTime_.timeName(), this->mesh_, IOobject::MUST_READ, IOobject::AUTO_WRITE ), this->mesh_ ) { fmi=tmp<volScalarField> (new volScalarField ( IOobject ( "fmi", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("fmiCoef",dimensionSet(0,0,0,0,0 ,0, 0),0) ) ); Yplus=tmp<volScalarField> (new volScalarField ( IOobject ( "yPlus", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("yPlus",dimensionSet(0,0,0,0,0,0 , 0),0) ) ); Rp=tmp<volScalarField> (new volScalarField ( IOobject ( "Rp", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("Rp",dimensionSet(0,0,0,0,0,0, 0),0) ) ); f3=tmp<volScalarField> (new volScalarField ( IOobject ( "f3", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("f3",dimensionSet(0,0,0,0,0,0, 0),0) ) ); f2=tmp<volScalarField> (new volScalarField ( IOobject ( "f2", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("f2",dimensionSet(0,0,0,0,0,0, 0),0) ) ); E=tmp<volScalarField> (new volScalarField ( IOobject ( "E", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("E",dimensionSet(0,2,-4,0,0,0, 0),0) ) ); De=tmp<volScalarField> (new volScalarField ( IOobject ( "DE", this->runTime_.timeName(), this->mesh_, IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh_, dimensionedScalar("DE",dimensionSet(0,2,-4,0,0,0, 0),0) ) ); IOdictionary transportProperties ( IOobject ( "transportProperties", this->runTime_.constant(), this->mesh_, IOobject::MUST_READ_IF_MODIFIED, IOobject::AUTO_WRITE ) ); Info<< "Reading uTau\n" << endl; uTau.dimensions().reset(dimensionSet(0,1,-1,0,0,0, 0)); uTau=dimensionedScalar ( transportProperties.lookup("uTau") ); Info<< "Read uTau\n" << endl; bound(k_, this->kMin_); bound(epsilon_, this->epsilonMin_); if (type == typeName) { this->printCoeffs(type); } } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class BasicTurbulenceModel> bool kEpsilonModelI<BasicTurbulenceModel>::read() { if (eddyViscosity<RASModel<BasicTurbulenceModel>>::re ad()) { Cmu_.readIfPresent(this->coeffDict()); C1_.readIfPresent(this->coeffDict()); C2_.readIfPresent(this->coeffDict()); C3_.readIfPresent(this->coeffDict()); sigmak_.readIfPresent(this->coeffDict()); sigmaEps_.readIfPresent(this->coeffDict()); return true; } else { return false; } } template<class BasicTurbulenceModel> const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef3( volScalarField G ) { volScalarField &Rp_ref = Rp.ref(); Rp_ref=min((G/(k_*sqrt(epsilon_*Cmu_/this->nu()))),k_/k_); volScalarField &f3_ref = f3.ref(); f3_ref=exp(1.8*pow3(Rp_ref)); return f3_ref; } template<class BasicTurbulenceModel> const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef22 () { const volScalarField& y_(wallDist::New(this->mesh_).y()); tmp<volScalarField> Ry=y_*sqrt(k_)/(this->nu()); tmp<volScalarField> D=epsilon_*exp(-0.095*(Ry)); tmp<volScalarField> PseudoEpsilon = epsilon_-D; return PseudoEpsilon/epsilon_; } template<class BasicTurbulenceModel> const volScalarField kEpsilonModelI<BasicTurbulenceModel>::CalculateE(v olVectorField U) { volVectorField dkdn=fvc::grad(k_); volTensorField dUdn=fvc::grad(U); volScalarField dUdy=dUdn.component(3); volVectorField d2Udn2=fvc::grad(dUdy); volScalarField &E_ref = E.ref(); E_ref=1.2*this->nu()*this->nut()*fvc::magSqrGradGrad(U)+ 0.0075*this->nu()*k_/epsilon_*dkdn.component(1)*dUdn.component(3)*d2Udn 2.component(1); return E_ref; } template<class BasicTurbulenceModel> const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef21 () { tmp<volScalarField> Rt = sqr(k_)/(this->nu()*epsilon_); return 1 - 0.22*exp(-0.3357*sqrt(Rt)); } template<class BasicTurbulenceModel> const volScalarField kEpsilonModelI<BasicTurbulenceModel>::Calculatef2( volScalarField G) { return Calculatef21()*Calculatef22()+Calculatef3(G)-1; } template<class BasicTurbulenceModel> void kEpsilonModelI<BasicTurbulenceModel>::correct() { printf("kepsilon\n"); if (!this->turbulence_) { return; } // Local references // const alphaField& alpha = this->alpha_; // const rhoField& rho = this->rho_; const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; const volVectorField& U = this->U_; // volScalarField& nut = this->nut_; //fv:ptions& fvOptions(fv:ptions::New(this->mesh_)); eddyViscosity<RASModel<BasicTurbulenceModel>>::cor rect(); tmp<volTensorField> tgradU = fvc::grad(this->U_); volScalarField G(this->GName(), this->nut()*(twoSymm(tgradU()) && tgradU())); tgradU.clear(); tgradU.clear(); // Update epsilon and G at the wall epsilon_.boundaryFieldRef().updateCoeffs(); const volScalarField f2_(Calculatef2(G)); volScalarField &f2_ref = f2.ref(); f2_ref=f2_; volScalarField &DE_ref = De.ref(); DE_ref=Ceps2_*f2_*sqr(epsilon_)/k_; printf("inicio eq dissipacao"); // Dissipation equation tmp<fvScalarMatrix> epsEqn ( fvm::ddt(epsilon_) + fvm::div(alphaRhoPhi, epsilon_) - fvm::laplacian(DepsilonEff(), epsilon_) == Ceps1_*G*epsilon_/k_ - fvm::Sp(Ceps2_*f2_*epsilon_/k_, epsilon_) + CalculateE(U) ); printf("\nfim eq epsilon\n"); epsEqn.ref().relax(); epsEqn.ref().boundaryManipulate(epsilon_.boundaryF ieldRef()); solve(epsEqn); bound(epsilon_, this->epsilonMin_); // // Turbulent kinetic energy equation tmp<fvScalarMatrix> kEqn ( fvm::ddt(k_) + fvm::div(alphaRhoPhi, k_) - fvm::laplacian(DkEff(), k_) == G - fvm::Sp(epsilon_/k_, k_) ); kEqn.ref().relax(); solve(kEqn); bound(k_, this->kMin_); correctNut(); } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace RASModels } // End namespace Foam I need some help to understand this problem. Best regards. |
|
February 5, 2019, 12:12 |
|
#2 |
Senior Member
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,762
Rep Power: 66 |
Whatever you are running, you're overwriting a lot of stuff. It's as if you have a custom solver and decided to include the model in the solver or something.
|
|
Tags |
error message, openfoam 4.1 |
|
|