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

Reading input matrix in a solver

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

Reply
 
LinkBack Thread Tools Display Modes
Old   October 1, 2012, 06:34
Default Reading input matrix in a solver
  #1
New Member
 
Simon Tornros
Join Date: Aug 2012
Posts: 2
Rep Power: 0
tsimon is on a distinguished road
Hi! I would like to get input from a case file (we could call this file someProperties located in constant dir). The information to be read should be scalars in a 10x19 matrix. How could this be performed in OF (1.6-ext and simpleFoam, if it matters).

Should the matrix be declared as:
int myMatrix[10][19];

and if so, how do I read the someProperties file to get the values into "myMatrix"?

Best regards, tsimon.
tsimon is offline   Reply With Quote

Old   October 1, 2012, 08:33
Default
  #2
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 5
treima is on a distinguished road
Hi,

you can define matrices this way:

Matrix<scalar,scalar> matrix(19,10);

With matrix[i][j] you can grab the elements. Now you have to find a nice way to read your elements from files. This depends on your data.


regards
treima
treima 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
problem when converting mesh (made by ICEM) using fluentMeshToFoam Forrest_Lei OpenFOAM 11 October 16, 2009 06:28
Matrix solver Yang Main CFD Forum 5 May 13, 2006 22:20
solver input file ioana CFX 1 March 2, 2004 20:01
compressible two phase flow in CFX4.4 youngan CFX 0 July 1, 2003 23:32
solver for linear system with large sparse matrix Yangang Bao Main CFD Forum 1 October 25, 1999 04:22


All times are GMT -4. The time now is 22:54.