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

Developing a rhoPimpleDyMFoam solver

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 15, 2012, 14:55
Post Developing a rhoPimpleDyMFoam solver
  #1
New Member
 
Bernardo Vieira
Join Date: Apr 2011
Location: USA
Posts: 7
Rep Power: 15
bvieira is on a distinguished road
I’m trying to implement a new solver, essentially adding mesh motion capability into rhoPimpleFoam. I’m using pimpleDyMFoam as a basis to figure out what needs to be changed. My ultimate goal is to be able to run pitching airfoils on a compressible flow solver.

I was able to compile the new solver, but when I try to run, I getting a dimensions error:

Code:
  Different dimensions for -=
       dimensions : [1 0 -1 0 0 0 0] = [0 3 -1 0 0 0 0]
This seems to be a difference of density (kg/m3) in one of the sides. Tracking down where the error is coming from, I figured that it happens in the following line of my code:

Code:
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
Therefore, I suspect there may be something wrong in the correctPhi.H file.
I’d appreciate any thoughts on this issue. I’m attaching the correctPhi.H file, as well as the rhoPimpleDyMFoam.C file.

I'm using the latest OpenFOAM 2.1.0.

Thank you.

correctPhi.H

Code:
{
    if (mesh.changing())
    {
        forAll(U.boundaryField(), patchI)
        {
            if (U.boundaryField()[patchI].fixesValue())
            {
                U.boundaryField()[patchI].initEvaluate();
            }
        }

        forAll(U.boundaryField(), patchI)
        {
            if (U.boundaryField()[patchI].fixesValue())
            {
                U.boundaryField()[patchI].evaluate();

                phi.boundaryField()[patchI] =
                    U.boundaryField()[patchI]
                  & mesh.Sf().boundaryField()[patchI];
            }
        }
    }

    wordList pcorrTypes
    (
        p.boundaryField().size(),
        zeroGradientFvPatchScalarField::typeName
    );

    forAll(p.boundaryField(), patchI)
    {
        if (p.boundaryField()[patchI].fixesValue())
        {
            pcorrTypes[patchI] = fixedValueFvPatchScalarField::typeName;
        }
    }

    volScalarField pcorr
    (
        IOobject
        (
            "pcorr",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionedScalar("pcorr", p.dimensions(), 0.0),
        pcorrTypes
    );

    while (pimple.correctNonOrthogonal())
    {
        //Changed the correction here to match pEqn.H (rhoPimpleFoam)
        fvScalarMatrix pcorrEqn
        (
            fvm::ddt(psi, pcorr)
          + fvc::div(phi)
          - fvm::laplacian(rho*rAU, pcorr)
        );

        // Removed the pressure referencing
        pcorrEqn.solve();

        if (pimple.finalNonOrthogonalIter())
        {
            phi -= pcorrEqn.flux();
        }
    }
}
//Changed to compressible version (not sure if rhoEqn.H should also be included)
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
rhoPimpleDyMFoam.C

Code:
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "turbulenceModel.H"
#include "dynamicFvMesh.H"
#include "bound.H"
#include "pimpleControl.H"
//#include "IObasicSourceList.H"

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

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

    #include "createDynamicFvMesh.H"

    pimpleControl pimple(mesh);

    #include "initContinuityErrs.H"
    #include "createFields.H"
    #include "readTimeControls.H"

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

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

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

        // Make the fluxes absolute
        fvc::makeAbsolute(phi, U);

        #include "setDeltaT.H"

        runTime++;

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

        mesh.update();
        
        if (mesh.changing() && correctPhi)
        {
            #include "correctPhi.H" 
        }

        // Make the fluxes relative to the mesh motion
        fvc::makeRelative(phi, U);

        if (mesh.changing() && checkMeshCourantNo)
        {
            #include "meshCourantNo.H"
        }
        
        #include "rhoEqn.H"
 
        // --- Pressure-velocity PIMPLE corrector loop
        while (pimple.loop())
        {
            #include "UEqn.H"
            #include "hEqn.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;
}


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

Last edited by bvieira; March 16, 2012 at 15:47.
bvieira is offline   Reply With Quote

 

Tags
compressible flow, pitching, rhopimpledymfoam


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
A New Solver for Supersonic Combustion nakul OpenFOAM Announcements from Other Sources 19 February 27, 2024 09:44
[Other] A New Solver for Supersonic Combustion nakul OpenFOAM Community Contributions 20 February 22, 2019 09:08
thobois class engineTopoChangerMesh error Peter_600 OpenFOAM 4 August 2, 2014 09:52
problem with developing new LES solver Edison_Ge OpenFOAM 2 June 18, 2009 01:26
why the solver reject it? Anyone with experience? bearcat CFX 6 April 28, 2008 14:08


All times are GMT -4. The time now is 14:42.