|
[Sponsors] |
using fvc::interpolate without fvSchemes / manually prescribe interpolation schemes |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 28, 2014, 13:31 |
using fvc::interpolate without fvSchemes / manually prescribe interpolation schemes
|
#1 |
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 17 |
Hi foamers,
I want to use upwind and downwind interpolation schemes in my code. A simple way could be e.g. using Code:
AfUpstream = fvc::interpolate(A) Code:
interpolationSchemes { interpolate(A) upwind fluxIndicator; } 1) I want to apply both upwind and downwind on the same field A: Code:
AfUpstream = fvc::interpolate(A) AfDownstream = fvc::interpolate(A) 2) I want to "protect" the interpolation scheme by making it unchangeable, so it shouldn't appear in the fvSchemes dict. So I need something like that Code:
AfUpstream = fvc::interpolate(A,"upwind",fluxIndicator) Code:
AfUpstream = fvc::upwindInterpolate(A,fluxIndicator) |
|
March 29, 2014, 19:53 |
|
#2 |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18 |
I know that for most of the other fvc and fvm operators you can name a particular operation like this:
fvm::div(phi,U,"velocityDivergenceUpwind") and perhaps later in the code fvm::div(phi,U,"velocityDivergenceDownwind") Where the solver will force you to set each "velocityDivergence" scheme in fvSchemes even though they are both a div(phi,U) operation. I didn't check to see if this option is available for fvc::interpolation but its worth a shot! |
|
March 31, 2014, 12:42 |
|
#3 |
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 17 |
Thanks a lot, it works.
Still, if there is a possibility to use it without fvSchemes, I would appreciate if someone share it |
|
April 3, 2014, 05:45 |
|
#4 |
Senior Member
Anton Kidess
Join Date: May 2009
Location: Germany
Posts: 1,377
Rep Power: 30 |
This snippet from interFoam might be useful for you:
Code:
fv::gaussConvectionScheme<scalar> ( mesh, phi, upwind<scalar>(mesh, phi) ).fvmDiv(phi, alpha1)
__________________
*On twitter @akidTwit *Spend as much time formulating your questions as you expect people to spend on their answer. |
|
April 4, 2014, 08:51 |
|
#5 |
Senior Member
Tomislav Maric
Join Date: Mar 2009
Location: Darmstadt, Germany
Posts: 284
Blog Entries: 5
Rep Power: 21 |
Hi everyone. Long time no see
This was an interesting question, so here's the working example: Code:
#include "fvCFD.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Main program: int main(int argc, char *argv[]) { #include "setRootCase.H" #include "createTime.H" #include "createMesh.H" #include "createFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // typedef fv::convectionScheme<vector> schemeType; // Uncomment this line to see that the choice of the interpolation scheme // is actually active. //IStringStream schemeData("Gauss something"); IStringStream schemeData("Gauss upwind"); tmp<schemeType> schemeTmp = schemeType::New( mesh, phi, schemeData // Constructor requires a ref to Istream. ); const schemeType& scheme = schemeTmp(); // Give us your name. Info << "Chosen scheme type: " << scheme.type() << endl; // Assemble the matrix. fvVectorMatrix UEqn = scheme.fvmDiv(phi, U); Info<< "\nEnd\n" << endl; return 0; } Selecting anything at run-time will depend on the 'New' static factory function (selector, as it is confusingly named in OF). So all we need is to take a look at the arguments of the selector: Code:
//- Return a pointer to a new convectionScheme created on freestore static tmp<convectionScheme<Type> > New ( const fvMesh& mesh, const surfaceScalarField& faceFlux, Istream& schemeData ); As for the direct call using the operators in "fvc" or "fvm", I would need to take a look at it. In any case, @illya, if you are writing client code, that uses those classes, you can use the classes directly, without dispatching the call from a "fvc/m" operator. Uncomment the "Gauss something" line to see that both parameters are taken and the interpolation scheme of the gaussConvectionScheme really does get selected from the second parameter. T. |
|
March 20, 2018, 06:49 |
Back to original question
|
#6 |
New Member
Join Date: Jan 2018
Posts: 12
Rep Power: 8 |
Hi Tomislav,
many thanks for your interesting code snippet, but imho it doesn't fully answer the initial question: How to code the interpolation of a volScalarField X (defined on cell centres) to a surfaceScalarField Y (defined on cell faces) while controling the scheme _without_ any controldict entry for interpolationSchemes? Or is it possible to implement something like Code:
surfaceScalarField Y = scheme.fvmInterpolate(Y,fluxIndicator); |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
fvc::interpolate -> harmonic interpolation? | gwierink | OpenFOAM Running, Solving & CFD | 8 | October 1, 2012 14:31 |
Surface interpolation schemes and parallelization | jutta | OpenFOAM Running, Solving & CFD | 0 | February 25, 2010 15:32 |
Interpolation Schemes and Limiters | mchurchf | OpenFOAM Running, Solving & CFD | 3 | November 17, 2009 00:48 |
Question About solvers and interpolation schemes | titio | OpenFOAM Running, Solving & CFD | 0 | July 9, 2009 12:41 |
Momentum interpolation for explicit schemes | Yogen | Main CFD Forum | 3 | December 20, 2002 11:43 |