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

setup new filed in createFileds.H in pisoFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 2, 2013, 11:23
Default setup new filed in createFileds.H file using pisoFoam solver
  #1
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 12
hiuluom is on a distinguished road
Hi all.

I have just used openfoam. I has LES model and it runs good. And now, I would like to calculate some terms in LES as first term1 = nu{p*[d2(ui/xi)]} and second term2 = p*[d((ui uj)/xj)]. After that, get average term1 - average term2.
d2 is second derivative and d is first derivative.
HTML Code:
 volScalarField term1
    (
        IOobject
        (
            "term1",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p*fvc::laplacian(U)
    );
	volVectorField term2
    (
        IOobject
        (
            "term2",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p*fvc::grad(phi,U)
    );
But when I compile it, I met error
HTML Code:
/opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:209:1: note: Foam::GeometricField<Type, PatchField, GeoMesh>::GeometricField(const Foam::IOobject&, const Mesh&, const Foam::dimensionSet&, const Foam::word&) [with Type = double, PatchField = Foam::fvPatchField, GeoMesh = Foam::volMesh, Foam::GeometricField<Type, PatchField, GeoMesh>::Mesh = Foam::fvMesh]
/opt/openfoam211/src/OpenFOAM/lnInclude/GeometricField.C:209:1: note:   candidate expects 4 arguments, 2 provided
/opt/openfoam211/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/opt/openfoam211/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/mypisoFoam.o] Error 1
Could anyone help me fix it?

Thanks.

Last edited by hiuluom; October 3, 2013 at 03:21.
hiuluom is offline   Reply With Quote

Old   October 3, 2013, 03:59
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
For term 1, you write ui/xi. This would be the divergence of u, not the laplacian. The laplacian of a vector is a vector, while you store it as a scalar. Is this line 209, that gives you the error message?
Bernhard is offline   Reply With Quote

Old   October 3, 2013, 09:17
Default
  #3
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 12
hiuluom is on a distinguished road
Sorry, i think I had mistake description filed. The term1 is really second derivative of velocity Ui as [d(ui^2)/d(xj^2)] and other term2 is first derivative of uiuj as [d(uiuj)/dxj)].

I fixed code the term1 is ok but term2 I think It is still error.

HTML Code:
 Info<< "Reading/calculating laplacian of velocity \n" << endl;
    volVectorField plapU
    (
        IOobject
        (
            "plapU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p*fvc::laplacian(U)
    );
    
    Info<< "Reading/calculating divergence of velocity \n" << endl;
	volVectorField pdivU
    (
        IOobject
        (
            "pdivU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
       p*fvc::div(U,U)
    );
I don't know where error.
hiuluom is offline   Reply With Quote

Old   October 3, 2013, 09:32
Default
  #4
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
Which line is giving you the error message? I'd rather not guess.
Bernhard is offline   Reply With Quote

Old   October 3, 2013, 09:35
Default
  #5
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 12
hiuluom is on a distinguished road
Sorry Bernhard, this is error in terminal. I don't know the line caution error. I only see 68:21 caution error.
HTML Code:
Making dependency list for source file mypisoFoam.C
SOURCE=mypisoFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam211/src/transportModels -I/opt/openfoam211/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mypisoFoam.o
In file included from mypisoFoam.C:46:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:68:21: error: no matching function for call to ‘div(Foam::volVectorField&, Foam::volVectorField&)’
createFields.H:68:21: note: candidates are:
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:46:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:64:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:83:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:104:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:127:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:144:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:158:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:176:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:194:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:212:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:231:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:246:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:263:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:280:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/opt/openfoam211/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/mypisoFoam.o] Error 1
Thanks your help.

Best regard,
Thanh

Last edited by hiuluom; October 3, 2013 at 13:23.
hiuluom is offline   Reply With Quote

Old   October 4, 2013, 01:47
Default
  #6
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 12
hiuluom is on a distinguished road
Hi Foamer

I need DU/Dt values for all grids.

How can i calculate and write this parameter.

Any suggestion will be appreciated.

Best regards.
Thanh
hiuluom is offline   Reply With Quote

Old   October 4, 2013, 02:05
Default
  #7
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 21
Bernhard is on a distinguished road
Quote:
Originally Posted by hiuluom View Post
Sorry Bernhard, this is error in terminal. I don't know the line caution error. I only see 68:21 caution error.
HTML Code:
Making dependency list for source file mypisoFoam.C
SOURCE=mypisoFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I/opt/openfoam211/src/turbulenceModels/incompressible/turbulenceModel -I/opt/openfoam211/src/transportModels -I/opt/openfoam211/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/openfoam211/src/finiteVolume/lnInclude -IlnInclude -I. -I/opt/openfoam211/src/OpenFOAM/lnInclude -I/opt/openfoam211/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/mypisoFoam.o
In file included from mypisoFoam.C:46:0:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:68:21: error: no matching function for call to ‘div(Foam::volVectorField&, Foam::volVectorField&)’
createFields.H:68:21: note: candidates are:
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:46:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:64:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:83:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:104:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:127:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:144:1: note: template<class Type> Foam::tmp<Foam::GeometricField<typename Foam::innerProduct<Foam::Vector<double>, Type>::type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:158:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:176:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:194:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:212:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&, const Foam::word&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:231:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:246:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:263:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const surfaceScalarField&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/fvcDiv.C:280:1: note: template<class Type> Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> > Foam::fvc::div(const Foam::tmp<Foam::GeometricField<double, Foam::fvsPatchField, Foam::surfaceMesh> >&, const Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh> >&)
/opt/openfoam211/src/finiteVolume/lnInclude/readPISOControls.H:3:15: warning: unused variable ‘nOuterCorr’ [-Wunused-variable]
/opt/openfoam211/src/finiteVolume/lnInclude/readPISOControls.H:15:16: warning: unused variable ‘transonic’ [-Wunused-variable]
make: *** [Make/linux64GccDPOpt/mypisoFoam.o] Error 1
Thanks your help.

Best regard,
Thanh
So it is in createFields, line 68. It would help a lot if you mention which line this is. The error message almost always give a very good indication of where the error is occuring. This reduces the scope of error searching considerable. For your case, div(U,U) will probably not work, why did you replace div(phi,U) of your first example? Are we now looking at a different error message. See: http://www.cfd-online.com/Forums/ope...-get-help.html
Bernhard is offline   Reply With Quote

Old   October 4, 2013, 03:13
Default
  #8
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 12
hiuluom is on a distinguished road
Thank your reply.
I sorry about my presentation and English. My English only immediate.

Really I would like to find derivative of velocity mention above. The first example I setup derivative is error. So the second example I changed otherwise but it still error.
My example is pitzdaily use LES dynOneEqEddy and pisoFoam solver.

Code:
Info<< "Reading/calculating laplacian of velocity \n" << endl;
    volVectorField plapU
    (
        IOobject
        (
            "plapU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p*(fvc::laplacian(U))
    );
    
   /*Info<< "Reading/calculating divergence of velocity \n" << endl;
	volVectorField pdivU
    (
        IOobject
        (
            "pdivU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p*(U&fvc::grad(U))
    );*/
     Info<< "Reading/calculating divergence of velocity \n" << endl;
	volVectorField pdivU
    (
        IOobject
        (
            "pdivU",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::AUTO_WRITE
        ),
        p*fvc::div(U*U)
    );
These way I compile successful but I don't know it is wrong or true. So could you show me how to get div(U,U)?

Last edited by hiuluom; October 5, 2013 at 12:45.
hiuluom is offline   Reply With Quote

Old   October 5, 2013, 22:19
Default
  #9
Senior Member
 
Huynh Phong Thanh
Join Date: Aug 2013
Location: Ho Chi Minh City
Posts: 105
Rep Power: 12
hiuluom is on a distinguished road
Hi anybody can help me my new field div(u,u) in createField.H.

regards,
Thanh.

Last edited by hiuluom; October 7, 2013 at 23:19.
hiuluom 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
Differences in solution method for pisoFoam and buoyantBoussinesqPisoFoam mchurchf OpenFOAM 7 August 6, 2023 09:12
Taylor Couette Setup and Boundary Conditions DaSh OpenFOAM Pre-Processing 2 September 28, 2017 12:02
[ICEM] Hexa mesh, curve mesh setup, bunching law Anorky ANSYS Meshing & Geometry 4 November 12, 2014 00:27
pisoFoam compiling error with OF 1.7.1 on MAC OSX Greg Givogue OpenFOAM Programming & Development 3 March 4, 2011 17:18
setup vof test problem Fang Jin FLUENT 1 June 14, 2005 08:27


All times are GMT -4. The time now is 10:25.