|
[Sponsors] |
February 16, 2009, 22:03 |
Hello,
I am trying to imple
|
#1 |
New Member
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17 |
Hello,
I am trying to implement a generalised power law model for blood viscosity (Ballyk et al, Biorheology, 31 (5), pp 565-586 (1994). In this model the exponent in the power law is a function of the local strain rate. My implemented calcNu() funciton is: // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // Foam::tmp<foam::volscalarfield> Foam::viscosityModels::GeneralisedPowerLaw::calcNu () const { tmp<volscalarfield> sr(strainRate()); return ((nu0_*exp(-(scalar(1)+(sr())/a_)*exp(-b_/(sr())))+nuInf_)*pow(sr(),(nInf_-n0_*e xp(-(scalar(1)+sr()/c_)*exp(-d_/sr()))-scalar(1)))); } Unfortunately, this fails to compile giving the following error messages: wmake Making dependency list for source file viscosityModels/GeneralisedPowerLaw/GeneralisedPowerLaw.C SOURCE=viscosityModels/GeneralisedPowerLaw/GeneralisedPowerLaw.C ; g++ -m32 -Dlinux -DDP -Wall -Wno-strict-aliasing -Wextra -Wno-unused-parameter -Wold-style-cast -O3 -DNoRepository -ftemplate-depth-40 -I.. -I/home/peter/OpenFOAM/OpenFOAM-1.5/src/finiteVolume/lnInclude -IlnInclude -I. -I/home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude -I/home/peter/OpenFOAM/OpenFOAM-1.5/src/OSspecific/Unix/lnInclude -fPIC -pthread -c $SOURCE -o Make/linuxGccDPOpt/GeneralisedPowerLaw.o /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricScalarField.C: In function 'Foam::tmp<foam::geometricfield<double,> > Foam::pow(const Foam::GeometricField<double,>&, const Foam::tmp<foam::geometricfield<double,> >&) [with PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]': viscosityModels/GeneralisedPowerLaw/GeneralisedPowerLaw.C:61: instantiated from here /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricScalarField.C: 220: error: no matching function for call to 'Foam::dimensioned<double>::dimensioned(const char [2], double, const Foam::dimensionSet&)' /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedType.C:112: note: candidates are: Foam::dimensioned<type>::dimensioned(const Foam::word&, const Foam::dimensionSet&, Foam::Istream&) [with Type = double] /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedType.C:98: note: Foam::dimensioned<type>::dimensioned(const Foam::word&, Foam::Istream&) [with Type = double] /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedType.C:85: note: Foam::dimensioned<type>::dimensioned(Foam::Istream &) [with Type = double] /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedType.H:95: note: Foam::dimensioned<type>::dimensioned(const Type&) [with Type = double] /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedType.C:73: note: Foam::dimensioned<type>::dimensioned(const Foam::word&, const Foam::dimensioned<type>&) [with Type = double] /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedType.C:60: note: Foam::dimensioned<type>::dimensioned(const Foam::word&, const Foam::dimensionSet&, Type) [with Type = double] /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/dimensionedScalarFwd.H: 42: note: Foam::dimensioned<double>::dimensioned(const Foam::dimensioned<double>&) make: *** [Make/linuxGccDPOpt/GeneralisedPowerLaw.o] Error 1 I believe the error is due to the fact that in the function pow(a,b), b must be a scalar. In my model b would be a volScalarField (I think). Is there some way to overcome this problem? Perhaps I have misinterpreted the error messages and there is something else wrong. Any insights would be appreciated. Thanks, Peter. |
|
February 17, 2009, 05:20 |
Should look before I type. You
|
#2 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Should look before I type. You gave a value. But the order is wrong
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
February 18, 2009, 07:14 |
Dear Bernhard,
Thanks for y
|
#3 |
New Member
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17 |
Dear Bernhard,
Thanks for your input. I found the relevant part of Doxygen, but being in the throes of learning C++, I don't really understand it. I changed by code to read: Foam::tmp<foam::volscalarfield> Foam::viscosityModels::GeneralisedPowerLaw::calcNu () const { tmp<volscalarfield> sr(strainRate()); tmp<volscalarfield> c1(nu0_*exp(-(scalar(1)+(sr())/a_)*exp(-b_/(sr())))+nuInf_); tmp<volscalarfield> c2(nInf_-n0_*exp(-(scalar(1)+sr()/c_)*exp(-d_/sr()))-scalar(1)); return(c1()*pow(sr(),c2())); } All the variables nu0_, nuInf_, n0_, a_, b_, c_ and d_ are dimensionedScalars. I still get the same error message on compilation, which I don't understand. At the risk of sounding incredibly thick, I don't know what you mean about the order being wrong. Any insights would be much appreciated. Thanks again, Peter. |
|
February 18, 2009, 12:19 |
Hi Petr!
It says that somew
|
#4 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Hi Petr!
It says that somewhere (the file /home/peter/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricScalarField.C line 220) it tries to construct a dimensioned scalar with the arguments const char [2], double, const Foam::dimensionSet& but amongest the constructors the appropriate one would be (const Foam::word&, const Foam::dimensionSet&, Type) [with Type = double] And now comes the strange thing: that is definitly not your source and the offending line says dimensionedScalar("1", 1.0, gsf2.dimensions()) which is in my opinion the wrong order. Now there are two options: a) I am completly wrong (which is not unheard of) b) you are the first person to instantiate that template and that is the reason why this typo was never found. To verify do the following: switch 1.0 and gf2.dimensions() in that file and try to recompile your stuff. If that makes the error go away then report it as a bug Bernhard
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
February 19, 2009, 01:58 |
Dear Bernhard,
You were cor
|
#5 |
New Member
Peter Johnston
Join Date: Mar 2009
Location: Brisbane, Queensland, Australia
Posts: 25
Rep Power: 17 |
Dear Bernhard,
You were correct. I had to make the switch in three places. But it all works well now (having solved a few other problems along the way). Thank you very much for your help. Regards, Peter. |
|
August 9, 2012, 11:15 |
|
#6 |
New Member
anonymous
Join Date: Jan 2012
Location: Canada
Posts: 24
Rep Power: 14 |
Hi everybody
I am trying to implement a new viscosity model (Ellis mode), which is similar to the crossPowerLaw model. The difference is, Ellis model does not have nuInf and instead of "shear rate" it has "shear stress". For nuInf I can easily drop it from the code but for implementing shear stress I have a little problem. I think for shear stress I have to use: <volTensorField> stressTensor=-mu*(fvc::grad(U)+(fvc::grad(U)).T()); The problem is I do not know how exactly implement these stuff in the code. Also I think because of the mu(=nu*rho), I need to define a loop for shear stress, but I don't know how to do that and where to put it in the code. Could anyone help me with this? any idea? Thanks |
|
July 3, 2015, 04:26 |
dimensioned scalar troubles in viscosity model
|
#7 |
Senior Member
Albrecht vBoetticher
Join Date: Aug 2010
Location: Zürich, Swizerland
Posts: 239
Rep Power: 17 |
Hi all,
I have a stupid question but I can't solve it: I have a modified Herschel Bulkley viscosity law where the only difference is that the user specifies fluid properties like solid concentration and mineralogy. So, instead of reading in tau0_(HerschelBulkleyDebrisFlowCoeffs_.lookup("tau 0")), k_(HerschelBulkleyDebrisFlowCoeffs_.lookup("k")), I would like to calculate tau0_ and k_, but the code then always expects tau0_ and k_ to have no dimensions [ 0 0 0 0 0 0 0 ] and I can't find a way to initialize them with the correct dimensions. If I read them in as dummies and overwrite them with my calculation, it works fine, but there should be a smarter way... |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to modify the viscosity model | mpml | OpenFOAM Running, Solving & CFD | 4 | October 13, 2010 07:44 |
Power Law Viscosity Model | cpplabs | OpenFOAM Running, Solving & CFD | 1 | February 13, 2008 08:09 |
best viscosity turbulent model? | Greg | FLUENT | 2 | October 5, 2007 08:59 |
Which SGS viscosity model is most popular in LES? | leaf | Main CFD Forum | 1 | August 1, 2006 05:04 |
New viscosity model | henry | OpenFOAM Running, Solving & CFD | 2 | July 29, 2005 08:57 |