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

Implementing a dynamic mesh motion solver in an accelerating frame

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By pruthvi1991

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 21, 2015, 19:28
Arrow Implementing a dynamic mesh motion solver in an accelerating frame
  #1
Member
 
Pruthvi
Join Date: Feb 2014
Posts: 41
Rep Power: 12
pruthvi1991 is on a distinguished road
Hello everybody,

I'm trying to simulate a plunging and pitching airfoil. The pitch amplitude is upto 70 degrees and plunge amplitude is upto 1 chord length. Therefore a deforming mesh did not seem very wise.

I went through a paper by kinsey and dumas and they have implemented a solver in the heaving reference frame by adding a source term to the Navier stokes. This means that the N-S equation has a time varying body force term in the RHS. The time varying term looks like this.
Code:
F = F*sin(w*t)
Note : Rotation is taken care of by a sliding AMI.

I was able to implement this in pimpleFoam by the following additions to the pimpleFoam.C code and compile it with no issues. Here is the repository for those who prefer that and want test what I did.

Code:
int main(int argc, char *argv[])
{
const dimensionedScalar gunits("gunits", dimensionSet(0,1,-2,0,0,0,0), 0.01574684362);

    #include "setRootCase.H"
    #include "createTime.H"
    #include "createMesh.H"
    #include "readGravitationalAcceleration.H"
    #include "createFields.H"
    #include "createFvOptions.H"
    #include "initContinuityErrs.H"

    pimpleControl pimple(mesh);

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

    Info<< "\nStarting time loop\n" << endl;

    while (runTime.run())
    {
        #include "readTimeControls.H"
        #include "CourantNo.H"
        #include "setDeltaT.H"

        runTime++;
	
g=gunits*Foam::sin(runTime.value()*2*pi*freQ)*vector(0,1,0);
        Info<< "Time = " << runTime.timeName() << nl << endl;

        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            #include "UEqn.H"

            // --- Pressure corrector loop
            while (pimple.correct())
            {
                #include "pEqn.H"
            }

            if (pimple.turbCorr())
            {
                turbulence->correct();
            }
        }

        runTime.write();

        Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
            << "  ClockTime = " << runTime.elapsedClockTime() << " s"
            << nl << endl;
    }

    Info<< "End\n" << endl;

    return 0;
}
Ueqn is as follows:
Code:
tmp<fvVectorMatrix> UEqn
(
    fvm::ddt(U)
  + fvm::div(phi, U)
  + turbulence->divDevReff(U)
 ==
    fvOptions(U)
);

UEqn().relax();

fvOptions.constrain(UEqn());

volScalarField rAU(1.0/UEqn().A());

if (pimple.momentumPredictor())
{
   
Quote:
solve(UEqn() == g -fvc::grad(p));
fvOptions.correct(U); }
I tried the same with pimpleDyMFoam and I ran into the following error.

Code:
Making dependency list for source file inertial_pimpleDyMFoam.C
SOURCE=inertial_pimpleDyMFoam.C ;  g++ -m64 -Dlinux64 -DWM_DP -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor -O3  -DNoRepository -ftemplate-depth-100 -I.. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/turbulenceModels/incompressible/turbulenceModel -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/transportModels/incompressible/singlePhaseTransportModel -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/fvOptions/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/sampling/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/dynamicFvMesh/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/dynamicMesh/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/meshTools/lnInclude  -IlnInclude -I. -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OpenFOAM/lnInclude -I/opt/OpenFOAM/OpenFOAM-2.3.x/src/OSspecific/POSIX/lnInclude   -fPIC -c $SOURCE -o Make/linux64GccDPOpt/inertial_pimpleDyMFoam.o
inertial_pimpleDyMFoam.C: In function ‘int main(int, char**)’:
inertial_pimpleDyMFoam.C:79:2: error: ‘g’ was not declared in this scope
  g=gunits*Foam::sin(runTime.value()*freQ)*vector(0,1,0);
  ^
In file included from inertial_pimpleDyMFoam.C:61:0:
/opt/OpenFOAM/OpenFOAM-2.3.x/src/finiteVolume/lnInclude/readTimeControls.H:38:8: warning: unused variable ‘maxDeltaT’ [-Wunused-variable]
 scalar maxDeltaT =
        ^
make: *** [Make/linux64GccDPOpt/inertial_pimpleDyMFoam.o] Error 1


Can you guys help me solve this issue. I would really appreciate it if you could help me fix the error
Code:
inertial_pimpleDyMFoam.C: In function ‘int main(int, char**)’:
inertial_pimpleDyMFoam.C:79:2: error: ‘g’ was not declared in this scope
I'm surprised that I was able to compile pimpleFoam since I haven't declared variable g anywhere. There was a similar thread a couple of years old and the implementation in this thread is derived from there.
pruthvi1991 is offline   Reply With Quote

Old   March 22, 2015, 15:18
Default
  #2
Member
 
Pruthvi
Join Date: Feb 2014
Posts: 41
Rep Power: 12
pruthvi1991 is on a distinguished road
Problem Solved !

I forgot to add #include "readGravitationalAcceleration.H" to pimpleDyMFoam solver and that was causing the trouble. Here the new code.

Code:
int main(int argc, char *argv[])
{
const dimensionedScalar gunits("gunits", dimensionSet(0,1,-2,0,0,0,0), 0.01574684362);

    #include "setRootCase.H"
    #include "createTime.H"
    #include "createDynamicFvMesh.H"
    #include "initContinuityErrs.H"
#include "readGravitationalAcceleration.H"

    pimpleControl pimple(mesh);

    #include "createFields.H"
    #include "createUf.H"
    #include "createFvOptions.H"
    #include "readTimeControls.H"
    #include "createPcorrTypes.H"
    #include "CourantNo.H"
    #include "setInitialDeltaT.H"

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

    Info<< "\nStarting time loop\n" << endl;

    while (runTime.run())
    {
        #include "readControls.H"
        #include "CourantNo.H"

        #include "setDeltaT.H"

        runTime++;

        g=gunits*Foam::sin(runTime.value()*freQ)*vector(0,1,0);

        Info<< "Time = " << runTime.timeName() << nl << endl;

        mesh.update();
Cheers!
Yage and postechkian like this.
pruthvi1991 is offline   Reply With Quote

Reply

Tags
accelerating frame, pimpledymfoam, solver compilation error


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
RBF motion solver implementation ZoeWu OpenFOAM Pre-Processing 2 December 23, 2021 14:30
Star cd es-ice solver error ernarasimman STAR-CD 2 September 12, 2014 00:01
Using reference frame motion or mesh motion? jiejie FLUENT 5 August 8, 2013 01:29
Mesh motion and frame motion saisanthoshm88 FLUENT 0 October 16, 2012 09:54
Bug in turbulent dynamic Mesh Solver thomas OpenFOAM Running, Solving & CFD 0 October 29, 2008 03:48


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