- **CD-adapco**
(*https://www.cfd-online.com/Forums/cd-adapco/*)

- - **Mole fractions from mass fractions?
**
(*https://www.cfd-online.com/Forums/cd-adapco/53016-mole-fractions-mass-fractions.html*)

Mole fractions from mass fractions?
I am doing some combustion analysis, and I would like to know if there is an easy way to display mole fractions of species rather than mass fractions? Seems rather silly to do it by hand, and I feel like there must be an easier way.
Keith |

Re: Mole fractions from mass fractions?
Keith,
If you've got the mass fractions and the molar wheights of the individual mixture components, you can find the mixture molar wheight. The mole fraction of a species then equals its mass fraction multiplied by its molar wheight and divided by the molar wheight of the mixture. The operate command in PROSTAR allows you to do calculations on entire post registers. Check the PROSTAR help dialogue on how to do the manipulation in practice. Regards, Lars Ola |

Re: Mole fractions from mass fractions?
Maybe I am dense, but it doesn't seem quite that simple. Since I am dealing with a combustion process, I don't believe there is a "single" mixture molar weight. So don't I need to compute the molar weight of each cell, then compute the mole fraction based on the mass fractions in each cell and the "cell molar weight"? If so, this gets rather tedious. Am I looking at some type of POSDAT routine?
Thanks. Keith |

Re: Mole fractions from mass fractions?
Keith,
Maybe you're right that a POSDAT routine would be more convenient. However, if you already have some results that you want to postprocess, I think it's possible to do in PROSTAR, and probably not even difficult (I haven't tried myself yet). Using the ideal gas law, you can calculate the mixture molar mass of a cell from its mass, volume, pressure, temperature, and the universal gas constant. Then you can calculate the molar fraction as I described earlier. To do this for the whole domain in PROSTAR would require a few successive OPERATE commands, but when you've done this once, it's easy to paste it into a script, and then you never have to worry about it again. Good luck! Lars Ola |

Re: Mole fractions from mass fractions?
Thanks for the help. Your suggestion works fine, though it is rather cumbersome. But I did notice one problem: I wrote some data using the oper,write command to a CODED file. Then when I look at this file, it looks OK. But when I try to read this file back in, using the oper,getu,filename,cell,ireg,code command the data does not load with the proper values. In fact, except for the first few entries, all are 0. What am I doing wrong?
Thanks again. Keith P.S. I was trying this so that I could write a small Fortran program outside of Star to handle the conversions, and then read the data into Star in order to plot contours. |

Re: Mole fractions from mass fractions?
I'm afraid you already outclassed me. I've never done anything like what you're trying to do. Perhaps you ought to have a chat with technical support?
Lars Ola |

All times are GMT -4. The time now is 07:39. |