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

Variable diffusion coefficient for scalar transport in interFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 1 Post By bigphil
  • 4 Post By amwitt

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   September 5, 2013, 20:11
Default Variable diffusion coefficient for scalar transport in interFoam
  #1
New Member
 
Adam
Join Date: Mar 2012
Location: St. Paul, MN
Posts: 12
Rep Power: 14
amwitt is on a distinguished road
Hi all,

I am looking to add a variable diffusion coefficient to an advection diffusion equation I added in interFoam to model mass transport in turbulent free surface flows. The coefficient should be weighted based on the value of alpha1 in each cell, i.e. D = Dl*alpha1+Dg*(1-alpha1) where Dl and Dg are scalars. It should also include the addition of turbulent diffusion if alpha1 does not equal 0 or 1, i.e. not at an interface.

I included the following in the createFields.H header:

Code:
dimensionedScalar Dl
    (
        twoPhaseProperties.lookup("Dl")
    );

    dimensionedScalar Dg
    (
        twoPhaseProperties.lookup("Dg")
    );
I then created a volScalarField for D in createFields.H as :

Code:
Info<< "Reading field D\n" <<endl;
    volScalarField D
    (
      IOobject
      (
         "D",
         runTime.timeName(),
         mesh,
         IOobject::NO_READ,
         IOobject::AUTO_WRITE
      ),
       (Dl*alpha1+Dg*(scalar(1)-alpha1))
      );
Finally, I added the following to the CEqn.H file, which contains the transport equation:

Code:
volScalarField Dt = D+(turbulence->nut())/(scalar(0.7));

forAll(D, cellI)
   {
   if
   (
     alpha1[cellI]==scalar(1)
     ||
     alpha1[cellI]==scalar(0)
   )
      {
       D[cellI] = Dt[cellI];
      }
   }


    fvScalarMatrix CEqn
    (
         fvm::ddt(C)
         +fvm::div(phi,C)
         -fvm::laplacian(fvc::interpolate(D),C)
    );

    CEqn.solve();
Everything compiles and seems to run well. However, when I check the values of D, they aren't matching what I expect. In areas where alpha1=1 or 0, I am getting values of D that include turbulent diffusion. It's not clear to me why this is happening. Additionally, the D values shown in paraview look like they are not progressing in time. It appears they are adding to the existing D field each time step. However, the C values are clearly impacted by diffusion. What I want to do is change D each time step based on alpha1 values in each cell and write the results to the time directory to ensure I'm calculating correctly. Any advice on where I'm going wrong is appreciated.

Thanks,
Adam

Last edited by amwitt; September 6, 2013 at 10:58.
amwitt is offline   Reply With Quote

 

Tags
interface, interfoam, mass transfer, scalar transport


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
inlet diffusion at the species transport ahchoo FLUENT 1 May 8, 2017 00:19
diffusion Term for add. Variable Zaktatir CFX 9 July 16, 2011 09:51
Latest git 1.6.x: Crash when using inletOutlet for variable alpha1 in interFoam carsten OpenFOAM Bugs 6 September 23, 2009 09:46
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 04:27
Source terms for additional variable transport eqn Nandini Rohilla CFX 0 February 6, 2004 13:38


All times are GMT -4. The time now is 08:03.