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

Initialize a matrix in openfoam

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 3, 2018, 13:06
Default Initialize a matrix in openfoam
  #1
New Member
 
Feiyu Yang
Join Date: Apr 2018
Posts: 2
Rep Power: 0
feiyuyang is on a distinguished road
Hello foamers,
I am trying to define and initialize a 7x9 matrix in openfoam like this:

Code:
Matrix<scalarField,scalar> W(7, 9) = {
3.20030, -1.80864, -1.39585, -1.59775, 0.70547, 1.88260, 0.91327, 0.67476, -0.14852,
2.95923, 2.65510, 0.54050, 2.59016, -0.14764, 3.06157, -0.01218, -0.17603, -5.14361,
3.54086, 3.04317, 2.39666, 3.80438, 8.35982, 12.46509, 9.40431, 8.10863, 3.11098,
-0.53659, -0.55549, -0.25948, -0.50306, 0.09539, -0.91943, 0.12488, 0.05250, 0.86163,
3.50970, 3.01127, 2.37292, 3.76875, 8.28193, 12.34136, 9.32231, 8.03971, 3.07125,
0.64357, 0.52161, -0.01761, 0.71298, 0.10775, 2.08066, 0.14965, 0.15239, 0.20443,
6.68116, -2.62965, -1.95010, -2.11107, 2.85994, 5.33921, 3.35350, 2.73422, 0.74262,
};
but I get the following error message:

Code:
createFields.H: In function ‘int main(int, char**)’:
createFields.H:278:36: error: expected ‘,’ or ‘;’ before ‘=’ token
How can I get the the expected matrix?

regards
feiyuyang is offline   Reply With Quote

Reply

Tags
matrix operations

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
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04
Force can not converge colopolo CFX 13 October 4, 2011 22:03
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07
OpenFOAM Debian packaging current status problems and TODOs oseen OpenFOAM Installation 9 August 26, 2007 13:50
OpenFOAM Training and Workshop Zagreb 2628Jan2006 hjasak OpenFOAM 1 February 2, 2006 21:07


All times are GMT -4. The time now is 07:42.