CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

fvOptions fix field using field

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 20, 2019, 10:26
Default fvOptions fix field using field
  #1
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,675
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
OF 2.4.x

It is quite easy to fix the values of a field to a set scalar/vector by using fvOptions. E.g., I can set the value of b to be uniform everywhere all the time to the value 1 by using:


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

banana
    {
    type            scalarExplicitSetValue;
    active          true;
    selectionMode   all;
    scalarExplicitSetValueCoeffs
    {
        injectionRate
        {
            b      1;
        }
    }
    }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
I have run a case where I have calculated the temporal average of b using fieldAverage and now I want to fix b all the time to bMean. How would this be done? I.e. an implementation that looks something like this...


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

coldCase
    {
    type            scalarExplicitSetValue;
    active          true;
    selectionMode   all; // points; cellSet; cellZone; all;
    scalarExplicitSetValueCoeffs
    {
        injectionRate
        {
            b      $bMean;
        }
    }
    }
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Yes this obviously is equivalent to skipping the solution of an equation (but that requires rebuilding the solver which might break other things because b is coupled to other stuff).
LuckyTran is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[swak4Foam] problems with averaging a new field fgarita OpenFOAM Community Contributions 1 October 28, 2016 03:27
velocity field of MRF, GGI and rotatingWallVelocity tonky OpenFOAM Programming & Development 1 October 14, 2016 11:04
[General] How to create an additional vector with {Field 4, Field 5, Field 6} Bombacar ParaView 1 August 15, 2015 18:05
''unknown radialModelType type Gidaspow'' PROBLEM WITH THE BED TUTORIAL AndoniBM OpenFOAM Running, Solving & CFD 2 March 25, 2015 18:44
How to fix a value in the buoyanPimpleFoam solver? samiam1000 OpenFOAM 13 April 5, 2012 04:09


All times are GMT -4. The time now is 17:41.