CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   Patch which extrapolates pressure to a wall (http://www.cfd-online.com/Forums/openfoam-pre-processing/80627-patch-extrapolates-pressure-wall.html)

steph79 October 1, 2010 05:48

Patch which extrapolates pressure to a wall
 
Hi,

I'm using OpenFOAM version 1.7 and would like to utilise a patch which extrapolates pressure values from the fluid volume onto a wall as opposed to forcing the pressure gradient (normal to the wall) to equal zero, i.e. the zeroGradient patch.

Will the "calculated" patch be able to achieve this for me? If so, how should I go about enabling it for use with icoFoam? I suspect I need to add a line in Make/options and then compile an alternative solver but I've never done that before so I could use some help. This is the error message I receive when I try to use the calculated patch with the standard icoFoam;


Code:

--> FOAM FATAL ERROR:

    gradientInternalCoeffs cannot be called for a calculatedFvPatchField
    on patch plate of field p in file "/home/mitchs/OpenFOAM/Test/0/p"
    You are probably trying to solve for a field with a default boundary condition.

    From function calculatedFvPatchField<Type>::gradientInternalCoeffs() const
    in file fields/fvPatchFields/basic/calculated/calculatedFvPatchField.C at line 186.

FOAM exiting


steph79 October 9, 2010 16:31

Hi all,

I have received guidance with regards to adapting icoFoam in order to utilise the true pressure gradient normal to walls, rather than forcing the typical zeroGradient approximation. I have constructed this module of code through observation of the closest match I could find on here (http://www.cfd-online.com/Forums/ope...ification.html) however I'm still still short on understanding how this code should be tailored to fit in to the solver. From what I understand the function is detecting wall proximity and the refCast will calculate the pressure gradient which is then to be exploited as the boundary itself. Could anyone with their experience provide some more pointers as to how this could be retrofitted to the standard icoFoam code?



Code:

forAll(mesh.boundaryMesh(), patchI)
{
    if (isA<wallFvPatch>(mesh.boundaryMesh()[patchI]))
    {

fvPatchScalarField& pp = p.boundaryField()[patchi];
fixedGradientFvPatchScalarField& ppatch = refCast<fixedGradientFvPatchScalarField>(pp);

ppatch.gradient()[i] =  Ueqn.H();    // Re-arranging equation 3.140 on page 146 from Prof Jasak's thesis and setting Uf to zero

    }
}



All times are GMT -4. The time now is 23:58.