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

Adding CO2 Mole Fraction to buoyantBoussinesqPimpleFoam

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 7, 2013, 18:46
Default Adding CO2 Mole Fraction to buoyantBoussinesqPimpleFoam
  #1
NJG
Member
 
Nick Gutschow
Join Date: Jan 2013
Posts: 36
Rep Power: 13
NJG is on a distinguished road
Hello Community,

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.

-NG
NJG is offline   Reply With Quote

Old   February 7, 2013, 19:14
Default
  #2
NJG
Member
 
Nick Gutschow
Join Date: Jan 2013
Posts: 36
Rep Power: 13
NJG is on a distinguished road
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.

-NG
NJG is offline   Reply With Quote

Old   February 8, 2013, 10:18
Default
  #3
NJG
Member
 
Nick Gutschow
Join Date: Jan 2013
Posts: 36
Rep Power: 13
NJG is on a distinguished road
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...

In Review:

(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.

New Questions:

(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!
NJG is offline   Reply With Quote

Old   February 11, 2013, 05:12
Default
  #4
Senior Member
 
Olivier
Join Date: Jun 2009
Location: France, grenoble
Posts: 272
Rep Power: 17
olivierG is on a distinguished road
hello,

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 ?

regards,
olivier
olivierG is offline   Reply With Quote

Old   February 11, 2013, 07:33
Default
  #5
NJG
Member
 
Nick Gutschow
Join Date: Jan 2013
Posts: 36
Rep Power: 13
NJG is on a distinguished road
Oliver,

1-4: Thanks!

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.

http://www.cfd-online.com/Forums/ope...tml#post407038

Best,
NG
NJG is offline   Reply With Quote

Reply


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
Mass Fraction and Mole Fraction don't tie up KieranHegarty FLUENT 1 February 28, 2015 10:22
Water subcooled boiling Attesz CFX 7 January 5, 2013 03:32
On the damBreak4phaseFine cases paean OpenFOAM Running, Solving & CFD 0 November 14, 2008 21:14
CFX Solver Memory Error mike CFX 1 March 19, 2008 07:22
For a correct the mole fraction ... kevin FLUENT 0 April 9, 2002 04:39


All times are GMT -4. The time now is 21:44.