|
[Sponsors] |
December 13, 2011, 12:49 |
To create a species name file for chemFoam
|
#1 |
Member
Ayhan Eses
Join Date: Mar 2009
Posts: 35
Rep Power: 17 |
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. |
|
April 11, 2012, 11:35 |
|
#2 |
Member
Hagen Müller
Join Date: Nov 2010
Posts: 34
Rep Power: 15 |
Did you try Y.size() instead of a fixed value? This should give you the number of species.
Best, Hagen |
|
January 24, 2014, 08:49 |
|
#3 | |
Member
Ayhan Eses
Join Date: Mar 2009
Posts: 35
Rep Power: 17 |
Quote:
Code:
int speciesname; // for (int speciesname=0; speciesname<=3; speciesname++) for (int speciesname=0; speciesname<=Y.size(); speciesname++) { |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |