CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   evaluate surface of the patchField (https://www.cfd-online.com/Forums/openfoam-programming-development/82976-evaluate-surface-patchfield.html)

Cyp December 10, 2010 05:06

evaluate surface of the patchField
 
hello!

I am facing a new problem : I do not know how to evaluate the surface of a patchField labeled patchID.

I was thinking about
Code:

p.boundaryField[patchID].magSf();
but it doesn't work.


Thank you very much for your help,
Cyp

MartinB December 10, 2010 05:25

Hi Cyp,

try:
Code:

p.boundaryField()[patchID].magSf();
Martin

Cyp December 10, 2010 05:29

Hi Martin!

It doesn't work neither...

(in fact it was what I tried... my first post was a typo)

MartinB December 10, 2010 05:49

May be
Code:

mesh.magSf().boundaryField()[patchID];
?

Can you post some more code?

Martin

Cyp December 10, 2010 07:14

It still doesn't work...

This is the piece of code I consider:
Code:

    surfaceScalarField phiKsa = fvc::interpolate(kSa);
    surfaceScalarField phiKsb = fvc::interpolate(kSb);

    surfaceScalarField phiP
    (
        IOobject
        (
            "phiP",
            runTime.timeName(),
            mesh,
            IOobject::NO_READ,
            IOobject::NO_WRITE
        ),
        mesh,
        dimensionedScalar("zero", dimensionSet(1, -2, -2, 0, 0), 0.0)
    );

    phiP = ((-fvc::interpolate(Ub+Ua)&mesh.Sf())+((rhoa*phiKsa+rhob*phiKsb)*g&mesh.Sf()))
            / (phiKsa + phiKsb)/mesh.magSf().boundaryField()[patchID];


MartinB December 10, 2010 07:36

Code:

phiP.boundaryField() = ((-fvc::interpolate(Ub+Ua)&mesh.Sf())+((rhoa*phiKsa+rhob*phiKsb)*g&mesh.Sf()))/(phiKsa + phiKsb)/mesh.magSf().boundaryField();
?

What's the error message? Is it one of the standard solvers of OpenFOAM, so I can check it?

May be you can loop over the patches like here:
Code:

volVectorField tau
        (
            IOobject
            (
                "tau",
                runTime.timeName(),
                mesh,
                IOobject::NO_READ,
                IOobject::AUTO_WRITE
            ),
            mesh,
            dimensionedVector
            (
                "tau",
                Reff.dimensions(),
                vector::zero
            )
        );

        forAll(tau.boundaryField(), patchi)
        {
            tau.boundaryField()[patchi] =
            (
                -mesh.Sf().boundaryField()[patchi]
                /mesh.magSf().boundaryField()[patchi]
            ) & Reff.boundaryField()[patchi];
        }


Cyp December 10, 2010 09:46

thank you very much for your help. It works now!

Code:

    scalarField fluxP = -(phi.boundaryField()[patchID])
                /(kSa.boundaryField()[patchID]+kSb.boundaryField()[patchID])
                /mesh.magSf().boundaryField()[patchID];



All times are GMT -4. The time now is 04:35.