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

application help

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By albertofast

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2013, 10:57
Default application help
  #1
New Member
 
edoardo
Join Date: Nov 2010
Posts: 8
Rep Power: 15
albertofast is on a distinguished road
Dear users, I'm using openfoam 2.1 and I need to create a post-processing application to get this filed:

acoSor=rho*fvc::div(fvc::div(U*U))

This field can be used as a source term for a FW-H acoustic solver. I already tried to modify other utilities (for example the one for vorticity) and get it done, but I always get errors.

this is my code actually

Code:
#include "calc.H"
#include "fvc.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
     
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
{
    bool writeResults = !args.optionFound("noWrite");

    IOobject Uheader
    (
        "U",
        runTime.timeName(),
        mesh,
        IOobject::MUST_READ
    );

    if (Uheader.headerOk())
    {
        Info<< "    Reading U" << endl;
        volVectorField U(Uheader, mesh);

        Info<< "    Calculating vorticity" << endl;
        volScalarField acoSor
        (
            IOobject
            (
                "acoSor",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ
            ),
            rho*fvc::div(fvc::div(U*U))
        );
        Info<< "    Calculating acoSor" << endl;

        if (writeResults)
        {
            acoSor.write();
        }
    }
    else
    {
        Info<< "    No U" << endl;
    }

    Info<< "\nEnd\n" << endl;
}
Can you help me please? Thank you very much!
beatlejuice likes this.
albertofast is offline   Reply With Quote

Old   May 15, 2013, 11:33
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Edoardo,

I cannot see that you have defined the rho variable? This for one will give you compilation errors.

Kind regards

Niels
ngj is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
CFD Post Application Error: 'wbload' action requires parameter: 'id'. gusymtz ANSYS 5 October 10, 2022 16:29
Is Playstation 3 cluster suitable for CFD work hsieh OpenFOAM 9 August 16, 2015 14:53
what should we do for the application of CUDA in CFD? aerosjc Main CFD Forum 6 February 25, 2013 11:01
Others library application for OpenFoam 1.5 in Windows lcnmy OpenFOAM Installation 2 July 21, 2010 20:54
Installation of OpenFOAM15dev antonio_ing OpenFOAM Installation 34 December 18, 2009 10:06


All times are GMT -4. The time now is 21:09.