CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Implementing a new viscosity model

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 17, 2016, 09:42
Default Implementing a new viscosity model
  #1
New Member
 
Bentley Lam
Join Date: Apr 2016
Posts: 5
Rep Power: 3
yy205001 is on a distinguished road
Hello,

I am doing a project about pipe flow with non newtonian fluid. Apart from the default viscosity model of OpenFOAM, I want to use Quemada model (not in OpenFOAM). The Quemada file contains: Quemada.C, Quemada.H and Quemada.dep.

So my question is after I move the Quemada file into viscosityModels directory, what will be the next step?

Really appreciated any help!

Bentley.
yy205001 is offline   Reply With Quote

Old   April 18, 2016, 01:38
Default
  #2
Member
 
Akr
Join Date: Apr 2015
Location: India
Posts: 52
Rep Power: 4
NightWing is on a distinguished road
Not really been good at this. But i feel that u should make necessary changes in the files/options folders and then introduce these headers in the .C file and then you have to wmake the solver and see if it complies without any error foremost. you could also search in the forum. I guess the below is smthng relating to adding a new viscosity model

Cheers!


http://www.cfd-online.com/Forums/ope...ity-model.html
NightWing is offline   Reply With Quote

Old   May 1, 2016, 04:38
Default update progress
  #3
New Member
 
Bentley Lam
Join Date: Apr 2016
Posts: 5
Rep Power: 3
yy205001 is on a distinguished road
Hi all,

I am still unable to build the Quemada viscosity model into my library. And I got some errors as following. Any help will be appreciated!

Cheers.

Code:
wmake: 'Make' directory does not exist in /opt/openfoam30/src/transportModels/incompressible/viscosityModels/Quemada
    Searching up directories tree for Make directory
    Found target directory  ./../..
/opt/openfoam30/src/transportModels/incompressible
g++ -m64 -Dlinux64 -DWM_ARCH_OPTION=64 -DWM_DP -DWM_LABEL_SIZE=32 -Wall -Wextra -Wold-style-cast -Wnon-virtual-dtor -Wno-unused-parameter -Wno-invalid-offsetof -O3  -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/openfoam30/src/finiteVolume/lnInclude -I/opt/openfoam30/src/meshTools/lnInclude -IlnInclude -I. -I/opt/openfoam30/src/OpenFOAM/lnInclude -I/opt/openfoam30/src/OSspecific/POSIX/lnInclude   -fPIC -c viscosityModels/Quemada/Quemada.C -o /opt/openfoam30/platforms/linux64GccDPInt32Opt/src/transportModels/incompressible/viscosityModels/Quemada/Quemada.o
In file included from /opt/openfoam30/src/OpenFOAM/lnInclude/token.H:49:0,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/UILListIO.C:28,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/UILList.C:92,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/UILList.H:383,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/ILList.H:39,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/IDLList.H:35,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/entry.H:45,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/dictionary.H:53,
                 from lnInclude/viscosityModel.H:50,
                 from viscosityModels/Quemada/Quemada.H:38,
                 from viscosityModels/Quemada/Quemada.C:26:
lnInclude/viscosityModel.H: In instantiation of ‘static Foam::autoPtr<Foam::viscosityModel> Foam::viscosityModel::adddictionaryConstructorToTable<viscosityModelType>::New(const Foam::word&, const Foam::dictionary&, const volVectorField&, const surfaceScalarField&) [with viscosityModelType = Foam::viscosityModels::Quemada; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’:
lnInclude/viscosityModel.H:96:9:   required from ‘Foam::viscosityModel::adddictionaryConstructorToTable<viscosityModelType>::adddictionaryConstructorToTable(const Foam::word&) [with viscosityModelType = Foam::viscosityModels::Quemada]’
viscosityModels/Quemada/Quemada.C:37:5:   required from here
/opt/openfoam30/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:76:66: error: cannot allocate an object of abstract type ‘Foam::viscosityModels::Quemada’
             return autoPtr< baseType >(new baseType##Type parList);           \
                                                                  ^
lnInclude/viscosityModel.H:96:9: note: in expansion of macro ‘declareRunTimeSelectionTable’
         declareRunTimeSelectionTable
         ^
In file included from viscosityModels/Quemada/Quemada.C:26:0:
viscosityModels/Quemada/Quemada.H:53:7: note:   because the following virtual functions are pure within ‘Foam::viscosityModels::Quemada’:
 class Quemada
       ^
In file included from viscosityModels/Quemada/Quemada.H:38:0,
                 from viscosityModels/Quemada/Quemada.C:26:
lnInclude/viscosityModel.H:155:34: note: 	virtual Foam::tmp<Foam::Field<double> > Foam::viscosityModel::nu(Foam::label) const
         virtual tmp<scalarField> nu(const label patchi) const = 0;
                                  ^
In file included from /opt/openfoam30/src/OpenFOAM/lnInclude/token.H:49:0,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/UILListIO.C:28,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/UILList.C:92,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/UILList.H:383,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/ILList.H:39,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/IDLList.H:35,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/entry.H:45,
                 from /opt/openfoam30/src/OpenFOAM/lnInclude/dictionary.H:53,
                 from lnInclude/viscosityModel.H:50,
                 from viscosityModels/Quemada/Quemada.H:38,
                 from viscosityModels/Quemada/Quemada.C:26:
lnInclude/viscosityModel.H: In static member function ‘static Foam::autoPtr<Foam::viscosityModel> Foam::viscosityModel::adddictionaryConstructorToTable<viscosityModelType>::New(const Foam::word&, const Foam::dictionary&, const volVectorField&, const surfaceScalarField&) [with viscosityModelType = Foam::viscosityModels::Quemada; Foam::volVectorField = Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>; Foam::surfaceScalarField = Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh>]’:
/opt/openfoam30/src/OpenFOAM/lnInclude/runTimeSelectionTables.H:77:9: warning: control reaches end of non-void function [-Wreturn-type]
         }                                                                     \
         ^
lnInclude/viscosityModel.H:96:9: note: in expansion of macro ‘declareRunTimeSelectionTable’
         declareRunTimeSelectionTable
         ^
make: *** [/opt/openfoam30/platforms/linux64GccDPInt32Opt/src/transportModels/incompressible/viscosityModels/Quemada/Quemada.o] Error 1

Last edited by yy205001; May 2, 2016 at 02:12. Reason: Upload files
yy205001 is offline   Reply With Quote

Old   May 2, 2016, 02:27
Default
  #4
Member
 
Join Date: Sep 2014
Location: Germany
Posts: 76
Rep Power: 4
TobM is on a distinguished road
What model did you copy to change into your new model?
TobM is offline   Reply With Quote

Old   May 3, 2016, 13:28
Default
  #5
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: Amherst, MA USA - San Diego, CA USA
Posts: 321
Rep Power: 10
kmooney is on a distinguished road
Can you post your .H file? It looks like you might not have a nu() function defined in your new class which is required as nu is a virtual function in its base class.
kmooney is offline   Reply With Quote

Old   August 10, 2016, 18:17
Default
  #6
Member
 
Ram
Join Date: Oct 2015
Posts: 35
Rep Power: 3
Scram_1 is on a distinguished road
Hello everyone,
I have created a new Viscosity Model in OpenFOAM 3.0.1 based on the link given by Nightwing in post #2. I'm able to compile without any error but I'm not able to see the new model in the Viscosity Model selection table i.e. when I type transportModel bananas in the transportProperties file in the Constant directory, it is showing me the default 5 viscosity models and not the new model that I had just compiled.
Any help is greatly appreciated.
Thanks!!
Scram_1 is offline   Reply With Quote

Old   August 11, 2016, 02:08
Default
  #7
Member
 
Join Date: Sep 2014
Location: Germany
Posts: 76
Rep Power: 4
TobM is on a distinguished road
Have you included the new library in the controlDict file under libs( "yourlibraryhere.so" ); ?
TobM is offline   Reply With Quote

Old   August 11, 2016, 17:14
Default
  #8
Member
 
Ram
Join Date: Oct 2015
Posts: 35
Rep Power: 3
Scram_1 is on a distinguished road
Hey TobM,
Yes I have included it in my controlDict file.
Edit: I just found out why it wasn't showing. Basically, I have a groovy BC inlet condition for my case setup and in groovy BC also you use libs ("libgroovyBC.so" "libsgroovyStandardBCs.so"). So, in my controlDict, I had libs("libusertempModel.so"); libs("libgroovyBC.so" "libsgroovyStandardBCs.so"). When I clubbed both of these together into one libs statement as in libs(" libgroovyBC.so" "libsgroovyStandardBCs.so" "libusertempModel.so"), it started showing the new viscosity model in the selection table. This wasn't the case in OpenFOAM 2.3 x where I could have 2 separate libs statements, one for the groovy BC and one for the viscosity model. In OpenFOAM 3.0.1, however, clubbing the 2 together gives you the desired result.
Scram_1 is offline   Reply With Quote

Old   February 28, 2017, 10:15
Default
  #9
New Member
 
Térence
Join Date: Feb 2017
Location: Bordeaux, France.
Posts: 27
Rep Power: 2
TemC is on a distinguished road
Hi foamers,

I'am working with simpleFoam, and I have implemented a new Herschel-Bulkley viscosity model integrating the Papanastasiou regularization.

- I have created a new folder "RegHerschelBulkley" in "src/transportModels/incompressible/viscosityModels" ;

- I have copied my files "RegHerschelBulkley.C", "REgHerschelBulkley.H" and "REgHerschelBulkley.C.dep" into that new folder ;

- I have modified "src/transportModels/incompressible/Make/files" by adding the new viscosity model ;

- I used the command "wclean" into "src/transportModels/incompressible/" ;

- And when I use the command "./Allwmake" into "src/transportModels/", I got the message in the first attachment (which I must admit, I don't really understand...)

Now when I try to launch a simulation using my new viscosity model, I got the error message in the second attachment.

Can somebody suggest me some adjustments to make? Did I miss something?

Any help would be well appreciated.

I hope that you will find a couple of minutes to give me an answer.

Thanks in advance, and have a nice week.

Regards.
Attached Images
File Type: png Allwmake_Message.PNG (114.3 KB, 4 views)
File Type: png Sim_Error.PNG (125.7 KB, 2 views)
TemC is offline   Reply With Quote

Old   March 1, 2017, 05:19
Default
  #10
MSF
New Member
 
Join Date: Apr 2014
Posts: 10
Rep Power: 5
MSF is on a distinguished road
Hi TemC,

I think your first mistake was not to work in your user-folder but instead in the openFOAM installation. A good guide for modifying transport models can be found here:
http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

Best,

Moritz
MSF is offline   Reply With Quote

Old   March 1, 2017, 07:03
Default
  #11
New Member
 
Térence
Join Date: Feb 2017
Location: Bordeaux, France.
Posts: 27
Rep Power: 2
TemC is on a distinguished road
Good morning Moritz,

Thank you very much for your reply.

Regards.

Last edited by TemC; March 3, 2017 at 04:50.
TemC is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fluid turns into solid at given T (via viscosity UDF or solidifcation model?) jpina FLUENT 1 April 3, 2016 03:48
Viscosity model - error: object is not allocated - C++ beginner avila.vc OpenFOAM Programming & Development 1 March 23, 2016 16:38
Viscosity model in the twoPhaseEulerFoam enoch OpenFOAM Programming & Development 3 March 17, 2016 10:53
Implementing new viscosity model prjohnston OpenFOAM Running, Solving & CFD 6 July 3, 2015 04:26
Viscosity ratio in gamma-theta transition model based on k-w sst turb model Qiaol618 Main CFD Forum 8 June 9, 2012 06:43


All times are GMT -4. The time now is 11:16.