|
[Sponsors] |
June 16, 2009, 10:12 |
Adding a new viscosity model
|
#1 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
Hi everyone,
I am trying to add a new viscosity models. 1- a folder in transportModels./incompressible/viscosityModels was created, including .H, .C, and .dep files of new model. 2- updating transportModels//incompressible/lnInclude files. 3- updating transportModels/incompressible/Make files (adding new model) 4- wmake lisbo incompressible and the following is what I receive: transportModels]$ '/home/OpenFOAM/OpenFOAM-1.5/src/transportModels/Allwmake' + wmake libso incompressible Making dependency list for source file viscosityModels/EyringRoelands/EyringRoelands.C SOURCE=viscosityModels/EyringRoelands/EyringRoelands.C ; g++ -m64 -Dlinux64 -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -march=opteron -O3 -DNoRepository -ftemplate-depth-40 -I.. -I/home/ahajisha/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/ahajisha/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/ahajisha/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -c $SOURCE -o Make/linux64GccDPOpt/EyringRoelands.o '/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libincompressibleTransportModels.so' is up to date. + wmake libso interfaceProperties '/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libinterfaceProperties.so' is up to date. Everything seems fine, but when I am trying to solve the problem with simpleFoam (EyringRoelands viscosity model) : Unknown viscosityModel type EyringRoelands Valid viscosityModels are : 5 ( Newtonian CrossPowerLaw BirdCarreau HerschelBulkley powerLaw ) I would appreciate if someone can help me on this.Many thanks; |
|
June 16, 2009, 10:45 |
|
#2 |
New Member
Kian Mehravaran
Join Date: Mar 2009
Location: London, U.K
Posts: 22
Rep Power: 17 |
Have you done: addToRunTimeSelectionTable ?
Kian |
|
June 16, 2009, 10:50 |
|
#3 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
#include EyringRoelamds.H
#include addToRunTimeSelectionTable.H #include surfaceFields.H |
|
June 16, 2009, 13:48 |
|
#4 |
New Member
Luiz Fernando L. R. Silva
Join Date: Mar 2009
Location: Rio de Janeiro, RJ, Brazil
Posts: 10
Rep Power: 17 |
Just including the header will not put the name of your model into the selection table.
If you used one of the previous models codes to build your own, you may have seen the declaration of the following static members: defineTypeNameAndDebug(BirdCarreau, 0); addToRunTimeSelectionTable ( viscosityModel, BirdCarreau, dictionary ); The last argument includes the Bird-Carreau model and make it available. You must adapt and include this constructor to your model code. Have you done it in your code? Hoping that it may help. Best, Luiz F. |
|
June 16, 2009, 13:57 |
|
#5 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
This is the complete code:
#include "EyringRoelands.H" #include "addToRunTimeSelectionTable.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { namespace viscosityModels { // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(EyringRoelands, 0); addToRunTimeSelectionTable ( piezoViscous, EyringRoelands, dictionary ); // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // //- Calculate and return the laminar viscosity tmp<volScalarField> EyringRoelands::calcNu() const { const scalar small_rate = 1e-8; const volScalarField sr = strainRate(); // roelands volScalarField roelands = eta0_ * exp((Foam::log(eta0_.value()) + 9.67) * (-1.0 + pow((1.0+p_/p0_), z_))); label count = 0; volScalarField eyring = roelands; forAll(eyring.internalField(), cellI) { if (sr[cellI] > small_rate) { eyring.internalField()[cellI] = tau0_.value() / sr[cellI] * asinh(roelands[cellI] * sr[cellI] / tau0_.value()); } else { count++; } } if (count > 0 ) { Info << "EyringRoelands > Number of cells with shear-rate less than " << small_rate << " : " << count << endl; } count = 0; forAll(eyring.boundaryField(), bfI) { forAll(eyring.boundaryField()[bfI], faceI) { if (sr.boundaryField()[bfI][faceI] > small_rate) { eyring.boundaryField()[bfI][faceI] = tau0_.value() / sr.boundaryField()[bfI][faceI] * asinh(roelands.boundaryField()[bfI][faceI] * sr.boundaryField()[bfI][faceI] / tau0_.value()); } else { count++; } } } if (count > 0 ) { Info << "EyringRoelands > Number of boundary faces with shear-rate less than " << small_rate << " : " << count << endl; } return eyring * 1.0; } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // from components Foam::viscosityModels::EyringRoelands::EyringRoela nds ( const volVectorField& U, const volScalarField& p, const surfaceScalarField& phi, const word& phaseName ) : piezoViscous(U, p, phi, phaseName), EyringRoelandsCoeffs_ ( phaseTransportProperties_.subDict(typeName + "Coeffs") ), z_(EyringRoelandsCoeffs_.lookup("z")), p0_(EyringRoelandsCoeffs_.lookup("p0")), eta0_(EyringRoelandsCoeffs_.lookup("eta0")), tau0_(EyringRoelandsCoeffs_.lookup("tau0")), nu_ ( IOobject ( "nu" + phaseName, U_.time().timeName(), U_.db(), IOobject::NO_READ, IOobject::AUTO_WRITE ), calcNu() ) {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // bool Foam::viscosityModels::EyringRoelands::read() { if (piezoViscous::read()) { EyringRoelandsCoeffs_ = phaseTransportProperties_.subDict(typeName + "Coeffs"); EyringRoelandsCoeffs_.lookup("z") >> z_; EyringRoelandsCoeffs_.lookup("p0") >> p0_; EyringRoelandsCoeffs_.lookup("eta0") >> eta0_; EyringRoelandsCoeffs_.lookup("tau0") >> tau0_; return true; } else { return false; } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace transportModels } // End namespace Foam // ************************************************** *********************** // |
|
June 16, 2009, 14:21 |
|
#6 |
New Member
Luiz Fernando L. R. Silva
Join Date: Mar 2009
Location: Rio de Janeiro, RJ, Brazil
Posts: 10
Rep Power: 17 |
Check the construction of the selection table.
addToRunTimeSelectionTable ( piezoViscous, ----> it should be viscosityModel... EyringRoelands, dictionary ); Check if it works now. Regards, LF |
|
June 16, 2009, 14:23 |
|
#7 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
I tried that before but it does not.
viscosityModels/EyringRoelands/EyringRoelands.C:48: error: ‘viscosityModel’ has not been declared |
|
June 16, 2009, 14:42 |
|
#8 |
New Member
Luiz Fernando L. R. Silva
Join Date: Mar 2009
Location: Rio de Janeiro, RJ, Brazil
Posts: 10
Rep Power: 17 |
You see, you are right... Changing only this would not be sufficient. I was about to send you another message.
I checked your code and notice that it is different from the other viscosity models. You don't use a viscosityModel but a piezoViscous instead. That is why the compiler complains that the viscosityModel is not declared. You don't use it at all. Using your original code, your model should be in the piezoViscous selection table instead of the viscosityModel. I don't have this piezoViscous files, but you should look for its construction keywords. Is it the same as the viscosityModel? Check this and please return that I am curious . |
|
June 16, 2009, 14:55 |
|
#9 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
piezoviscous is another viscosity model which was included in the same viscosity models directory.
The point is, it was written for OF 1.3. I change bot piezoviscous file and EyringRoelands to cope with OF 1.5 viscosity models but I received errors. Here is piezoviscous.C: #include "piezoViscous.H" #include "volFields.H" #include "fvc.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(piezoViscous, 0); defineRunTimeSelectionTable(piezoViscous, dictionary); //- Lookup and return the phase transport properties dictionary const dictionary& piezoViscous::lookupPhaseTransportProperties ( const dictionary& transportProperties, const word& phaseName ) { if (phaseName.size()) { return transportProperties.subDict(phaseName); } else { return transportProperties; } } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // piezoViscous:iezoViscous ( const volVectorField& U, const volScalarField& p, const surfaceScalarField& phi, const word& phaseName ) : IOdictionary ( IOobject ( "transportProperties", U.time().constant(), U.db(), IOobject::MUST_READ, IOobject::NO_WRITE ) ), U_(U), p_(p), phi_(phi), phaseName_(phaseName), phaseTransportProperties_ ( lookupPhaseTransportProperties(*this, phaseName) ) {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // tmp<volScalarField> piezoViscous::strainRate() const { return mag(fvc::grad(U_)); } bool piezoViscous::read() { if (regIOobject::read()) { phaseTransportProperties_ = lookupPhaseTransportProperties(*this, phaseName_); return true; } else { return false; } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam // ************************************* |
|
June 17, 2009, 11:39 |
|
#10 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
I have changed everything to cope with new version 1.5. Now the only error I get is:
viscosityModels/piezoViscous/piezoViscous.C:49: error: expected constructor, destructor, or type conversion before ‘;’ token make: *** [Make/linux64GccDPOpt/piezoViscous.o] Error 1 I paste line 40 to line 50 here: namespace viscosityModels { defineTypeNameAndDebug(piezoViscous, 0); addToRunTimeSelectionTable ( viscosityModel, piezoViscous, dictionary ); } Any idea? |
|
June 17, 2009, 12:49 |
errors in wmake that: no matching function for call to ‘Foam::GeometricField<Foam::T
|
#11 |
Member
xianghong wu
Join Date: Mar 2009
Posts: 57
Rep Power: 17 |
Hi,
I am doing modification in viscosity model. I modified createFields.H, added createFieldViscoPlastic.H, modified icoFoam.C after wmake, the error is: Making dependency list for source file my_icoFoam_viscoPlastic.C SOURCE=my_icoFoam_viscoPlastic.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/home/xhw/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/xhw/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/xhw/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/my_icoFoam_viscoPlastic.o In file included from my_icoFoam_viscoPlastic.C:44: createFields.H: In function ‘int main(int, char**)’: createFields.H:79: error: no matching function for call to ‘Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject, Foam::tmp<Foam::GeometricField<Foam::SymmTensor<do uble>, Foam::fvPatchField, Foam::volMesh> >)’ /home/xhw/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:611: note: candidates are: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::wordList&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/xhw/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:576: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Foam::GeometricField<Type, PatchField, GeoMesh>&, const Foam::word&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/xhw/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:545: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::word&, const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Tensor<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/xhw/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:512: not...................... So what does it mean in the first few lines? In file included from my_icoFoam_viscoPlastic.C:44: createFields.H: In function ‘int main(int, char**)’: createFields.H:79: error: no matching function for call to ‘Foam::GeometricField<Foam::Tensor<double>, Foam::fvPatchField, Foam::volMesh>::GeometricField(Foam::IOobject, Foam::tmp<Foam::GeometricField<Foam::SymmTensor<do uble>, Foam::fvPatchField, Foam::volMesh> >)’ /home/xhw/OpenFOAM/OpenF Thank you for any help. Wendy |
|
June 17, 2009, 13:51 |
error in running my own solver
|
#12 |
Member
xianghong wu
Join Date: Mar 2009
Posts: 57
Rep Power: 17 |
Hi, I just fixed the error in wmake, and it passed.
I now can run the solver, but it exited with errors as follows: #0 Foam::error:rintStack(Foam::Ostream&) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so" #2 Uninterpreted: [0xb8080400] #3 Foam::divide(Foam::Field<double>&, Foam::UList<double> const&, Foam::UList<double> const&) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so" #4 void Foam::divide<Foam::fvPatchField, Foam::volMesh>(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&) in "/home/xhw/OpenFOAM/xhw-1.5/applications/bin/linuxGccDPOpt/my_icoFoam_viscoPlastic" #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:perator/<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > const&) in "/home/xhw/OpenFOAM/xhw-1.5/applications/bin/linuxGccDPOpt/my_icoFoam_viscoPlastic" #6 main in "/home/xhw/OpenFOAM/xhw-1.5/applications/bin/linuxGccDPOpt/my_icoFoam_viscoPlastic" #7 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6" #8 _start in "/home/xhw/OpenFOAM/xhw-1.5/applications/bin/linuxGccDPOpt/my_icoFoam_viscoPlastic" Floating point exception . I don't understand what it means. Anybody can help me ? Thanks a lot Wendy |
|
June 19, 2009, 13:51 |
|
#13 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
Hi,
I am correcting my question in this post. What I posted before was a code written to take pressure into account for viscosity calculation. The problem is, the new models have not been identified by solvers( simpleFoam) as a viscosityModels. How can I add these models to the list? Maybe, there would be another step to add pressure to the solver code. Any idea? |
|
July 9, 2009, 14:05 |
simpleFoam crashed
|
#14 |
New Member
Ali Sh
Join Date: Jun 2009
Location: London
Posts: 28
Rep Power: 17 |
I finally managed to use new viscosity models with simpleFoam solver.
When I am trying to increase the surface velocity, for values more than 0.2 m/s, I received the following error after number of iteration. time step continuity errors : sum local = 0.000305875, global = -3.95803e-07, cumulative = 3.07225e-05 #0 Foam::error:rintStack(Foam::Ostream&) in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so" #1 Foam::sigFpe::sigFpeHandler(int) in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so" #2 __restore_rt at sigaction.c:0 #3 __kernel_standard at interp.c:0 #4 Foam:ow(Foam::Field<double>&, Foam::UList<double> const&, double const&) in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so" #5 Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam:ow<Foam::fvPatchField, Foam::volMesh>(Foam::tmp<Foam::GeometricField<doub le, Foam::fvPatchField, Foam::volMesh> > const&, Foam::dimensioned<double> const&) in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libincompressibleRASModels.so" #6 Foam::viscosityModels::EyringRoelands::calcNu() const in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libincompressibleTransportModels.so" #7 Foam::viscosityModels::EyringRoelands::correct() in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libincompressibleTransportModels.so" #8 main in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/simpleFoam" #9 __libc_start_main in "/lib64/libc.so.6" #10 Foam::regIOobject::readIfModified() in "/home/ahajisha/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/simpleFoam" Floating point exception I don`t have any possible division by zero in my viscosity code and I am wondering what is the source of this problem. Is there any idea? Thanks, |
|
July 10, 2009, 11:38 |
|
#15 |
Member
xianghong wu
Join Date: Mar 2009
Posts: 57
Rep Power: 17 |
When I run snappyHexMesh, it also stoped with this kind of error, I changed the mesh refinement level, it is solved. I don't know why.
I modified viscosity model based on icoFoam, it is also stoped with this kind of error, I checked and corrected one equation that may have zero on the denominator. it is still not solved. So I am also facing the problem. I hope you will find the answer soon. Wendy |
|
January 8, 2013, 04:19 |
|
#17 |
New Member
Hossein Yahyazadeh
Join Date: Oct 2012
Posts: 9
Rep Power: 14 |
Hi every one,
Could anyone help me how can I make a new viscosity model or modify one of them? I have tried to do that but I cannot save it. Thanx |
|
August 10, 2016, 18:46 |
|
#18 |
Member
Join Date: Oct 2015
Posts: 63
Rep Power: 11 |
Hey,
I've compiled a new viscosity model in OpenFOAM 3.0.1 in Ubuntu but I'm not able to see this new model in the viscosity model selection menu. Can someone help me out here? Thanks!! |
|
September 20, 2016, 11:50 |
|
#19 |
New Member
Join Date: Apr 2016
Posts: 13
Rep Power: 10 |
I'm posting here since this is one of the most recent cries for help over "valid viscosityModels are" error message.
Put the new transport model into the source directory: Code:
/opt/openfoam4/src/transportModels/incompressible/viscosityModels/newModel newModel.c newModel.H addToRunTimeSelectionTable... Then update the make file by appending the newModel to: Code:
/opt/openfoam4/src/transportModels/incompressible/make/files Code:
wmake libso incompressible Code:
libs ( newModel.so ); Use su or sudo bash. Do not forget to source the openfoam toolbox: Code:
. /opt/openfoam4/etc/bashrc |
|
February 26, 2017, 00:28 |
|
#20 |
Member
Emery
Join Date: Feb 2017
Location: France.
Posts: 33
Rep Power: 9 |
Hi foamers,
First of all thank you for your recent replies on this topic. I don't get the last point made by "open", when he said "Do not forget to source the openfoam toolbox: . /opt/openfoam4/etc/bashrc" Can somebody explain it to me please? Thanks in advance and have a good week. Regards. Last edited by TemC; March 3, 2017 at 04:41. |
|
Tags |
openfoam, viscosity |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding a Turbulence Model | doug | OpenFOAM Running, Solving & CFD | 11 | May 21, 2018 14:54 |
Implementing new viscosity model | prjohnston | OpenFOAM Running, Solving & CFD | 6 | July 3, 2015 05:26 |
Yielding viscosity for Herschel Bulkley model | Godwin | FLUENT | 1 | December 12, 2011 06:42 |
Two-Phase Buoyant Flow Issue | Miguel Baritto | CFX | 4 | August 31, 2006 13:02 |
Casson Viscosity model as one user define function | Zahra Rahmdel | FLUENT | 0 | November 6, 2004 06:53 |