CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (http://www.cfd-online.com/Forums/openfoam-solving/)
-   -   A question on implementing the actuationDisk to the pisoFoam solver (http://www.cfd-online.com/Forums/openfoam-solving/113065-question-implementing-actuationdisk-pisofoam-solver.html)

frankyux February 11, 2013 14:52

A question on implementing the actuationDisk to the pisoFoam solver
 
Hi folks,
I have a question on implementing the actuationDisk to the pisoFoam solver. Since I didn’t use OpenFoam too much and don’t familiar with C++, my questions may sounds stupid.
I’m currently using OpenFoam 2.0.., I can find the implementation of actuationDisk under simpleFoam, namely windSimpleFoam, and this is my starting point.

My first attempt was, in the pisoFoam.C, first include #include "IObasicSourceList.H". Then add the actuationDisk to the right-hand-side of the UEqn.
Code:


#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulenceModel.H"
#include "IObasicSourceList.H"

int main(int argc, char *argv[])
{
    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "createFields.H"
    #include "initContinuityErrs.H"

    IObasicSourceList actuationDisks(mesh);

    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

    Info<< "\nStarting time loop\n" << endl;
    while (runTime.loop())
    {
        Info<< "Time = " << runTime.timeName() << nl << endl;

        #include "readPISOControls.H"
        #include "CourantNo.H"

        // Pressure-velocity PISO corrector
        {
            // Momentum predictor
            fvVectorMatrix UEqn
            (
                fvm::ddt(U)
              + fvm::div(phi, U)
              + turbulence->divDevReff(U)
            );
            // Add resistance on the actuation disks
            actuationDisks.addSu(UEqn());
            UEqn.relax();

            if (momentumPredictor)
            {
                solve(UEqn == -fvc::grad(p));
            }
            // --- PISO loop
                  ….
                  ….
        }
        turbulence->correct();
        runTime.write();
        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }
    //Info<< "End\n" << endl;



After the above modification, I got the following error message:

pisoFoam.C: In function ‘int main(int, char**)’:

pisoFoam.C:77: error: no match for call to ‘(Foam::fvVectorMatrix) ()’

where my Line77 refers to actuationDisks.addSu(UEqn());Does this mean that there is something wrong with the format of my UEqn?

I also tried to write my UEqn separately as UEqn.H, and replace the one in psioFoam,
Code:


  tmp<fvVectorMatrix> UEqn
    (
        fvm::div(phi, U)
      + turbulence->divDevReff(U)
    );
    // Add resistance on the actuation disks
actuationDisks.addSu(UEqn());

However, I got the following error message:

In file included from pisoFoam.C:81:
UEqn.H: In function ‘int main(int, char**)’:
UEqn.H:13: error: ‘class Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >’ has no member named ‘relax’
pisoFoam.C:97: error: ‘class Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >’ has no member named ‘A’
pisoFoam.C:99: error: ‘class Foam::tmp<Foam::fvMatrix<Foam::Vector<double> > >’ has no member named ‘H’


This one I think is because in piso loop it needs UEqn.A() and UEqn.H().
For now I just want to create a very simple example that I can involve actuationDisk in piso algorithm, anyone had this experience or any thoughts?

Thanks in advance.

Regards
Frank

frankyux February 11, 2013 14:54

I’m currently using OpenFoam 2.0.1. A typo.

Hanzo February 12, 2013 01:51

Quote:

Originally Posted by frankyux (Post 407204)

pisoFoam.C:77: error: no match for call to ‘(Foam::fvVectorMatrix) ()’

where my Line77 refers to actuationDisks.addSu(UEqn());Does this mean that there is something wrong with the format of my UEqn?

I am also not that skilled in c++ but I wonder what you want to access using
Code:

UEqn()
.

UEqn is a fvVectorMatrix, which itsel is defined as
in http://foam.sourceforge.net/docs/cpp/a04523_source.html

And here you can find a list of all public member functions of this type
http://foam.sourceforge.net/docs/cpp/a04525_source.html (starting line 115)

So you can access properties writing UEqn.source(), UEqn.internalCoeffs(), UEqn.psi() and so on. If your function addSu() expects a variable of type
fvVectorMatrix just try something like addSu(UEqn) or addSu(&UEqn).

Hope that helps.
Best,
Hanzo

frankyux February 12, 2013 11:26

Thanks for your reply. Just wondering why it works fine with windSimpleFoam but doesn't work here.

su_junwei April 28, 2013 10:11

Quote:

Originally Posted by frankyux (Post 407441)
Thanks for your reply. Just wondering why it works fine with windSimpleFoam but doesn't work here.

They different, in your implementation, UEqn is an fvMatrix type, however in the second implemenation, UEqn is an tmp type, you have to convert it to fvMatrix type to use actuationDisks.addSu, and thus, use UEqn()(to get its object of tmp)


All times are GMT -4. The time now is 08:22.