bug in OpenFOAM!!!
Hi FOAMERS
I am trying to simulate flow in an-isotropic 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::operator&(const Foam::word&, const Foam::word&) /opt/openfoam171/src/OpenFOAM/lnInclude/dimensionSet.H:273:29: note: Foam::dimensionSet Foam::operator&(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 |
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 |
1 Attachment(s)
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 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); I added a tar.gz with the code as well. Every hint is appreciated, thanks in advance |
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 > &) Code:
template<class Type > tmp< GeometricField< Type, fvPatchField, volMesh > > Sp (const volScalarField &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 |
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 |
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 pressure-velocity 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 |
All times are GMT -4. The time now is 15:34. |