|
[Sponsors] |
February 8, 2015, 14:10 |
Multi-Dimensional Array - 4th order
|
#1 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi all,
I think it is a very stupid question but how can I build a 4th order array in FOAM? Code:
T[w][x][y][z] like: vector< vector< vector< vector<double> > > > T
__________________
Keep foaming, Tobias Holzmann |
|
February 10, 2015, 10:39 |
|
#2 |
Senior Member
David Gaden
Join Date: Apr 2009
Location: Winnipeg, Canada
Posts: 437
Rep Power: 22 |
What do you want to do with the data? There's a number of OpenFOAM-ish ways to do that, each with different advantages.
In OpenFOAM, "List" is (very close to) a std::vector. List<List<List<scalarList> > > T(); or with math operators List<List<scalarFieldField> > T(); You could also use PtrList, or UPtrList if unallocated.
__________________
~~~ Follow me on twitter @DavidGaden |
|
February 10, 2015, 10:53 |
|
#3 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
Hi,
thanks for your replay. I store thermodynamic values in that array. Maybe you know the flamelet model? There you have all thermodynamic values based on three variables - with defect you have four variables. Therefore I have to store it in an very big array. Like phi of enthalpy, dissipation rate, mixture fraction and varianz mixture fraction Hence this I need a 4d array: Code:
T[h][chi][Z][Zvar] I only have to read a file, store the date in the array and then extract the data again (no mathematical operations are needed within this array). So do you think, list is a good choice ? Thanks in adavance,
__________________
Keep foaming, Tobias Holzmann |
|
January 20, 2021, 11:00 |
converting 3D array to a 4D array
|
#4 |
New Member
Prabhu Kankatala
Join Date: Sep 2020
Posts: 2
Rep Power: 0 |
Hi @Tobi , this thread seems to be a decade old but i hope you still remember what you were talking about and hope you figured out. You seem to have some experience in working with multi-dimensional arrays in openFoam. I have to convert a 3 dimensional array into 4 dimensional one in a humongous code. For eg:
lift[i][j][k]=0.5*Cl[i][j][k]*Vmag[i][j][k]*Vmag[i][j][k]*chord*db[i][k]; can you suggest any sources where i can learn to add an index say l to make it like [i][j][k][l] throughout my code consistently. Regards Prabs |
|
January 20, 2021, 11:29 |
|
#5 |
Super Moderator
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51 |
You can use the <map> container and use keys. http://www.cplusplus.com/reference/map/map/
__________________
Keep foaming, Tobias Holzmann |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Runge Kutta 4th Order Source Code | sugu | Main CFD Forum | 4 | October 26, 2012 03:15 |
4th and 5th Order TVD Runge-Kutta Methods | saygin | Main CFD Forum | 2 | January 30, 2006 11:45 |
Help on fortran code for FD 4th order | Miguel | Main CFD Forum | 0 | November 14, 2005 10:58 |
Higher order discretization on staggered grid | Chandra Shekhar | Main CFD Forum | 9 | January 27, 2005 16:31 |
Neighboring cells in TETRA_4 unstructured grids | Amaresh Dalal | Main CFD Forum | 12 | September 19, 2004 11:54 |