|
[Sponsors] |
September 5, 2011, 12:36 |
problems with U & U computation
|
#1 |
New Member
David S
Join Date: Nov 2010
Posts: 9
Rep Power: 16 |
Dear Foamers,
I want to compute the L2-norm. It works fine for p as it is a volScalarField but not for U. I also do not know, why the output line starting with Info work fine but doesn't if it is copied outside the line. The current code is: Code:
Udiff = U-Uexact; pLErr = sqrt(magSqr(pdiff)); //is computed ULErr = sqrt(Udiff.internalField() & Udiff.internalField()); //causes trouble Info << "UErr " << sqrt(Udiff.internalField() & Udiff.internalField()) << endl; //is printed into log file Code:
no match for âoperator=â in âULErr = Foam::sqrt(const Foam::tmp<Foam::GeometricField<double, PatchField, GeoMesh> >&) [with PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]()â /home/e322st30/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:1032: note: candidates are: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/e322st30/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:1057: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/e322st30/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:1093: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::dimensioned<Type>&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] David Last edited by ds-gti; September 6, 2011 at 06:47. |
|
September 6, 2011, 05:33 |
|
#2 |
Senior Member
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21 |
Not 100% sure why you are getting the error, try putting "::" in front of the offending "sqrt". However, there is a simpler way to compute the vector magnitude that will definitely work:
ULErr = mag(U-Uexact); |
|
September 6, 2011, 13:13 |
|
#3 |
New Member
David S
Join Date: Nov 2010
Posts: 9
Rep Power: 16 |
Thanks a lot for your reply!
The :: added gives: Code:
T.C:191: error: cannot convert âFoam::tmp<Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> >â to âdoubleâ for argument â1â to âdouble sqrt(double)â make: *** [Make/linux64GccDPOpt/T.o] Error 1 Code:
no match for âoperator=â in âUL2 = Foam::mag(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh]()â /home/e322st30/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:1032: note: candidates are: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::GeometricField<Type, PatchField, GeoMesh>&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/e322st30/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:1057: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::tmp<Foam::GeometricField<Type, PatchField, GeoMesh> >&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] /home/e322st30/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/GeometricField.C:1093: note: void Foam::GeometricField<Type, PatchField, GeoMesh>::operator=(const Foam::dimensioned<Type>&) [with Type = Foam::Vector<double>, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh] make: *** [Make/linux64GccDPOpt/TTest.o] Error 1 |
|
September 7, 2011, 07:12 |
|
#4 |
New Member
David S
Join Date: Nov 2010
Posts: 9
Rep Power: 16 |
ULErr is a volScalarField. Now it works.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[ICEM] Problems with coedge curves and surfaces | tommymoose | ANSYS Meshing & Geometry | 6 | December 1, 2020 12:12 |
problem in the CFX12.1 parallel computation | BalanceChen | ANSYS | 2 | July 7, 2011 11:26 |
Discussion on the computation of the multi-stage axial compressor | BalanceChen | CFX | 5 | January 5, 2011 03:23 |
Floworks computation problems | drejki | FloEFD, FloWorks & FloTHERM | 1 | March 3, 2010 21:49 |
unstructured grid | sreekanth | Main CFD Forum | 1 | August 6, 2001 16:09 |