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

Code To Compute Nusselt # on wall

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 4, 2010, 03:33
Default Code To Compute Nusselt # on wall
  #1
Senior Member
 
n/a
Join Date: Sep 2009
Posts: 199
Rep Power: 17
deji is on a distinguished road
Hey there Foamers. I am writing a post-processor to compute the mean Nusselt number on a wall in a turbulent flow (LES). I am getting the following error:

wallHeatRates.C: In function ‘int main(int, char**)’:
wallHeatRates.C:99: error: ‘obr_’ was not declared in this scope
wallHeatRates.C:99: error: expected primary-expression before ‘>’ token
make: *** [Make/linuxGccDPOpt/wallHeatRates.o] Error 1

Here is my code wallHeatRates.C

Code:
#include "fvCFD.H" //adds file prior to compiling source
#include "makeGraph.H"
#include <cmath>
#include "LESModel.H"
#include "wallHeatRates.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

namespace Foam
{
   defineTypeNameAndDebug(wallHeatRates,0);
// addNamedToRunTimeSelectionTable(wallHeatRates);
}

//**************Constructor definition*********//

Foam::wallHeatRates::wallHeatRates
(
    const objectRegistry& obr
)
: obr_(obr)
{
}

Foam::wallHeatRates::~wallHeatRates()  //Destructor
{
}
// int main(int argc, char *argv[])

 int main(int argc, char **argv)
{
    timeSelector::addOptions();
#   include "setRootCase.H"   //checks if run is scalar or parallel to distribute arguments accordingly
#   include "createTime.H"     //cpu,clock time stuff,access to constant dir.
    instantList timeDirs = timeSelector::select0(runTime, args);
#   include "createMesh.H" //required for mesh info.,interpolation,mesh stuff....

//    const word& gFormat = runTime.graphFormat();

    forAll(timeDirs, timeI)
    {
        runTime.setTime(timeDirs[timeI], timeI);
   
        Info<< "Time = " << runTime.timeName() << endl;

        IOobject TMeanheader
        (
            "TMean",
            runTime.timeName(),
            mesh,
            IOobject::MUST_READ
        );

        // Check T exists
        if (TMeanheader.headerOk())
        {
            mesh.readUpdate();

            Info<< " Reading TMean Field" << endl;

            volScalarField TMean(TMeanheader, mesh);

            Info<< " Calculating wallGradTMean" << endl;

            Info << "Reading LES Properties" << endl;
    
            const Foam::compressible::LESModel & sgs = obr_.lookupObject<compressible::LESModel>("LESProperties");//<--- 
               
            label patchK = mesh.boundaryMesh().findPatchID("wallHot"); //specifies the patch to compute dT/dn
           
            const scalarField alphaEffw = sgs.alphaEff()().boundaryField()[patchK];
            
        const scalarField alphaw = sgs.alpha().boundaryField()[patchK]; 
                
            scalarField GradTw = TMean.boundaryField()[patchK].snGrad();

            direction d_;  //axis direction,

            d_= Foam::point::Z;

            const scalarField Xv = mesh.boundaryMesh()[patchK].faceCentres().component(d_);

            label length = Xv.size(); 
            
             for (label i=0;i<length;i++)           
             {
              //  makeGraph( Xv[i], magGradT[i],"dTdn",runTime.path(), gFormat );
              //  Info << "Height" << tab << Xv[i] << tab << "dTdn" << tab << GradTw[i] <<endl;
             }              
          
            Info << "Spatially Average in Spanwise Direction" << endl;

            scalarField Xv_tmp(Xv);
             
            Foam::sort(Xv_tmp);

            label nbVerticalPoint = 1;
         
            scalarField Xv_mean(length);
 
            Xv_mean[0] = Xv_tmp[0];
             
             for(label i=1; i<length; i++)
             {
                 if((Xv_tmp[i] - Xv_mean[nbVerticalPoint-1]) > 1e-6)
                  {
                    Xv_mean[nbVerticalPoint++] = Xv_tmp[i];
                  }
             }

            scalarField GradTwMean(nbVerticalPoint);
            
            for(label j=0; j<nbVerticalPoint; j++)
            {
                   GradTwMean[j] = 0.0;
            }
 
            for(label i=0; i<length; i++)
            {
                label index = -1;
                for(label j = 0; j< nbVerticalPoint; j++)
                {
                  
                    //if(((Xv_tmp[i] - Xv_mean[j]) < 1e-6) || ((Xv_tmp[i] - Xv_mean[j]) > 1e-6))
                    if( mag(Xv_tmp[i] - Xv_mean[j]) < 1e-6 ) 
                    {
                           index= j ;
                           break;
                    }
                }
                GradTwMean[index] += GradTw[i];
            }
  
            for (label j= 0; j< nbVerticalPoint; j++)
            {      
                 GradTwMean[j] /= ceil(length/nbVerticalPoint);
                // Info<<Xv_mean[j]<<tab<<GradTwMean[j]<<endl;
            } 
                   
        }

        else

        {
            Info<< "No TMean" << endl;
        }
    } 
   
    Info<< "End" << endl;

    return 0;
}
I do have a header file as well called wallHeatRates.H where I defined the wallHeatRates constructor. The error is pointing to this line that has
const Foam::compressible::LESModel & sgs = obr_.lookupObject<compressible::LESModel>("LESProp erties");

Can someone help me out here as I am just working my way up in OpenFOAM programming.
deji is offline   Reply With Quote

Old   August 4, 2010, 03:34
Default
  #2
Senior Member
 
n/a
Join Date: Sep 2009
Posts: 199
Rep Power: 17
deji is on a distinguished road
Here is the header file wallHeatRates.C
Code:
#ifndef wallHeatRates_H
#define wallHeatRates_H
#include "primitiveFieldsFwd.H"
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
//**************************************************//

namespace Foam
{

class objectRegistry; //Forward declaration

class wallHeatRates  //Declare wallHeatRates class
{
protected:

    const objectRegistry& obr_; //obr_ defined only within class wallHeatRates  

    //- Disallow default bitwise copy construct
    wallHeatRates(const wallHeatRates&);

    //- Disallow default bitwise assignment
    void operator=(const wallHeatRates&);
  
public:
    //Runtime type information
    TypeName ("wallHeatRates");

      //Constructor declaration
      wallHeatRates
      (
         const objectRegistry&
      );

      //Destructor
     virtual ~wallHeatRates();


};

}; //end namespace Foam

#endif
//**************************************************************************//
deji 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
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 16:33
help with wall functions Nick Georgiadis Main CFD Forum 10 January 17, 2017 11:03
[blockMesh] StitchMesh on two patches anita OpenFOAM Meshing & Mesh Conversion 31 April 4, 2013 12:51
Heat transfer BC at wall- why need wall thickness? Julie FLUENT 7 February 3, 2012 22:41
State of the art in CFD technology Juan Carlos GARCIA SALAS Main CFD Forum 39 November 1, 1999 15:34


All times are GMT -4. The time now is 12:36.