CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

problems with U & U computation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 5, 2011, 12:36
Default problems with U & U computation
  #1
New Member
 
David S
Join Date: Nov 2010
Posts: 9
Rep Power: 16
ds-gti is on a distinguished road
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
The current error message is the following, which I do not understand exactly.

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]
Thanks for advise!
David

Last edited by ds-gti; September 6, 2011 at 06:47.
ds-gti is offline   Reply With Quote

Old   September 6, 2011, 05:33
Default
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
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);
eugene is offline   Reply With Quote

Old   September 6, 2011, 13:13
Default
  #3
New Member
 
David S
Join Date: Nov 2010
Posts: 9
Rep Power: 16
ds-gti is on a distinguished road
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
and ULErr = mag(U-Uexact); is not working too...
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
What to try next?
ds-gti is offline   Reply With Quote

Old   September 7, 2011, 07:12
Default
  #4
New Member
 
David S
Join Date: Nov 2010
Posts: 9
Rep Power: 16
ds-gti is on a distinguished road
ULErr is a volScalarField. Now it works.
ds-gti is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 01:23.