# Adding diffusion term to interFoam transport equation

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes
 August 30, 2017, 05:01 Adding diffusion term to interFoam transport equation #1 Senior Member   Join Date: Nov 2009 Posts: 111 Rep Power: 13 Dear Foamers, I would like to add a diffusion term to the interFoam transport equation. Indeed, I want to simulate an air-hydrogen mixture and diffusion due to concentration gradient is normally significant for such mixture. So, here is my thought process of what to do. Since I have never modified an OpenFoam solver before, I want to be sure that thatI am understanding each step and that I am doing things correctly. So the current transport equation for (one of the two phases/components) equation in interFoam is found in alphaEqn.H and equals to : and I understand that in this equation has been simplified because it is a solver for incompressible fluids. I would like to add the diffusion due to concentration. Based on the generic transport equation : So I understand that for interFoam solver, I must somehow include the following term, assuming diffusion term is constant and remembering to divide by due to its simplification in interFoam equation sinceit is for incompressible fluids I copy/pasted the interFoam solver directory to a personal directory and I understand that the code for [/math] \alpha_1 [math] transport equation is found in alphaEqn.H and I assume I should do the following modification : Code:  if (MULESCorr) { fvScalarMatrix alpha1Eqn ( ( LTS ? fv::localEulerDdtScheme(mesh).fvmDdt(alpha1) : fv::EulerDdtScheme(mesh).fvmDdt(alpha1) ) + fv::gaussConvectionScheme ( mesh, phiCN, upwind(mesh, phiCN) ).fvmDiv(phiCN, alpha1) - fvm:: laplacian(Gamma1/rho1, alpha1) ); based on the code I found in scalarTransportFoam.C. Now in scalarTransportFoam.C: it is not fvm:: and not fv:: which is different than the current functions implemented in alphaEqn.H sclarTransportFoam is a .C file and not a .H file it is not fv:: but fvm:: Unfortunately, I do not master C language sufficiently nor OpenFoam structure/classes/functions to understand such subtleties and I would like to be sure I do the right thing and that I understand what I am doing. Also I see that for example, the function gaussConvectionScheme requires additional parameters to work Code:  fv::gaussConvectionScheme ( mesh, phiCN, upwind(mesh, phiCN) ).fvmDiv(phiCN, alpha1) and I don't know if such things are necessary for the function laplacian. Eventually I see that Code:  LTS ? fv::localEulerDdtScheme(mesh).fvmDdt(alpha1) : fv::EulerDdtScheme(mesh).fvmDdt(alpha1) must be some kind of management of variable types. I am not sure I have to manage this thing also for my added code sample ? Once alphaEqn.H is fine, I have to add the new constant to CreateFileds.H Code: Info<< "Reading transportProperties\n" << endl; immiscibleIncompressibleTwoPhaseMixture mixture(U, phi); volScalarField& alpha1(mixture.alpha1()); volScalarField& alpha2(mixture.alpha2()); const dimensionedScalar& rho1 = mixture.rho1(); const dimensionedScalar& rho2 = mixture.rho2(); const dimensionedScalar& Gamma1= mixture.Gamma1(); Thanks in advance for confirmation and support. Once those changes have been confirmed to be fine, I will pursue with the modifications of the OpenFoam dictionnaries as instructed in this tutorial tonnykz and the_ichthyologist like this. Last edited by Gearb0x; August 30, 2017 at 07:52.

 August 30, 2017, 05:37 #2 Member   Brian Willis Join Date: Mar 2011 Location: Cape Town, South Africa Posts: 58 Rep Power: 12 Dear GearB0x This seems like a case where interFoam, which uses interface compression and the MULES algorithm to decrease the effects of numerical diffusion at the interface between two immiscible phases, and probably will not be the ideal solver for the mixing of your two gases. Have you considered looking at a two phase Euler-Euler solver like twoPhaseEulerFoam or reactingTwoPhaseEulerFoam? Regards, Brian

 August 30, 2017, 07:51 #3 Senior Member   Join Date: Nov 2009 Posts: 111 Rep Power: 13 I want to use interFoam as a first step because it is a simpler solver i.e. incompressible, no heat transfer.

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode

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

 Similar Threads Thread Thread Starter Forum Replies Last Post cfdonline2mohsen OpenFOAM Programming & Development 15 February 16, 2017 09:55 adkar Main CFD Forum 5 May 23, 2016 17:31 styleworker OpenFOAM Programming & Development 2 September 3, 2014 21:24 m003020002 Fluent UDF and Scheme Programming 0 September 10, 2013 03:09 bernarde STAR-CCM+ 0 June 4, 2009 03:17

All times are GMT -4. The time now is 10:06.

 Contact Us - CFD Online - Privacy Statement - Top