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

Get runtime information in overlapGgi class

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 10, 2016, 19:05
Default Get runtime information in overlapGgi class
  #1
Member
 
Janry
Join Date: Oct 2015
Posts: 46
Rep Power: 10
qjh888 is on a distinguished road
Hi Foamers,

I want to get the runtime information in the overlapGgiPolyPatchTemplates.C, and the code is showing as below:

Code:
overlapGgiPolyPatchTemplates.C

#include "overlapGgiPolyPatch.H"
#include "RodriguesRotation.H"

// * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //

template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::overlapGgiPolyPatch::expandData(const Field<Type>& pf) const
{
    // Check and expand the field from patch size to zone size
    if (pf.size() != size())
    {
        FatalErrorIn
        (
            "tmp<Field<Type> > overlapGgiPolyPatch::expandData"
            "("
            "    const Field<Type>& pf"
            ") const"
        )   << "Incorrect patch field size.  Field size: "
            << pf.size() << " patch size: " << size()
            << abort(FatalError);
    }

    const label ncp = nCopies();     // How many copies will compose a full revolution
  
    const scalar myAngle = 360.0/scalar(ncp);  // pitch angle

    tmp<Field<Type> > texpandField    // initialize a tmeperary expandField
    (
        new Field<Type>(ncp*zone().size(), pTraits<Type>::zero)
    );

    Field<Type>& expandField = texpandField(); 

    label nFaces = 0;
  
    for (label copyI = 0; copyI < ncp; copyI++)
    {
        // Calculate transform
        const tensor curRotation =
            RodriguesRotation(rotationAxis_,  copyI*myAngle);

        forAll (pf, faceI)
        {
            expandField[nFaces] = transform(curRotation, pf[faceI]);
            nFaces++;
        }
    }
    
    Info << "expandField = " << expandField << nl << endl;
 

    if (!localParallel())
    {
        reduce(expandField, sumOp<Field<Type> >());
    }

    return texpandField;
}
// * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //

template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::overlapGgiPolyPatch::interpolate(const Field<Type>& pf) const  
{

    Info << "runtime ====!!!!!!"  << this->db().time().value() << nl << endl;
    // Get the runtime information here
    // Check and expand the field from patch size to zone size
    if (pf.size() != shadow().size())
    {
        FatalErrorIn
        (
            "tmp<Field<Type> > ggiPolyPatch::interpolate"
            "("
            "    const Field<Type>& pf"
            ") const"
        )   << "Incorrect slave patch field size.  Field size: "
            << pf.size() << " patch size: " << shadow().size()
            << abort(FatalError);
    }

    // Expand data
    tmp<Field<Type> > expanddata = shadow().expandData(pf); 
    tmp<Field<Type> > tresult(new Field<Type>());
    Field<Type>& result = tresult();

    if (master())
    {
        // Expand slave data
        result = patchToPatch().slaveToMaster(expanddata); //patchToPatch() is defined in 
    }
    else
    {
        // Expand master data
        result = patchToPatch().masterToSlave(expanddata);
    }
    // Truncate to size
    result.setSize(size());

    return tresult;
}


template<class Type>
Foam::tmp<Foam::Field<Type> >
Foam::overlapGgiPolyPatch::interpolate(const tmp<Field<Type> >& tpf) const
{
    tmp<Field<Type> > tint = interpolate(tpf());
    tpf.clear();
    return tint;
}
May I ask how could I get access to the runtime at the position showed by red?

And Also could you please tell me the function of the code marked in blue?

Thanks very much,
Janry
qjh888 is offline   Reply With Quote

Old   November 10, 2016, 19:10
Default
  #2
Member
 
Janry
Join Date: Oct 2015
Posts: 46
Rep Power: 10
qjh888 is on a distinguished road
I've test :

this->db().time().value()
this->mesh().thisDb().time().value()
mesh.runTime().timeName()
....

All them failes.
qjh888 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
Issues in FGM combustion model implementation Lisandro Maders OpenFOAM Programming & Development 15 April 22, 2020 19:18
Runtime Type Selection Zeppo OpenFOAM Programming & Development 2 August 2, 2016 15:58
The udf.h headers are unable to open- in VISUAL STUDIO 13 sanjeetlimbu Fluent UDF and Scheme Programming 4 May 2, 2016 05:38
Best way to pass a scalar variable to a runtime selectionnable class? Yann OpenFOAM Programming & Development 0 October 22, 2014 08:53
Terrible Mistake In Fluid Dynamics History Abhi Main CFD Forum 12 July 8, 2002 09:11


All times are GMT -4. The time now is 02:55.