CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   absolute value of strain rate (https://www.cfd-online.com/Forums/openfoam-programming-development/78882-absolute-value-strain-rate.html)

mhassani August 4, 2010 15:00

absolute value of strain rate
 
hi
I am creating a user defined viscosity model in OF1.7; The problem is that I have to use absolute value of the strainRate as an argument for the "sqrt" command. when I use abs for this purpose, an error occurs:

Making dependency list for source file viscosityModels/ExtendedCasson/ExtendedCasson.C
SOURCE=viscosityModels/ExtendedCasson/ExtendedCasson.C ; g++ -m32 -Dlinux -DWM_DP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I.. -I/opt/openfoam170/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam170/src/OpenFOAM/lnInclude -I/opt/openfoam170/src/OSspecific/POSIX/lnInclude -fPIC -c $SOURCE -o Make/linuxGccDPOpt/ExtendedCasson.o
viscosityModels/ExtendedCasson/ExtendedCasson.C: In member function ‘Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> > Foam::viscosityModels::ExtendedCasson::calcNu() const’:
viscosityModels/ExtendedCasson/ExtendedCasson.C:54: error: no matching function for call to ‘abs(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’
/usr/include/stdlib.h:766: note: candidates are: int abs(int)
/usr/include/c++/4.4/cmath:102: note: long double std::abs(long double)
/usr/include/c++/4.4/cmath:98: note: float std::abs(float)
/usr/include/c++/4.4/cmath:94: note: double std::abs(double)
/usr/include/c++/4.4/cstdlib:170: note: long long int __gnu_cxx::abs(long long int)
/usr/include/c++/4.4/cstdlib:139: note: long int std::abs(long int)
viscosityModels/ExtendedCasson/ExtendedCasson.C:54: error: no matching function for call to ‘abs(Foam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >)’
/usr/include/stdlib.h:766: note: candidates are: int abs(int)
/usr/include/c++/4.4/cmath:102: note: long double std::abs(long double)
/usr/include/c++/4.4/cmath:98: note: float std::abs(float)
/usr/include/c++/4.4/cmath:94: note: double std::abs(double)
/usr/include/c++/4.4/cstdlib:170: note: long long int __gnu_cxx::abs(long long int)
/usr/include/c++/4.4/cstdlib:139: note: long int std::abs(long int)
make: *** [Make/linuxGccDPOpt/ExtendedCasson.o] Error 1
******
shall I include any library in the .C file of my viscosity model?

mhassani August 4, 2010 15:09

it seems that there is mag() in OF instead of abs(). problem solved
thanks


All times are GMT -4. The time now is 06:02.