|
[Sponsors] |
July 16, 2014, 12:54 |
Matrix initialization/definition
|
#1 |
Senior Member
Gonzalo
Join Date: Mar 2011
Location: Argentina
Posts: 122
Rep Power: 16 |
Hi everybody:
I'm writing a UDF to calculate the aerodynamic forces over a structure, but as it has a lot of patches the tool Report ==>Forces is very tricky, so I'm writing this UDF. One of the inputs is the direction in wich the force is calculated, and there are several direction for that so I storage them in a two dimansional array. The problem is that when I try to compile the code I get the following error message: Error: C:/Users/...: line 10: invalid type conversion: float -> array 3 of double The statement where I try to initialize/define the matrix is the following: real direction [2] [3]={{0.0, -0.12187, 0.992546}, {0.0, 0.0, 1.0}}; Could anybody tell me if I'm doing something wrong with that line of the UDF. PS: That statement is the line 10. Thanks Gonzalo Last edited by gfoam; July 16, 2014 at 14:21. |
|
July 17, 2014, 07:32 |
|
#3 |
Senior Member
Gonzalo
Join Date: Mar 2011
Location: Argentina
Posts: 122
Rep Power: 16 |
OK, thank you for your response. Then I will try to compile it, or I will see if I can use a 1D array. Regards.
Gonzalo |
|
July 17, 2014, 21:04 |
|
#4 |
Senior Member
|
You can define "direction" as an one-dimensional array and introduce some macro like
Code:
#define xxx(i, j) direction[i*3+j] Code:
xxx(i, j) Code:
direction[i][j] |
|
July 21, 2014, 12:28 |
|
#5 |
Senior Member
Gonzalo
Join Date: Mar 2011
Location: Argentina
Posts: 122
Rep Power: 16 |
Thank you, that's what I have done more o less, I didn't use a macro, but I did something similar to this:
direction[i*3+j] to access the data storaged in a 1D array thinking it as a 2D array. But, than you so much for your help. Regards Gonzalo |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Matrix addressing | maybee | OpenFOAM Programming & Development | 10 | August 1, 2020 08:55 |
inverse of a matrix or solution of implicit equation | romant | OpenFOAM Programming & Development | 4 | August 6, 2013 10:02 |
more equation in block matrix system | yhaomin2007 | OpenFOAM | 1 | September 6, 2012 09:33 |
Force can not converge | colopolo | CFX | 13 | October 4, 2011 23:03 |
Elemtary matrix to CSR global matrix | xueying | Main CFD Forum | 2 | September 24, 2002 10:44 |