CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Scalar Transport Equation with a source term using functionObjects and fvOptions

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 3, 2021, 14:50
Default Scalar Transport Equation with a source term using functionObjects and fvOptions
  #1
Member
 
Mohammad M F
Join Date: Jan 2016
Location: Washington DC, USA
Posts: 43
Rep Power: 10
mmohaqeqf is on a distinguished road
Hey all;
I want to run simpleFoam on a simple converging pipe (laminar and Newtonian) and at the same time add a scalar transport equation with a constant source term in the controlDict.
Note that the scalar transport field is called D (which I set to be dimensionless), with zero diffusion (so it is a pure convection problem), and the source term is intended to be applied at the entire domain (all the cells generate the same constant source value). Also note that for future steps, I need to have a source term which is a function of another field variable (say for example source = sqrt(U)/3 at each cell), but for now I need to start with a simple case of a constant source to get things started.



Here is my function object section along with the fvOption in my controlDict:


Code:
functions
{
    DTransport
    {
      type            scalarTransport;
      libs            ("solverFunctionObjects.so");
      resetOnStartUp  no;
      field                  D;
      schemesField     U;

      fvOptions
      {
        fixedSource
        {
         type        scalarFixedValueConstraint;
         enabled     true;

         scalarFixedValueConstraintCoeffs
         {
           selectionMode   all;
           volumeMode      specific;

           fieldValues
           {
             D             1;
           }
         }
       }
      }
    }
}
Then, I know I have to have a D file in my 0 folder, which is as follows:


Code:
dimensions      [0 0 0 0 0 0 0];


internalField   uniform 0;

boundaryField
{
     inlet
     {
         type            fixedValue;
         value           uniform 0;
     }

    outlet
    {
        type            zeroGradient;
    }

    wall
    {
        type            zeroGradient;
    }
}
When I run it, simpleFoam runs without an error; it also give a message about the source term, which indicates it understands what I want:


Selecting finite volume options type scalarFixedValueConstraint
Source: fixedSource
- selecting all cells
- selected 60152 cell(s) with volume 2.174888003341e-06


When simulation is complete, I get a D file in each time folder, which is basically the same as the D file in 0 folder, except that



Code:
 internalField   uniform 1;
which I think means that the source term is working (right?)

But then, I get another file called phi in each time folder, which is a surfaceScalarField with the unit of [0 3 -1 0 0 0 0], which I don't know anything about.


Can anyone help me find out what this phi is?


Also, what steps should I take to have a more complicated source term (e.g. that is a function of a field variable)?



Thanks
mmohaqeqf is offline   Reply With Quote

 


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



All times are GMT -4. The time now is 14:52.