CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

tableProperties.lookup(Y[i].name()) problem when run my case

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

Reply
 
LinkBack Thread Tools Display Modes
Old   December 12, 2013, 04:30
Default tableProperties.lookup(Y[i].name()) problem when run my case
  #1
Member
 
赵庆良
Join Date: Aug 2013
Posts: 56
Rep Power: 4
zqlhzx is on a distinguished road
Hi foamer,
The following is my codes in my readTableProperties.H and it can be compiled successfully with my solver.
Code:
Info<< "Reading table properties\n" << endl; 
    IOdictionary tableProperties 
    ( 
        IOobject 
        ( 
            "tableProperties", 
            runTime.constant(), 
            mesh, 
            IOobject::MUST_READ, 
            IOobject::NO_WRITE 
        ) 
    );
FieldField<Field,scalar> tspecies(19); 
    for (label i=0; i<Y.size(); i++) 
    { 
                  scalarField A(tableProperties.lookup("Y[i].name()")); 
                  tspecies[i]=A; 
    }
What I'd like to ask is something about "(tableProperties.lookup("Y[i].name()")".In my tableProperties ,it is :
Code:
FoamFile
{
version     2.0;
format      binary;
class       dictionary;
location    "constant";
object      tableProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 

CH4
(
0.0000    0.0120    0.0240    0.0360    0.0480    0.0060    0.0720    0.0840    0.0960    0.1080
0.1200    0.1320    0.1440    0.1560    0.1680    0.1800    0.1920    0.2040    0.2160    0.2280
0.2400    0.2520    0.2640    0.2760    0.2880    0.3000    0.3120    0.3240    0.3360    0.3480
0.3600    0.3720    0.3840    0.3960    0.4080    0.4200    0.4320    0.4440    0.4560    0.4680 
0.4800    0.5000    0.5250    0.5500    0.5750    0.6000    0.6250    0.6500    0.6750    0.7000
0.7250    0.7500    0.7750    0.8000    0.8500    0.9000    0.9500    1.0001
);
O2
(
0.0000    0.0120    0.0240    0.0360    0.0480    0.0060    0.0720    0.0840    0.0960    0.1080
0.1200    0.1320    0.1440    0.1560    0.1680    0.1800    0.1920    0.2040    0.2160    0.2280
0.2400    0.2520    0.2640    0.2760    0.2880    0.3000    0.3120    0.3240    0.3360    0.3480
0.3600    0.3720    0.3840    0.3960    0.4080    0.4200    0.4320    0.4440    0.4560    0.4680 
0.4800    0.5000    0.5250    0.5500    0.5750    0.6000    0.6250    0.6500    0.6750    0.7000
0.7250    0.7500    0.7750    0.8000    0.8500    0.9000    0.9500    1.0001
);
CO2
(
0.0000    0.0120    0.0240    0.0360    0.0480    0.0060    0.0720    0.0840    0.0960    0.1080
0.1200    0.1320    0.1440    0.1560    0.1680    0.1800    0.1920    0.2040    0.2160    0.2280
0.2400    0.2520    0.2640    0.2760    0.2880    0.3000    0.3120    0.3240    0.3360    0.3480
0.3600    0.3720    0.3840    0.3960    0.4080    0.4200    0.4320    0.4440    0.4560    0.4680 
0.4800    0.5000    0.5250    0.5500    0.5750    0.6000    0.6250    0.6500    0.6750    0.7000
0.7250    0.7500    0.7750    0.8000    0.8500    0.9000    0.9500    1.0001
);
H2O
(
0.0000    0.0120    0.0240    0.0360    0.0480    0.0060    0.0720    0.0840    0.0960    0.1080
0.1200    0.1320    0.1440    0.1560    0.1680    0.1800    0.1920    0.2040    0.2160    0.2280
0.2400    0.2520    0.2640    0.2760    0.2880    0.3000    0.3120    0.3240    0.3360    0.3480
0.3600    0.3720    0.3840    0.3960    0.4080    0.4200    0.4320    0.4440    0.4560    0.4680 
0.4800    0.5000    0.5250    0.5500    0.5750    0.6000    0.6250    0.6500    0.6750    0.7000
0.7250    0.7500    0.7750    0.8000    0.8500    0.9000    0.9500    1.0001
);
(In fact,the values in different species is different.I just show it as example).It should be that Y[0].name()=CH4,Y[1].name()=O2.Y[2].name()=CO2,Y[3].name()=H2O. I want to make "scalarField A" is equal to the values for different species.
So lookup (Y[i].name).
If I use
Code:
scalarField A(tableProperties.lookup("CH4"))
it can work,and my case can run.However,if I use
Code:
scalarField A(tableProperties.lookup("Y[i].name()"))
then I run my case ,it give me error:
Quote:
keyword Y[i].name() is undefined in dictionary "/home/acer/OpenFOAM/acer-2.2.2/run/singlefirepoolx/constant/tableProperties"
Then I get rid of the "" like:
Code:
scalarField A(tableProperties.lookup(Y[i].name()))
it still gave me error:
Quote:
FOAM FATAL ERROR:
hanging pointer at index 0 (size 19), cannot dereference

From function PtrList:perator[]
in file /opt/openfoam222/src/OpenFOAM/lnInclude/PtrListI.H at line 150.
FOAM aborting
How can I modify my codes above to make case run ?Could you give me some advises?Thank you !
zqlhzx is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
use batch mode to run an unsteady case PaulineP FLUENT 6 September 16, 2014 17:26
Big Difference Between Serial run and Parallel run case alundilong OpenFOAM Programming & Development 1 March 20, 2013 16:52
Problem with 0012 simple case Tetragramm OpenFOAM Native Meshers: blockMesh 3 June 20, 2012 03:44
problem when I run the case Rui CD-adapco 1 February 1, 2007 07:25
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24


All times are GMT -4. The time now is 19:35.