|
[Sponsors] |
Preferred data type in C++ for structured mesh |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
December 13, 2021, 22:30 |
Preferred data type in C++ for structured mesh
|
#1 |
Member
Anders Aamodt Resell
Join Date: Dec 2021
Location: Oslo, Norway
Posts: 66
Rep Power: 5 |
Hi
I am going to implement FVM for 2D Euler equations in C++. I wonder what data types I should consider using to store the conserved variables in each node (as well as other variables) One idea is to use c arrays in this fashion: double U[ni][nj][4]. Another Idea I have is to store them in matrices, in a linalg library like Eigen, but not sure if Eigen supports rank 3 tensors. I have previously written a 2D Euler solver in Matlab using this approach. Thanks! |
|
December 14, 2021, 08:28 |
|
#2 |
New Member
Continuum
Join Date: Aug 2009
Posts: 19
Rep Power: 17 |
Suggest a class that carries i, j and k. Use k for future 3D if you evolve to that. I would not save in 2D vectors. I would devise a flattening method that works for you structured mesh. You could have a class method that returns the index for the flattened matrix based on ijk input indices.
|
|
December 14, 2021, 11:50 |
|
#3 |
New Member
Join Date: Nov 2019
Posts: 19
Rep Power: 7 |
Using the Matrix class from Eigen is the best choice in my opinion.
|
|
December 15, 2021, 13:46 |
|
#4 | |
Member
Anders Aamodt Resell
Join Date: Dec 2021
Location: Oslo, Norway
Posts: 66
Rep Power: 5 |
Quote:
|
||
Tags |
c++, compressible, euler equations, finite volume method |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
reactingMultiphaseEulerFoam | tonnykz | OpenFOAM Running, Solving & CFD | 2 | June 15, 2020 03:09 |
time step continuity error increases with time_SRFSimplefoam | mostafa kamal | OpenFOAM Running, Solving & CFD | 7 | October 2, 2019 03:00 |
[Commercial meshers] Mesh conversion problem (fluent3DMeshToFoam) | Aadhavan | OpenFOAM Meshing & Mesh Conversion | 2 | March 8, 2018 02:47 |
singularity? | mihaipruna | OpenFOAM Running, Solving & CFD | 5 | April 24, 2012 18:18 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |