|
[Sponsors] |
August 10, 2012, 12:04 |
localBlended
|
#1 |
Senior Member
Julien
Join Date: Jun 2012
Location: France
Posts: 152
Rep Power: 14 |
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 |
|
August 21, 2012, 12:19 |
|
#2 |
Senior Member
Julien
Join Date: Jun 2012
Location: France
Posts: 152
Rep Power: 14 |
sniff... Nobody to help me... |
|
April 30, 2015, 11:03 |
Piece of code for using the localBlend scheme
|
#3 |
Member
Bas Nieuwboer
Join Date: Mar 2013
Posts: 34
Rep Power: 13 |
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) ); 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; } *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; } 8) Run your model with your new solver |
|
February 1, 2017, 14:09 |
|
#4 | |
New Member
|
Quote:
first of all thank you so much for your "mini" tutorial about the generation of a "damping" zone using a velocity blending factor. I have a question about the procedure u showed in this post: you have created the blending factors using the funkySetFieldsDict, but this is only an initialization of this factors or these parameters maintain the values you took during the simulation? Thank you for your time. Regars, Vincenzo |
||
February 2, 2017, 05:24 |
|
#5 |
Member
Bas Nieuwboer
Join Date: Mar 2013
Posts: 34
Rep Power: 13 |
Hi Vincenzo,
I indeed created the blendfactors at the start of my simulation and they are not adjusted during the simulation time. For example for U I created the UBlend using funkysetFields. In the solver this field is interpolated to the surfaceScalarField UBlendingfactor. This is automatically used by the localBlended scheme. Regards, Bas |
|
February 2, 2017, 05:32 |
|
#6 |
New Member
|
Hi Bas...so the blending factor works only when one start the funkySetField application? in this way we have not a permanent damping region... am i wrong?
thank you again Vincenzo |
|
February 2, 2017, 06:34 |
|
#7 |
Member
Bas Nieuwboer
Join Date: Mar 2013
Posts: 34
Rep Power: 13 |
The blendingfactor works during the whole simulation. So you have a permanent damping region.
I've used the funkysetfields for creating the blend factors, because it was the easiest way to create a field for me. |
|
February 2, 2017, 06:50 |
|
#8 |
New Member
|
This is a really good news!! Thank you so much Bas!
Best Regards Vincenzo |
|
Tags |
localblended ; les |
|
|
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 03:50 |