
[Sponsors] 
October 24, 2012, 12:41 
bug in OpenFOAM!!!

#1 
Member
,...
Join Date: Apr 2011
Posts: 92
Rep Power: 5 
Hi FOAMERS
I am trying to simulate flow in anisotropic porous medium. As you might know, I have to define the permeability as a tensor with zero non diagonal elements. The Darcy source term in the momentum equation becomes + ((PermInvTen) & (fvc::Sp(Visc,U))) where PermInvTen is a tensor with diagonal elements of 1/kxx, 1/kyy and 1/ kzz. When I am using fvc (explicit) it compiles successfully. However, using fvm (implicit) gives the following error  BR1IM003.C:84:40: error: no match for ‘operator&’ in ‘PermTen & Foam::fvm::Sp(const Foam::dimensionedScalar&, Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&) [with Type = Foam::Vector<double>, Foam::dimensionedScalar = Foam::dimensioned<double>](((Foam::GeometricField<Foam::Vector<double>, Foam::fvPatchField, Foam::volMesh>&)(& U)))’ /opt/openfoam171/src/OpenFOAM/lnInclude/wordI.H:167:19: note: candidates are: Foam::word Foam:perator&(const Foam::word&, const Foam::word&) /opt/openfoam171/src/OpenFOAM/lnInclude/dimensionSet.H:273:29: note: Foam::dimensionSet Foam:perator&(const Foam::dimensionSet&, const Foam::dimensionSet&) /opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:8:10: warning: unused variable ‘momentumPredictor’ /opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:11:10: warning: unused variable ‘transonic’ /opt/openfoam171/src/finiteVolume/lnInclude/readPISOControls.H:14:9: warning: unused variable ‘nOuterCorr’ make: *** [Make/linux64GccDPOpt/BR1IM003.o] Error 1  Does any one know whether OF can handle the dot product of a tensor and implicitly treated vector or not? Is this a bug in foam? Regards 

October 24, 2012, 14:42 

#2 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,511
Blog Entries: 34
Rep Power: 86 
Greetings Mahdi,
You're still using OpenFOAM 1.7.1... I don't know for certain, but is very likely/possible that said bug has already been fixed in the current version of OpenFOAM 2.1. We (any one in this forum) can test with OpenFOAM 2.1.1 or 2.1.x, if you can provide a small test case or test utility verifying the math operation you want to achieve! Best regards, Bruno
__________________


September 17, 2013, 07:49 

#3 
Member
Anja Miehe
Join Date: Dec 2009
Location: Freiberg / Germany
Posts: 48
Rep Power: 7 
Hello,
the "bug" (I don't know if it is one really or if there is a good reason why it is not coded this way) is still there in 2.1.1 and even 2.2.1. For anyone who would like to contribute / try. As a very basic example without real physical meaning, I took icoFoam, named it to icoTensorFoam, added a volTensorField and an expression to the velocity equation as proposed in at least 2 posts in the forum for anisotropic permeability. Add to createFields.H: Code:
// Permeability volTensorField volTensorField PermInv ( IOobject ( "PermInv", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedTensor("PermInv",dimless/sqr(dimLength), tensor::zero) ); Code:
PermInv=10.0*tensor(1,0,0,0,0,0,0,0,0)+5.0*tensor(0,0,0,1,0,0,1,0,0); fvVectorMatrix UEqn ( fvm::ddt(U) + fvm::div(phi, U)  fvm::laplacian(nu, U) // + (PermInv & fvm::Sp(nu, U)) + (PermInv & fvc::Sp(nu, U)) ); solve(UEqn == fvc::grad(p)); I added a tar.gz with the code as well. Every hint is appreciated, thanks in advance 

September 28, 2013, 09:14 

#4 
Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,511
Blog Entries: 34
Rep Power: 86 
Greetings Anja,
The issue here is that the desired method "Sp()" is not implemented in the name space fvm. For more information about what fvm and fvc are exactly: http://openfoamwiki.net/index.php/Op...%28OpenFOAM%29 As for existing "Sp()" methods for each one, we can look into the Doxygen generated code documentation:
Code:
template<class Type > tmp< fvMatrix< Type > > Sp (const DimensionedField< scalar, volMesh > &, const GeometricField< Type, fvPatchField, volMesh > &) template<class Type > tmp< fvMatrix< Type > > Sp (const tmp< DimensionedField< scalar, volMesh > > &, const GeometricField< Type, fvPatchField, volMesh > &) template<class Type > tmp< fvMatrix< Type > > Sp (const tmp< volScalarField > &, const GeometricField< Type, fvPatchField, volMesh > &) template<class Type > tmp< fvMatrix< Type > > Sp (const dimensionedScalar &, const GeometricField< Type, fvPatchField, volMesh > &) template<class Type > zeroField Sp (const zero &, const GeometricField< Type, fvPatchField, volMesh > &) Code:
template<class Type > tmp< GeometricField< Type, fvPatchField, volMesh > > Sp (const volScalarField &sp, const GeometricField< Type, fvPatchField, volMesh > &vf) template<class Type > tmp< GeometricField< Type, fvPatchField, volMesh > > Sp (const tmp< volScalarField > &tsp, const GeometricField< Type, fvPatchField, volMesh > &vf) template<class Type > tmp< GeometricField< Type, fvPatchField, volMesh > > Sp (const dimensionedScalar &sp, const GeometricField< Type, fvPatchField, volMesh > &vf)
Now let's look at the returning value. fvc only returns geometric patch fields and fvm only returns matrices. Therefore, this should be the origin of the compiling problem. So, let's look at the evidences:
Bruno
__________________


September 30, 2013, 02:27 

#5 
Member
Anja Miehe
Join Date: Dec 2009
Location: Freiberg / Germany
Posts: 48
Rep Power: 7 
Hello Bruno,
thank you very much for your detailed explanation. Unfortunately, my coding skills are not of a level that I could take something "similar as a basis for implementation" here. Code:
& fvm::Sp() Code:
& fvc::Sp() Thanks again, Best regards, Anja 

October 5, 2013, 07:51 

#6 
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,619
Rep Power: 25 
Good day,
As a follow up, considering the resulting matrix under the assumption that fvm::Sp(something,U) would actually work and that the operation Code:
tensor & fvm::Sp() This would create implicit terms for all velocity components in e.g. the momentum equation for the first velocity component. This does not make sense in the context of a segregated approach on the solution of the pressurevelocity coupling, where all other velocity components than the i'th are considered know from the previous time step in the i'th momentum equation. Kind regards Niels
__________________
Please note that I do not use the Friendfeature, so do not be offended, if I do not accept a request. 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Superlinear speedup in OpenFOAM 13  msrinath80  OpenFOAM Running, Solving & CFD  18  March 3, 2015 06:36 
bug in "average" function of OpenFOAM  jms  OpenFOAM  0  March 22, 2011 05:04 
Crosscompiling OpenFOAM 1.6 on Linux for Windows 32 and 64bits with Mingww64  wyldckat  OpenFOAM Announcements from Other Sources  7  January 19, 2010 16:39 
Adventure of fisrst openfoam installation on Ubuntu 710  jussi  OpenFOAM Installation  0  April 24, 2008 14:25 
Cumulative patch for OpenFOAM 141 January 3rd 2007  msrinath80  OpenFOAM Bugs  6  January 4, 2008 11:12 