|
[Sponsors] |
OpenFoam - concentration - variable for specie |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 25, 2014, 04:17 |
OpenFoam - concentration - variable for specie
|
#1 |
New Member
MK
Join Date: Oct 2014
Posts: 6
Rep Power: 12 |
Hi,
I like to calculate the concentration of an exhaust gas. I have one main inlet for air with a low temperature and 5 smaller inlets for air with a higher temperature. So I would like show and plot the concentration of the air which is coming out of the smaller inlets. So this is no multiphase model. I know in CFX that you can easy specify a variable with a transport equation and set this one for example to 0 at the main inlet and to 1 at the smaller inlet. Is there a similar way in OpenFoam. I couldn't find something like this. Could please someone of you help me out. cheers, MK. |
|
November 26, 2014, 07:00 |
|
#2 |
Senior Member
|
Hi,
This can be done with the scalarTransport functionObject. Code in controlDict (within the functions subDict): Code:
Tracer { type scalarTransport; functionObjectLibs ("libutilityFunctionObjects.so"); outputControl outputTime; active true; autoSchemes false; nCorr 0; resetOnStartUp false; fvOptions { } } Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.x | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; object Tracer; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 0; boundaryField { ".*" { type zeroGradient; } Exhausts { type fixedValue; value uniform 1; } Main_Inlet { type fixedValue; value uniform 0; } Outlet { type inletOutlet; inletValue uniform 0; value uniform 0; } } // ************************************************************************* // |
|
November 26, 2014, 07:48 |
|
#3 |
New Member
MK
Join Date: Oct 2014
Posts: 6
Rep Power: 12 |
Hi Tom,
thank you very much! It works really fine. MK. |
|
May 13, 2015, 06:54 |
|
#4 |
Member
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11 |
Hi Foamers,
Sorry for restarting the thread again. .I m new to species transport simulations. I read a lot of treads in cfd online. i m trying to simulate CO2 emission from human. so i m using scalar transport function utility. first i tried this Code:
S { type scalarTransport; outputControl outputTime; DT 14e-6; userDT true; resetOnStartUp false; autoSchemes true; fvOptions { S-01 { type scalarExplicitSetValue; active true; selectionMode cellZone; cellZone sampleInlet; scalarExplicitSetValueCoeffs { injectionRate { S 0.01; //kg/s } } } }; } Then i saw your thread . then i tried this Code:
S { type scalarTransport; outputControl outputTime; DT 14e-6; userDT true; resetOnStartUp false; autoSchemes true; fvOptions { }; } Code:
FoamFile { version 2.0; format ascii; class volScalarField; object S; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 0; boundaryField { ".*" { type zeroGradient; } man2new { type fixedValue; value uniform 0.01; } } the question i have is why there is no dimensions specified? When i specify kg/s ,[1 0 -1 0 0 0 0] i m getting an error. could someone please help me. 2. which of the above two procedure is correct? 3. is it the correct way to simulate co2 emission from a human body.(no reaction) I m using OF 2.3.0 and buoyantboussinesqsimpleFoam. Thank you Best Regards, Naresh |
|
May 15, 2015, 07:21 |
|
#5 |
Senior Member
|
Hi Naresh,
With the scalarTransport functionObject you are just following a scalar through your domain as it is being advected and diffused with the flow. So it is the equivelant of dye being released in water. This part: Code:
fvOptions { S-01 { type scalarExplicitSetValue; active true; selectionMode cellZone; cellZone sampleInlet; scalarExplicitSetValueCoeffs { injectionRate { S 0.01; //kg/s } } } }; This part: Code:
FoamFile { version 2.0; format ascii; class volScalarField; object S; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField uniform 0; boundaryField { ".*" { type zeroGradient; } man2new { type fixedValue; value uniform 0.01; } } You can think about the first option as a constant volumetric heating, while the second option is like injecting hot air at a constant temperature. For your questions: 1. There is no real need for dimensions, but you can do it if you want. You can solve for kg or concentration, but not kg/s, however you can inject something per second. 2. I would use option 2 with: dimensions [1 0 0 0 0 0 0]; (I think the time is the one giving you the error, however, it is just a specification, if it does not work, you can keep the dimensions [0 0 0 0 0 0 0]; this does not change your result. 3. With this approach you are neglecting the change in density caused by the difference in species concentration. If the CO2 content is low and the velocity is high this can be a good assumption. If it is not you may need to use one of the reactingFoam family of solvers with reactions turned off. Regards, Tom |
|
May 15, 2015, 09:41 |
|
#6 | |
Member
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11 |
Hi Tom,
thanks for your detailed reply. it almost cleared all my doubts and now i have one basic doubt (mass conservation) but i might sound silly. Quote:
if i say i m simulating a mass source in the domain. the patch man2new generating the same air Code:
dimensions [1 0 0 0 0 0 0]; internalField uniform 0; boundaryField { ".*" { type zeroGradient; } man2new { type fixedValue; value uniform 2; } } Code:
MassFlows: outlet = 0.057125518 inlet = -0.057121114 scalarTransport output: DILUPBiCG: Solving for S, Initial residual = 0.00041745404, Final residual = 7.9045899e-07, No Iterations 2 regards, naresh |
||
May 15, 2015, 10:17 |
|
#7 |
Senior Member
|
Hi Naresh,
I think you are missing one point: The scalar "S" does not change anything in the solution of your flow. It is a passive scalar, so it is in fact massless, but it acts as something that allows you to visualize concentration levels on different locations in the domain. It is just coloring some area and see how this color is moving along with the flow. With buoyantBoussinesqSimpleFoam you are solving for the steady state incompressible turbulent buoyant flow of a single species gas. You can use the scalarFunctionObject as a first approximation of how a different species would spread through that flow if it were injected at a certain location, think about massless smoke/dye/ink. Regards, Tom |
|
May 15, 2015, 14:02 |
|
#8 |
Member
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11 |
Thanks for the quick reply tom,
you are right. I missed the basic definition of a passive scalar i was confused by http://www.openfoam.org/version2.1.0/numerics.php field source: scalarExplicitSources scalarExplicitsourceCoeff it turns out that they dont exist in 2.3.0 or may be renamed as scalarsemiImplicitsources, i m not sure. please correct me if i m wrong. utility "scalar transport" cannot affect the flow. if i have a volumetric heat source (T=500K defined using scalar transport) that does not influence the temperature of the domain but i could only visualize the convection and diffusion of the source . This might be a fundamental question. regards, Naresh |
|
May 16, 2015, 12:17 |
|
#9 |
Senior Member
|
I am not sure about renaming of the sources, but this may have happend.
You are right about the last part. Have a nice weekend. |
|
May 17, 2015, 06:16 |
|
#10 |
Member
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11 |
Thank you tom. you too have a nice weekend.
|
|
May 19, 2015, 09:08 |
|
#11 | |
Member
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11 |
Hi Tom,
I did some simulation with the scalasemiimplicit sources. the results are not bad. I could not specify a mass source in the domain. so i want to use reationFoam with no combustion and reaction. Quote:
1. reactionFoam is a compressbile solver. but my case is incompressible. do i have to change something or can i use a compressible solver for incompressible simulation? 2. so I thought of using TwoliquidmixingFoam which is incompressible,steady state but it does not consider heat transfer. I can add temperature to the solver but i m not sure if it would give a better result. Could you give your suggestions on this? Or any other easier way if u know any . Thankyou Regards, Naresh |
||
May 19, 2015, 09:31 |
|
#12 |
Senior Member
|
Hi Naresh,
1. Incompressible flow is a limit to compressible flow where you have a fixed density. So this is a valid assumption if your density variations are small. However you can always solve for compressible flow even if there are very small density variations. It may not be the most efficient, but it should be more accurate. 2. I am not entirely sure about the possibility of using this solver for your problem. Also it is not steady-state. I have not used this solver and I am not completely familiar with it's range of applications. Regards, Tom |
|
November 23, 2015, 05:53 |
|
#13 |
Member
Robert Ong
Join Date: Aug 2010
Posts: 86
Rep Power: 16 |
Hi All,
I'm currently working on modelling pollutant (NOx, SOx, ppm) dispersion of in a busway region. After getting the atmospheric boundary layer (ABL) sorted out, I have a few questions of how to go with this: 1. Is scalar transport suitable for this type of problem? or should I introduce a vector inlet from the source (bus) which can't be done using scalar transport? I'd imagine because the gases diffusivities will be low and advection will be the dominant process 2. How can I specify the diffusivity value inside the controlDict function? since it's not specified in transport properties? 3. I also like to specify a different concentration values for each gases, should I create a patch for the bus or can it be just done using cellZone (which is what I'm using now)? Any replies will be much appreciated. Kind regards, Robert |
|
November 25, 2015, 08:39 |
|
#14 |
Member
Victor Koppejan
Join Date: May 2015
Posts: 40
Rep Power: 11 |
Has anyone ever tried this with multiphase solvers such as twoPhaseEulerFoam? If so, how did you link the scalar transport eqn to the right phase?
@ rob3rt 0ng 1. This is a passive scalar, so uncoupled transport wrt to the flow mass, momentum and energy equations. This seems valid for such low amounts of polution. However, for accuracy in the solver I would normalize the concentrations using a source or inlet concentration. 2. Check Naresh yathuru's post on the 13th of May. 3. Not sure what you mean by this. Sources and BC's require the definition of a patch or cellZone but there are multiple ways to do this. Btw, multiple species require multiple species transport eqns. |
|
November 25, 2015, 13:38 |
|
#15 |
Member
Victor Koppejan
Join Date: May 2015
Posts: 40
Rep Power: 11 |
Ok I found out how to do use this for multiphase systems.
FYI, I'm modelling a liquid-solid fluidized bed, laminar flow for both phases. To add scalarTransport follow these steps: 1: Add the the following code to the controlDict Code:
functions { Tracer { type scalarTransport; functionObjectLibs ("libutilityFunctionObjects.so"); outputControl outputTime; active true; autoSchemes false; nCorr 0; resetOnStartUp false; fvOptions { } phiName phi.water; UName U.water rhoName rho.water DT 1e-9; userDT true; } } (of course feel free to use another scheme) Code:
div(phi,Tracer) Gauss limitedLinear 1; Code:
Tracer { solver PBiCG; preconditioner none; tolerance 1e-6; relTol 0; minIter 1; } http://www.cfd-online.com/Forums/ope...oam-of231.html and allows you to solve systems with zeros on the diagonal (as you would get in area's where there is no tracer). Finally you need to provide a file with tracer initial and BC's in the zero folder. That shoud do the trick, please let me know if I've forgotten to add anything. I'm planning on adapting the scalarTransport object to allow for more complex use of dilute species transport (maybe some simple mass transfer etc). No idea when it will be done but I'll get back to you. |
|
November 26, 2015, 05:40 |
|
#16 |
Member
Robert Ong
Join Date: Aug 2010
Posts: 86
Rep Power: 16 |
Hi Victor,
Thanks for the reply. Please also share the dilute transport case file if you have it ready ;-) Just to clarify one thing: if I specify the real diffusivity value (m2/s) and its emission rate (kg/s), shouldn't I end up with the real concentration that doesn't need to be normalised? Can this be done in using scalarExplicitSetValue as a subfunction in controlDict or should I run this after I get the steady-state BC and use scalarTransportFoam as in the pitzDaily tutorial? Kind regards, Robert |
|
November 26, 2015, 05:52 |
|
#17 |
Member
Victor Koppejan
Join Date: May 2015
Posts: 40
Rep Power: 11 |
Hi Robert,
I think this really depends on the concentrations of the species, you mentioned earlier that they were in the ppm range. I have to admit that I'm not sure how OpenFOAM handles this but I'm always a bit weary of scalars with values in the range of the tolerance settings. Also for, should you want to use a limiter scheme, having a scalar between 0 and 1 can be benificial. Since the transport eqn is uncoupled , the diffusivity is constant, and were assuming Ficks Law, you should be able to transform the results in paraview to match the real life concentrations. As always these things are case specific, perhaps you can share your findings. Cheers, Victor |
|
November 26, 2015, 08:54 |
|
#18 |
Member
Knut Erik T. Giljarhus
Join Date: Mar 2009
Location: Norway
Posts: 35
Rep Power: 22 |
Just one comment on the use of scalarTransportFoam. As it is now, turbulent diffusion is not included in the solver, only the molecular diffusion. For most industrial flows, turbulent diffusion is orders of magnitude higher than the molecular, and hence very important to include. Turbulent diffusion is not a constant, but a variable calculated as part of the flow solution from the turbulence model.
You need to modify the equation to something like this: Code:
fvm::ddt(T) + fvm::div(phi, T) - fvm::laplacian(DT + turbulence->nuEff()*1/Sc, T) |
|
November 30, 2015, 13:06 |
|
#19 | |
Senior Member
Join Date: Jul 2009
Posts: 260
Rep Power: 18 |
Quote:
Where is it you suggest to modify the equation? Does it mean making a separate solver etc? |
||
November 30, 2015, 23:53 |
|
#20 |
Member
Robert Ong
Join Date: Aug 2010
Posts: 86
Rep Power: 16 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
new variable output as a file in openfoam for Ensight plot | conceptone | OpenFOAM Post-Processing | 1 | February 18, 2014 15:54 |
Cannot configure OpenFOAM environment variable in CAE Linux 2011 | TommiPLaiho | OpenFOAM Installation | 9 | October 15, 2013 09:44 |
Problem in installation of OpenFOAM | sachin | OpenFOAM Installation | 7 | January 22, 2008 02:40 |
Installation problems | shellbell1999 | OpenFOAM Installation | 9 | April 6, 2006 14:29 |
OpenFOAM Training and Workshop Zagreb 2628Jan2006 | hjasak | OpenFOAM | 1 | February 2, 2006 22:07 |