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

To create a species name file for chemFoam

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Hagen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2011, 12:49
Arrow To create a species name file for chemFoam
  #1
Member
 
Ayhan Eses
Join Date: Mar 2009
Posts: 35
Rep Power: 17
ayhan515 is on a distinguished road
Dear Foamers,
i would like to create a a species name file for chemFoam
I put the codes below to createFields.H and it s ok it is working.

But i want to write all species name not first 4, so i need a variable to determine "number of species"

the problem is
how can i use nSpecie_ or nSpecie () or something like that.

Thanks in advance.

Code:
int speciesname;
    for (int speciesname=0; speciesname<=3; speciesname++)
    {
#include <iostream>
using namespace std;
fileName myDir = args.path();
word tracingFileName="speciesname.dat";
fileName myFile = myDir/tracingFileName;
std:: ofstream myStream(myFile.c_str(),ios_base::app);
myStream

<< Y[speciesname].name() << endl;

    }

Last edited by ayhan515; December 13, 2011 at 14:21.
ayhan515 is offline   Reply With Quote

Old   April 11, 2012, 11:35
Default
  #2
Member
 
Hagen Müller
Join Date: Nov 2010
Posts: 34
Rep Power: 15
Hagen is on a distinguished road
Did you try Y.size() instead of a fixed value? This should give you the number of species.
Best, Hagen
ayhan515 likes this.
Hagen is offline   Reply With Quote

Old   January 24, 2014, 08:49
Talking
  #3
Member
 
Ayhan Eses
Join Date: Mar 2009
Posts: 35
Rep Power: 17
ayhan515 is on a distinguished road
Quote:
Originally Posted by Hagen View Post
Did you try Y.size() instead of a fixed value? This should give you the number of species.
Best, Hagen
Thank you for Y.size()
Code:
int speciesname;
//    for (int speciesname=0; speciesname<=3; speciesname++)
    for (int speciesname=0; speciesname<=Y.size(); speciesname++)
    {
ayhan515 is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
[swak4Foam] GroovyBC the dynamic cousin of funkySetFields that lives on the suburb of the mesh gschaider OpenFOAM Community Contributions 300 October 29, 2014 19:00
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23
Where's the singularity/mesh flaw? audrich FLUENT 3 August 4, 2009 02:07
Results saving in CFD hawk Main CFD Forum 16 July 21, 2005 21:51
PHI file structure Eugene Phoenics 9 November 2, 2001 23:00


All times are GMT -4. The time now is 10:15.