Adding CO2 Mole Fraction to buoyantBoussinesqPimpleFoam
I am presently in the middle of trying to alter the bouyantBoussinesqPimpleFoam solver (I will call this the "reference solver" below) to handle not only convective heat transfer but changes in air composition as well. The idea is to treat things as incompressible in the typical way the Boussinesq approximation does with density only affecting buoyant body forces but have this buoyant force be the result of density change both from temperature change and CO2 mole fraction. I want to model a single occupant within a closed room breathing out warm relatively CO2 rich air.
Things so far are more or less coming along. I basically just copied the base solver and started making my own additions. For a first attempt, I am just duplicating the relationships for thermal diffusivity as molecular diffusivity follows pretty much identical forms. As such I have added x, Dx, and Dxt variables to match the T, kappa, and kappat for temperature. I also created a new wall function just like the kappatJayatillekeWallFunction but for Dxt (based on the Schmidt number, turbulent and laminar). I have added a molecular diffusion equation. Etc. etc.
So, I have a bunch of questions, but I will just start in the middle with what I am dealing with now.
Looking in the reference solver tutorial files, I have a T.org file in the 0 folder as well as a T file. The T file has a long list of temperature values, one for every finite volume if I understand correctly. My first question is a) how do I populate this T file with initial values without actually going through and adding them all by hand (my final run case will have ~10^6 volumes, so that would suck), and b) what is T.org and is it related to this?
A follow up question is that I plan to have an x (CO2 mole fraction) file just like I have a T file. Would I also need an x.org file then, too?
Thanks for the help! If I get this running I will make it available to anyone interested in playing with it.
I should also add that I have created relevant .H files for xEq and other such things as needed, added stuff to trasnportProperties (though I may have some questions about that down the road), and so on.
Ok, I am going to start numbering these questions to make it easier for folks to send me helpful answers to some subset of this conversation. Also I have made some progress on my previous question but would love some feedback still. So...
(1) How do I initialize my T values (i.e. populate my T file in the 0 folder)?
Possible Answer: I have since just removed the list and changed the whole thing to "internalField uniform 300;" which I am guessing just sets the initial value of all volumes to be 300 degrees.
(2) What is T.org?
Possible Answer: Looking again, T.org seems to be the file I created as my possible answer to question (1) above. But I still don't understand why this is in there or know if OpenFOAM even uses this file.
(3) What about initializing x (mole fraction of CO2)?
Possible Answer: I just used the same internalField approach as for T, but in this case used 400e-6 to signify an initial value of 100 ppm.
(4) Do I need an x.org file?
Comments: See my possible answer to (2) above; I still don't know what if anything these .org files do.
(5) as mentioned, I created new wallFunction .H and .C files for mole fraction called "DxtJayatillekWallFunctionFvPatchScalarField" modeled after the kappat files of nearly the same name for temperature. I placed them within my home folder as follows: <user>/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/wallFunctions/DxtJayatillekWallFunctionFvPatchScalarField. Once again, this copies the source tree placement of the kappat wall function I am formally copying. But, when I try to run my model it gives me a "FOAM FATAL IO ERROR: unknown patchField type DxtJayatillekeWallFunction for patch type wall" and then goes on to list valid types. My question then is how do I build or compile or whatever my new wallFunction so it gets on this list and usable?
Thanks again folks!
1): yes, using "internalField uniform 300;" is the way to go. You can also take a look at "setField" tool and setFieldDict (or funkySetFields from the swak4foam tools) if you don"t want uniform field.
2) T.org is just a copy of the T file. When you initialise/run your case, the T file will be filed with 300 for each cell, so this is not fun to edit a file of some Mbits. The T.org file will be untouched, so easier to modify.
3) same as 1)
4) you don"t need x.org, unless you want a clean copy.
5) you seems do to some complicated stuff. Why you don"t just add a scalar without modify boundary conditions ?
5) Yes, it is a little complicated, but just as buoyantBoussinesgPimpleFoam uses a derived patch to handle the thermal diffusivity near the wall (as it is my understanding that k epsilon models perform poorly near walls), similarly it seems if I want to add mass diffusivity I need a wall function for that as well.
I am actually really close on this one. I have a wall function written, I just can't seem to successfully run wmake for it. If you are curious of the details, I started an independent post to deal with it which outline my errors, my exact Make folder contents, and so on. It can be found at this link.
|All times are GMT -4. The time now is 16:33.|