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/)
-   -   setting momentum source with fieldSources (http://www.cfd-online.com/Forums/openfoam-solving/101789-setting-momentum-source-fieldsources.html)

eelcovv May 14, 2012 10:51

setting momentum source with fieldSources
 
Hello all,

I am trying to run the channel simulation channelFoam from the tutorials with the pressure gradient set by using the new featurei in OF 2.1: fieldSources. I seems that it should be possible to use this in stead of adding the momentum source in the solver code, as is done channelFoam. However, I got problems with getting it running.

In the channel channel395 simulation I have added in the fvSolution the PIMPLE properties and UFinal properties. This allow to run the case with pimpleFoam. In the pimpleFoam solver there is now a momentum source at the right hand side of the U-equation: sources(U).

I want to define the pressuregradient, so I have added to following file sourceProperties to the constant directory with the folling contents

Code:

presGradient
{
    type            pressureGradientExplicitSource;
    active          off;            //on/off switch
    timeStart      0.0;          //start time
    duration        1e10;        //duration
    selectionMode  all;      //cellSet // points //cellZone

    pressureGradientExplicitSourceCoeffs
    {
        fieldNames  (U);
        Ubar        (0.1335 0 0 );                // set Re=64,000
//      flowDir    (1.0 0 0 );                // set Re=64,000
        gradPini    gradPini [0 2 -2 0 0] 0;  // initial pressure gradient
    }
}

This source is read by the solver, however, I got the following error message when runnig, before even the first iteration
Code:

FOAM FATAL ERROR:

    request for volScalarField (1|A(U)) from objectRegistry region0 failed
    available objects of type volScalarField are

2
(
nu
p
)


    From function objectRegistry::lookupObject<Type>(const word&) const
    in file /apps/OpenFOAM/OpenFOAM-2.1.0/src/OpenFOAM/lnInclude/objectRegistryTemplates.C at line 131.

It seems that the rAU matrix is not available. Is there somebody who has an working example of adding the source term to set the velocity using the sourceProrertiesDict ?

Any hints appreciated

Regards
Eelco

eelcovv May 15, 2012 07:45

problem solved
 
For those interested: it appeared to be a bug in the pimpleFoam of 2.1.0, which is already fixed in pimpeFoam 2.1.x, where the call to the sources(U) term UEqn.H was moved below the declaration of rAU.

I tested the source term on the channelFoam tutorial case by adding the file sourceProperties to the constant directory and run pimpleFoam. Indeed the same results as using channelFoam is obtained.


Code:

presGradient
{
    type            pressureGradientExplicitSource;
    active          on;            //on/off switch
    timeStart      0.0;          //start time
    duration        1e10;        //duration
    selectionMode  all;      //cellSet // points //cellZone

    pressureGradientExplicitSourceCoeffs
    {
        fieldNames  (U);
        Ubar        (0.1335 0 0 );                // set Re=64,000
        flowDir    (1.0 0 0 );                // set Re=64,000
        gradPini    gradPini [0 1 -2 0 0] 0;  // initial pressure gradient
    }
}


JackW July 14, 2013 16:57

Hi,

I noticed this thread, even though it is a bit old - I have a question!

When I run pimpleFoam with a pressure source as you describe above, my results seem ok, except for the pressure field.

When I observe them in paraview the pressure gradient isn't apparent (I have a PG of 20, but my results don't indicate this). Everything else seems fine!

Any help on this would be really appreciated!

Best wishes,

Jack


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