CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

localBlended

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree2Likes
  • 2 Post By bjnieuwboer

Reply
 
LinkBack Thread Tools Display Modes
Old   August 10, 2012, 11:04
Default localBlended
  #1
Senior Member
 
Julien
Join Date: Jun 2012
Location: France
Posts: 153
Rep Power: 5
Djub is on a distinguished road
Hi !
I would appreciate some info about the use of localBlended.

I know the post Using the localBlended scheme for DES (GO HERE)
and the post Sponge layer for outflow BC (GO THERE)
but I feel to week to manage alone.

I tried grep localBlended . -R from the tutorial folder, with no success...

Some help from anybody?

I want to run a LES calculation, and I'd like to prevent the vortices (created in a turbulent wake) to "explode" when reaching the outlet. Do you have another solution than
1/ have a very long domain
and
2/ use localBlended scheme (with a dissipative linear upwind scheme for U convection)
?

Thanks in advance,

Julien
Djub is offline   Reply With Quote

Old   August 21, 2012, 11:19
Unhappy
  #2
Senior Member
 
Julien
Join Date: Jun 2012
Location: France
Posts: 153
Rep Power: 5
Djub is on a distinguished road

sniff...
Nobody to help me...
Djub is offline   Reply With Quote

Old   April 30, 2015, 10:03
Default Piece of code for using the localBlend scheme
  #3
New Member
 
Bas Nieuwboer
Join Date: Mar 2013
Posts: 6
Rep Power: 4
bjnieuwboer is on a distinguished road
Hi Julian,

I know this response is way too late for you. I hope you solved your problem. However, I had a similar problem and I saw your post without an answer. This is how I solved it. In the first 3 steps you have to edit your solver. The next steps are to create the fields itself and use the localBlended scheme

1) Go to your solver and find the file "createFields.H". This reads all the fields from your 0 folder in your simulation.

2) Attach the following piece of code to the "createFields.H" or include it from another H-file. This script reads the blendingfactors for U,k and/or epsilon. The volScalarFields to be read are called UBlend, kBlend and/or epsilon. The script then interpolates these fields to surfaceScalarFields UBlendingFactor, kBlendingFactor and/or epsilonBlendingFactor. A IOobjects called UBlendingFactor is automatically used when the scheme localBlended is used.

Code:
//BJN 2015-04-30 extra file to read the volScalarFields for the blendingfactor used for localBlended scheme. For each variable that uses the localBlended scheme, there should be a volScalarField with the blendfactor. This volScalarField can be created by for instance the funkysetfields utility of swak4foam. In this file the volumeScalarFields are interpolated to surfaceScalarFields that are needed for the localBlended scheme.

/*Usage

    div(phi,U)       Gauss localBlended linear upwind; // When blendingfactor is 1 use the first scheme. When blendingfactor is 0 use the second.

*/
//Info<< "Reading field UBlend\n" << endl;
volScalarField UBlend
(
    IOobject
    (
        "UBlend",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::NO_WRITE
    ),
    mesh,
    dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0)
);

//Info<< "Transforming field UBlend to surfaceScalarField named: UBlendingFactor\n" << endl;
surfaceScalarField UBlendingFactor
(
    IOobject
    (
        "UBlendingFactor",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::NO_WRITE
    ),
fvc::interpolate(UBlend)  // The interpolation. Please note: for the localBlended scheme to work on 'U' the variable UBlendingFactor should be present. It should be an IOobject and it should be a surfaceScalarField
);

//Info<< "Reading field kBlend\n" << endl;
volScalarField kBlend
(
    IOobject
    (
        "kBlend",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::NO_WRITE
    ),
    mesh,
    dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0)
);

//Info<< "Transforming field kBlend to surfaceScalarField named: kBlendingFactor\n" << endl;
surfaceScalarField kBlendingFactor
(
    IOobject
    (
        "kBlendingFactor",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::NO_WRITE
    ),
fvc::interpolate(kBlend)
);

//Info<< "Reading field epsilonBlend\n" << endl;
volScalarField epsilonBlend
(
    IOobject
    (
        "epsilonBlend",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::NO_WRITE
    ),
    mesh,
    dimensionedScalar("zero", dimensionSet(0, 0, 0, 0, 0, 0, 0), 0.0)
);

//Info<< "Transforming field epsilonBlend to surfaceScalarField named: epsilonBlendingFactor\n" << endl;
surfaceScalarField epsilonBlendingFactor
(
    IOobject
    (
        "epsilonBlendingFactor",
        runTime.timeName(),
        mesh,
        IOobject::READ_IF_PRESENT,
        IOobject::NO_WRITE
    ),
fvc::interpolate(epsilonBlend)
);
3) Compile your new solver. Please follow instruction how to make a new solver elsewhere on this forum.

4) Change your div scheme in the fvSchemes. A value of 1 represents the linear discretisation. A value of 0 the upwind.
Code:
divSchemes
{
    default          none;
    div(phi,U)       Gauss localBlended linear upwind;
    div(phi,k)       Gauss localBlended linear upwind;
    div(phi,epsilon) Gauss localBlended linear upwind;
    div((nuEff*dev(T(grad(U))))) Gauss linear;
}
5) You still have to create the fields for the blendingfactor UBlend*. I have done this using the utility swak4foam. When installed you can create your own fields.
*note, this is the volScalarField you have to specify. UBlendingFactor is the computed surfaceScalarField that is automatically used by the localBlended scheme

6) Make a input file for the swak4foam utility called funkySetFields. The input file is called: "funkySetFieldsDict". This code shows how to create the three fields.

Code:
/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2;
    format      ascii;
    class       dictionary;
    location    "system";
    object      controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

expressions
 (
    U_outer
    {
     field UBlend; //field to initialise
     create true;
     expression "0.7";
     condition "pow(pos().x,2) + pow(pos().y,2) >= pow(1,2)";
         keepPatches 0;
    }
    U_inner
    {
     field UBlend; //field to initialise
     expression "0.8";
     condition "pow(pos().x,2) + pow(pos().y,2) < pow(1,2)";
         keepPatches 0;
    }
    U_top
    {
     field UBlend; //field to initialise
     variables "BlendTop=0;BlendBottom=0.8;ZTop=1.4;ZBottom=0;R_i=0.26;Z0=0.7;";
     expression "BlendBottom+(BlendTop-BlendBottom)/(ZTop-ZBottom)*pos().z";
     keepPatches 0;
     condition "pow(pos().x,2) + pow(pos().y,2) < pow(R_i,2) && pos().z >= 0";
    }

    k
    {
     field kBlend; //field to initialise
     create true;
     expression "1.0 * UBlend";
         keepPatches 0;
    }
    epsilon
    {
     field epsilonBlend; //field to initialise
     create true;
     expression "1.0 * UBlend";
         keepPatches 0;
    }
7) Run the funkySetFields utility with the command "funkySetFields -latestTime"

8) Run your model with your new solver
Maff and chengyu like this.
bjnieuwboer is offline   Reply With Quote

Reply

Tags
localblended ; les

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
non-constant blending function sven82 OpenFOAM 2 December 12, 2009 07:34
Using the localBlended scheme for DES philippebv OpenFOAM 1 November 18, 2009 14:38
localBlended braennstroem OpenFOAM Running, Solving & CFD 0 July 28, 2009 02:50


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