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

Adding new temperature dependent viscosity model

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By vabishek

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2015, 10:34
Default Adding new temperature dependent viscosity model
  #1
Member
 
VA
Join Date: Mar 2015
Location: ON, Canada
Posts: 30
Rep Power: 11
vabishek is on a distinguished road
Hello FOAMers,

I am trying to add a new viscosity model that is dependent on temperature. I was able to successfully compile the model. It works fine with geometries that have just one domain/region. However, when I try extending it to multi-regions, the model fails. In this case, the viscosity gets updated before the first step (based on my model) but it doesn't get updated after that i.e. during each time-step in the simulation.

I have a fluid region surrounded by four solid regions. I have attached a pdf to illustrate this.

I ran a test problem with just one region and printed the viscosity values at each time-step, and it does get updated correctly. I am struggling to see what needs to be modified in order to get this model working with multi-region geometry.

I have attached the code for the viscosity model.

Thanks!
Attached Files
File Type: c ManningViscosityModel.C (3.6 KB, 99 views)
File Type: h ManningViscosityModel.H (3.4 KB, 55 views)
File Type: pdf Original_geo.pdf (10.3 KB, 82 views)
Prosper likes this.

Last edited by vabishek; May 15, 2015 at 10:36. Reason: Forgot to attach a file
vabishek is offline   Reply With Quote

Old   May 18, 2015, 15:32
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings vabishek,

I hope you don't mind, but I'll quote some of the PM you sent me, since it provides additional information to your problem:
Quote:
Originally Posted by vabishek
I tested my viscosity model with a simple, modified case of the pitzDaily case in the tutorials and the model works fine. The viscosity is updated at every time step based on the temperature distribution. However, when I try using this model with the chtMultiRegionSimpleFoam it does not update the viscosity in the fluid region at every time step. The viscosity is updated at the very beginning before the first time step (when selecting the model) but it does not get updated after that. I am not sure why that's the case. I believe it has to do with the way mesh is defined in the multiregion case?

[...]

Please let know if there is insufficient information. I will provide with further details on my case.
It would make it considerably easier for me or anyone else to help you if you provide a simple test case in which I or anyone else can reproduce the same problem.

I say this because by only looking to the source code, I'm not able to diagnose the problem, since everything looks OK to me.
It's possible that the problem is due to how you configured your test case . That's the only thing that comes to mind... namely that the "mesh()" in your boundary condition is not being used for the region where you need it, because you might have one defined it for the main mesh?

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   May 19, 2015, 10:55
Default
  #3
Member
 
VA
Join Date: Mar 2015
Location: ON, Canada
Posts: 30
Rep Power: 11
vabishek is on a distinguished road
Thanks, Bruno. I was able to resolve the issue. The issue was with the mesh() and region names. I fixed that and my simulation is running just fine. Thanks, again.

Regards,

Abishek
vabishek is offline   Reply With Quote

Old   May 15, 2016, 21:05
Default
  #4
Member
 
Join Date: Oct 2015
Posts: 63
Rep Power: 10
Scram_1 is on a distinguished road
Hey,
I'm trying to create a new viscosity model which calculates the viscosity based on temperature. As a test case, I followed the instructions given in this PDF(Page 12 onwards) (I renamed the model as TempViscosityModel)
http://www.tfd.chalmers.se/~hani/kur...nFoam%20v2.pdf

However, I'm getting an error when I do wmake libso.
This is the error I'm getting

*****@****-PC /opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/viscosityModels/TempViscosityModel
$ wmake libso
Making dependency files...
wmakeLnInclude: linking include files to ./lnInclude
In file included from TempViscosityModel.C:26:0:
TempViscosityModel.H:38:28: fatal error: viscosityModel.H: No such file or directory
#include "viscosityModel.H"
^
compilation terminated.
SOURCE=TempViscosityModel.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/TempViscosityModel.o
In file included from TempViscosityModel.C:26:0:
TempViscosityModel.H:38:28: fatal error: viscosityModel.H: No such file or directory
#include "viscosityModel.H"
^
compilation terminated.
TempViscosityModel.dep:3: recipe for target 'Make/cygwin64mingw-w64DPOpt/TempViscosityModel.o' failed
make: *** [Make/cygwin64mingw-w64DPOpt/TempViscosityModel.o] Error 1

Any suggestions on how to resolve this error?

I also tried compiling using the method given in http://www.cfd-online.com/Forums/ope...bulkley-c.html (See Post #2)
This is what I get when I do ./Allwmake

$ ./Allwmake
+ wmake libso twoPhaseMixture
Making dependency files...
'/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/cygwin64mingw-w64DPOpt/lib/libtwoPhaseMixture.dll' is up to date.
+ wmake libso twoPhaseProperties
Making dependency files...
'/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/cygwin64mingw-w64DPOpt/lib/libtwoPhaseProperties.dll' is up to date.
+ wmake libso interfaceProperties
Making dependency files...
'/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/cygwin64mingw-w64DPOpt/lib/libinterfaceProperties.dll' is up to date.
+ wmake libso incompressible
Making dependency files...
wmakeLnInclude: linking include files to ./lnInclude
SOURCE=viscosityModels/viscosityModel/viscosityModel.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/viscosityModel.o
SOURCE=viscosityModels/viscosityModel/viscosityModelNew.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/viscosityModelNew.o
SOURCE=viscosityModels/Newtonian/Newtonian.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/Newtonian.o
SOURCE=viscosityModels/powerLaw/powerLaw.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/powerLaw.o
SOURCE=viscosityModels/CrossPowerLaw/CrossPowerLaw.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/CrossPowerLaw.o
SOURCE=viscosityModels/BirdCarreau/BirdCarreau.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/BirdCarreau.o
SOURCE=viscosityModels/HerschelBulkley/HerschelBulkley.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/HerschelBulkley.o
SOURCE=viscosityModels/TempViscosityModel/TempViscosityModel.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/TempViscosityModel.o
SOURCE=transportModel/transportModel.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/transportModel.o
SOURCE=singlePhaseTransportModel/singlePhaseTransportModel.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/singlePhaseTransportModel.o
SOURCE=incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C ; x86_64-w64-mingw32-g++ -m64 -Dcygwin64 -DWM_DP -DMSWIN -DLITTLE_ENDIAN -Wall -Wextra -Wno-unused-parameter -Wnon-virtual-dtor -O3 -DNDEBUG -DNoRepository -ftemplate-depth-100 -I.. -I../twoPhaseMixture/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/lnInclude/ -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/MSWindows/lnInclude -c $SOURCE -o Make/cygwin64mingw-w64DPOpt/incompressibleTwoPhaseMixture.o
'/cygdrive/c/OpenFOAM/csriram91-2.3.x/platforms/cygwin64mingw-w64DPOpt/lib/libuserTempViscosityModel.dll' is up to date.
+ wmake libso compressible
Making dependency files...
'/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/cygwin64mingw-w64DPOpt/lib/libcompressibleTransportModels.dll' is up to date.
+ wmake libso immiscibleIncompressibleTwoPhaseMixture
Making dependency files...
'/opt/OpenFOAM/OpenFOAM-2.3.x/platforms/cygwin64mingw-w64DPOpt/lib/libimmiscibleIncompressibleTwoPhaseMixture.dll' is up to date.

But when I try to run the case using nonNewtonianFoam solver, I get this

Create time

--> FOAM Warning :
From function dlOpen(const fileName&, const bool)
in file MSwindows.C at line 1314
\ dlopen error : "Error 126: The specified module could not be found.
"
--> FOAM Warning :
From function dlLibraryTable:pen(const fileName&, const bool)
in file db/dynamicLibrary/dlLibraryTable/dlLibraryTable.C at line 100
could not load "TempViscosityModel.so"
Create mesh, no clear-out for time = 0

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model TempViscosityModel


--> FOAM FATAL ERROR:
Unknown viscosityModel type TempViscosityModel

Valid viscosityModels are :

5
(
BirdCarreau
CrossPowerLaw
HerschelBulkley
Newtonian
powerLaw
)


Regards,
Ram
Scram_1 is offline   Reply With Quote

Reply


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
[openSmoke] libOpenSMOKE Tobi OpenFOAM Community Contributions 562 January 25, 2023 09:21
whats the cause of error? immortality OpenFOAM Running, Solving & CFD 13 March 24, 2021 07:15
Time and temperature dependent viscosity sur4j OpenFOAM 16 January 12, 2015 00:56
Herschel-Bulkley non-Newtonian viscosity model has term with sign error pbryant OpenFOAM Bugs 5 June 18, 2013 23:53
Regarding Implementation of Hershel Bulkley Model in Viscosity correlation Pathak FLOW-3D 0 August 24, 2009 06:34


All times are GMT -4. The time now is 18:55.