CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   Reading input matrix in a solver (

tsimon October 1, 2012 06:34

Reading input matrix in a solver
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.

treima October 1, 2012 08:33


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.


All times are GMT -4. The time now is 09:47.