CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (http://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   nonNewtonian viscosity model (http://www.cfd-online.com/Forums/openfoam-programming-development/78237-nonnewtonian-viscosity-model.html)

mhassani July 15, 2010 16:59

nonNewtonian viscosity model
 
Hi, I want to use a non-Newtonian viscosity model other than those predefined in the source directory; the modification can be done by changing the formulation in CrossPowerLaw.C.
The question here is: Do I need to compile the file after modification?
Do I have to copy it somewhere else (e.g. user directory) make the changes, create a "Make" folder compile it using wmake or something else can be done more straight forward?

mhassani July 15, 2010 17:23

after making the changes, I create a make file in user directory trying to compile it several errors occurred; any idea what the problem can be? the error is:
Making dependency list for source file GenPowerLaw.C
could not open file volFieldsFwd.H for source file GenPowerLaw.C
could not open file surfaceFieldsFwd.H for source file GenPowerLaw.C
could not open file volFields.H for source file GenPowerLaw.C
could not open file surfaceFields.H for source file GenPowerLaw.C
SOURCE=GenPowerLaw.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I/opt/openfoam170/src/transportModels/incompressible/lnInclude -IlnInclude -I. -I/opt/openfoam170/src/OpenFOAM/lnInclude -I/opt/openfoam170/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/GenPowerLaw.o
In file included from GenPowerLaw.H:38,
from GenPowerLaw.C:26:
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:48:26: error: volFieldsFwd.H: No such file or directory
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:49:30: error: surfaceFieldsFwd.H: No such file or directory
In file included from GenPowerLaw.C:26:
GenPowerLaw.H:40:23: error: volFields.H: No such file or directory
GenPowerLaw.C:28:27: error: surfaceFields.H: No such file or directory
In file included from GenPowerLaw.H:38,
from GenPowerLaw.C:26:
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:73: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:73: error: expected ‘;’ before ‘&’ token
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:74: error: ISO C++ forbids declaration of ‘surfaceScalarField’ with no type
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:74: error: expected ‘;’ before ‘&’ token
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:94: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:94: error: expected ‘,’ or ‘...’ before ‘&’ token
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:94: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:94: error: expected ‘,’ or ‘...’ before ‘&’ token
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:116: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:116: error: expected ‘,’ or ‘...’ before ‘&’ token
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:128: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:128: error: expected ‘,’ or ‘...’ before ‘&’ token
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:148: error: ‘volScalarField’ was not declared in this scope
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:148: error: template argument 1 is invalid
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:151: error: ‘volScalarField’ was not declared in this scope
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:151: error: template argument 1 is invalid
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H: In static member function ‘static Foam::autoPtr<Foam::viscosityModel> Foam::viscosityModel::adddictionaryConstructorToTa ble<viscosityModelType>::New(const Foam::word&, const Foam::dictionary&, int)’:
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:94: error: ‘U’ was not declared in this scope
/opt/openfoam170/src/transportModels/incompressible/lnInclude/viscosityModel.H:94: error: ‘phi’ was not declared in this scope
In file included from GenPowerLaw.C:26:
GenPowerLaw.H: At global scope:
GenPowerLaw.H:70: error: ‘volScalarField’ does not name a type
GenPowerLaw.H:75: error: ‘volScalarField’ was not declared in this scope
GenPowerLaw.H:75: error: template argument 1 is invalid
GenPowerLaw.H:91: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
GenPowerLaw.H:91: error: expected ‘,’ or ‘...’ before ‘&’ token
GenPowerLaw.H:105: error: ‘volScalarField’ was not declared in this scope
GenPowerLaw.H:105: error: template argument 1 is invalid
GenPowerLaw.H: In member function ‘virtual int Foam::viscosityModels::GenPowerLaw::nu() const’:
GenPowerLaw.H:107: error: ‘nu_’ was not declared in this scope
GenPowerLaw.H: In member function ‘virtual void Foam::viscosityModels::GenPowerLaw::correct()’:
GenPowerLaw.H:113: error: ‘nu_’ was not declared in this scope
GenPowerLaw.C: At global scope:
GenPowerLaw.C:50: error: ‘volScalarField’ is not a member of ‘Foam’
GenPowerLaw.C:50: error: ‘volScalarField’ is not a member of ‘Foam’
GenPowerLaw.C:50: error: template argument 1 is invalid
GenPowerLaw.C: In member function ‘int Foam::viscosityModels::GenPowerLaw::calcNu() const’:
GenPowerLaw.C:53: error: argument of type ‘int (Foam::viscosityModel::)()const’ does not match ‘int’
GenPowerLaw.C:53: error: ‘nuInf’ was not declared in this scope
GenPowerLaw.C:53: error: ‘deltaNu’ was not declared in this scope
GenPowerLaw.C: At global scope:
GenPowerLaw.C:63: error: ISO C++ forbids declaration of ‘volVectorField’ with no type
GenPowerLaw.C:63: error: expected ‘,’ or ‘...’ before ‘&’ token
GenPowerLaw.C: In constructor ‘Foam::viscosityModels::GenPowerLaw::GenPowerLaw(c onst Foam::word&, const Foam::dictionary&, int)’:
GenPowerLaw.C:67: error: ‘U’ was not declared in this scope
GenPowerLaw.C:67: error: ‘phi’ was not declared in this scope
GenPowerLaw.C:77: error: class ‘Foam::viscosityModels::GenPowerLaw’ does not have any field named ‘nu_’
GenPowerLaw.C:82: error: ‘U_’ was not declared in this scope
make: *** [Make/linuxGccDPOpt/GenPowerLaw.o] Error 1

mhassani July 15, 2010 17:27

the files in Make directory contains:
GenPowerLaw.C

EXE = $(FOAM_LIBBIN)/libViscosityMod
and in options:
EXE_INC = \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude

EXE_LIBS = \
-ltransportModel
the problems are still unsolved!

MartinB July 16, 2010 07:25

Hi Muhammad,

the "options" file must have the line
-I$(LIB_SRC)/finiteVolume/lnInclude \
as well.

My recommendation is: create your own viscosity model in the OpenFOAM's source directory... just make your new "GenPowerLaw" folder next to OpenFOAM's "powerLaw" folder. Edit "/opt/openfoam170/src/transportModels/incompressible/Make/files" by adding the line:
"viscosityModels/GenPowerLaw/GenPowerLaw.C"

Navigate in your shell to
"/opt/openfoam170/src/transportModels/incompressible/"
and call "wclean"
Then navigate to
"/opt/openfoam170/src/transportModels/"
and call "./Allwmake"

Hope it helps

Martin

Ehsan Khalili January 7, 2013 10:10

Dear Martin, I want to create a folder in the viscosity model directory but it fails, I cannot create a folder? may you help me?

MartinB January 7, 2013 10:27

Hi Ehsan,

you need write access to the directory where you want to create the new viscosity model. It is better to use your user directory instead of the OpenFOAM's source directory.

In this post you can find an example how to do it:
http://www.cfd-online.com/Forums/ope...tml#post375899

Martin


All times are GMT -4. The time now is 14:42.