CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   fvc::interpolate -> harmonic interpolation? (https://www.cfd-online.com/Forums/openfoam-solving/77862-fvc-interpolate-harmonic-interpolation.html)

gwierink July 6, 2010 10:09

fvc::interpolate -> harmonic interpolation?
 
Dear all,

I would like to know how OF interpolates physical properties onto faces. I know there is linear interpolation and I have seen some threads (Interpolation in OpenFOAM and About interFoam solver) on related issues, but not quite what I am looking for.
My questions are the following:
  1. How does OF interpolate physical properties (e.g. viscosity in interFoam) onto faces and where is it defined?
  2. Is there a harmonic interpolation scheme for physical properties (can fvc::interpolate be set to harmonic somehow)?
Many thanks in advance!

herbert July 6, 2010 11:04

Hi Gijsbert,

@1: I think it is always done using fvc::interpolate() (e.g. for viscosity in interFoam you can find it in src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C; member funtion mu())

@2: fvc::interpolate should read its schemes from fvSchemes-Dictionary. Therefore you should be able to apply what you think to be the best for your purpose.

Regards,
Stefan

gwierink July 6, 2010 11:42

Hi Stefan,

Thanks for your reply!

Quote:

@1: I think it is always done using fvc::interpolate() (e.g. for viscosity in interFoam you can find it in src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C; member funtion mu())
In the member functions (for e.g. muf) in src/transportModels/incompressible/incompressibleTwoPhaseMixture/twoPhaseMixture.C fvc::interpolate is also used, but I can' find anywhere how things are interpolated.

As you write, I also thought of changing schemes in fvSchemes:
Quote:

@2: fvc::interpolate should read its schemes from fvSchemes-Dictionary. Therefore you should be able to apply what you think to be the best for your purpose.
But when I write
Code:

interpolationSchemes
{
    default        banana;//linear;
}

I get a list of (what seem to be) advection schemes (not face interpolation schemes (?)):
Code:

Interpolation dsicretization schemes:

Unknown discretisation scheme banana

Valid schemes are :

56
(
linear
quadraticUpwindFit
limitedCubic
limitedLinear
downwind
OSPREV
Gamma
localMax
quadraticLinearUpwindFit
outletStabilised
quadraticFit
MUSCLV
reverseLinear
GammaV
blended
UMISTV
limitWith
linearPureUpwindFit
vanLeer
vanLeerV
linearUpwind
Minmod
filteredLinear2V
MinmodV
Phi
cubic
SuperBee
filteredLinear3
biLinearFit
filteredLinear3V
quadraticLinearFit
QUICK
UMIST
limitedLinearV
SuperBeeV
weighted
skewCorrected
midPoint
vanAlbadaV
linearFit
linearUpwindV
localMin
fixedBlended
SFCDV
vanAlbada
OSPRE
MUSCL
clippedLinear
filteredLinear2
upwind
limitedCubicV
localBlended
SFCD
cubicUpwindFit
filteredLinear
QUICKV
)

In the mean time I did find a harmonic interpolation scheme in src/finiteVolume/interpolation/surfaceInterpolation/schemes/harmonic/harmonic.H. But when I plug it into the UEqn as a test (in interFoam), like below, the compiler complains that harmonic is a virtual function so it needs an object.

Code:

   
surfaceScalarField muEff
(
    "muEff",
    twoPhaseProperties.muf()
    + harmonic::interpolate(rho*turbulence->nut())
//      + fvc::interpolate(rho*turbulence->nut())
);

Would anyone have an idea about this? Am I doing something nonsensible syntax-wise? Thanks in advance!

herbert July 6, 2010 12:25

Hi Gijsbert,

the problem is, that the interpolationScheme defined in fvSchemes in used for every call of fvc::interpolate (and this are 12 in interFoam!). Some of this interpolations might not fit to the harmonic scheme. This should cause the errors and should also be the reason, why it is not listed in your banana-Test.

Nevertheless you won't have to change any piece of code I think. Instead you can specify the harmonic scheme to single operations e.g. by the following entry in fvSchemes:
Code:

interpolationSchemes
(
    default                      linear;
    interpolate(nu1)          harmonic;
    interpolate(nu2)          harmonic;
    interpolate((rho*nut))  harmonic;
)

You can test if these entries are used, by replacing harmonic by banana again.

Have a lot of fun,
Stefan

kathrin_kissling July 6, 2010 12:53

Hello Gjis!!!

hope you're fine.

If you don't want this to be accessed from anywhere else you can hardcode that one as well!

tmp< GeometricField< Type, fvPatchField, volMesh > > interpolate ( const GeometricField< Type, fvPatchField, volMesh > &




const surfaceScalarField & tvf,

const word & name
)
Name than would be the name of your interpolation scheme.

Best!

Kathrin

gwierink July 7, 2010 10:17

@ Stefan:
Quote:

Some of this interpolations might not fit to the harmonic scheme
Aha, good point!
Thanks for the help, I implemented it and it works.


@ Kathrin:
Hi Kathrin, I'm fine, thanks :). Hope you're well too!

Many thanks for the help. Hardcoding would perhaps be good at some point. But I am not quite clear on the snippet, so I have some (possibly dumb) questions ... For a harmonic scheme myHarmonicScheme I suppose the code goes like this:

Code:

tmpGeometricFieldTypefvPatchFieldvolMesh  > > interpolate                     
(
                     
const GeometricField< Type,  fvPatchField, volMesh >& const surfaceScalarField &tvf,
          const word &myHarmonicScheme
)

Isn't "tvf" a tensorVolumeField (just a guess)? Is that ok for viscosity? Also, should I then put this code into $FOAM_SRC//finiteVolume/finiteVolume/fvc/? And shouldn't there be an actual implementation of the interpolation algorithm?

akidess January 17, 2011 11:29

Gijsbert, the snippet Kathrin showed you is already part of fvc (see openfoam documentation). You should be able to hard call a harmonic interpolation by using:

Code:

surfaceScalarField some_ssf = fvc::interpolate(some_vsf, "harmonic");
- Anton

EDIT: I just tested this, unfortunately it doesn't work. This snippet tries to find a "harmonic" entry in fvSchemes instead, which has little advantage over directly specifying the term in fvSchemes.

deji January 4, 2012 10:52

Hello to all. Perhaps someone can quickly enlighten on this topic, I need to interpolate cell centered values to cell faces. The cell centered faces needed to interpolate to cell faces are near the boundary, and not really quite sure how to code it. How is this:

const fvPatchScalarField& Tw = thermo.T().boundaryField()[patchI];
const scalarField Tadj = Tw.patchInternalField();//gives T for cell adjacent to wall
surfaceScalarField Tsurf=fvc::interpolate(Tadj);


This code makes sense, but I'm not sure if it is correct. Furthermore, does the interpolation computes face values for the east, west, north, and southern faces? I need the east, west, and northern face values, so how do get those from the interpolation operation?:confused:

Cheers,
Deji

hawkeye321 October 1, 2012 13:31

face value of a parameter
 
Hi FOAMERS
I am trying to solve a set of equations in the following form
--------
(Density)*fvm::ddt(U)
+ (Density/gL)*fvm::div(phi, U)
- (Visc)*(fvm::laplacian(U))
- GravityVector*g*Density*((BetaT*(T-TNot))+BetaC*(C-CNot))
+ fvm::Sp(gL*Visc/Perm,U)
--------
Perm is the permeability which is calculated by the following relation

Perm[celli] = (pow(SDAS.value(),2))*pow((gL[celli]),3)/(180*(pow((1-gL[celli]),2)));

Is there any way to make sure that the permeability at the cell face is calculated by mean harmonic interpolation?


All times are GMT -4. The time now is 19:05.