CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (http://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   In reactingFoam, is there any way to normalize mass fractions in initial conditions? (http://www.cfd-online.com/Forums/openfoam-pre-processing/117451-reactingfoam-there-any-way-normalize-mass-fractions-initial-conditions.html)

goxberry May 8, 2013 15:26

In reactingFoam, is there any way to normalize mass fractions in initial conditions?
 
I'm using reactingFoam with OpenFOAM 2.2 to simulate a counterflow 2-D diffusion flame. One thing I'd like to do is run some studies on simulation run time scaling with number of species (with and without chemistry) for various chemical mechanisms. To make sure that all species are present in the simulation (again, to do a scaling analysis), I'd like to have the following species files as initial conditions:

- fuel species (e.g., H2, CH4, C3H8, etc.)
- O2
- N2
- Ydefault (for everything else)

The trouble is specifying the initial condition for Ydefault. For the inlet face of my geometry on the fuel side, I want a uniform boundary condition for each species, and I want the mass fractions for the fuel face to sum to one, since it appears that reactingFoam doesn't do any normalization of species mass fractions.

I could do this by hand and figure out the scalar mass fraction I need to plug into Ydefault pretty easily (it would be (1 - (mass fraction of fuel species on fuel face)) / (total # of species - 3)), but I'd prefer to automate this calculation within OpenFOAM, if possible.

Is there any way to do this automatically using a command line tool, or the codeStream directive? I don't mind having to change a small bit of code per case study, but it would be annoying to have to do the whole thing by hand, and before I decide to roll my own Python script, I want to see if there is an easier way.


All times are GMT -4. The time now is 02:09.