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

Reading input matrix in a solver

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 1, 2012, 07: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, 09:33
Default
  #2
Member
 
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14
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 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
problem when converting mesh (made by ICEM) using fluentMeshToFoam Forrest_Lei OpenFOAM 11 October 16, 2009 07:28
Matrix solver Yang Main CFD Forum 5 May 13, 2006 23:20
solver input file ioana CFX 1 March 2, 2004 20:01
compressible two phase flow in CFX4.4 youngan CFX 0 July 2, 2003 00:32
solver for linear system with large sparse matrix Yangang Bao Main CFD Forum 1 October 25, 1999 05:22


All times are GMT -4. The time now is 03:32.