Best way to represent this grid?

S

steve

Hi, I am working on a finite-volume numerical method project. I am not
great at programming though. I am looking for the best way to
represent this grid in C. The grid consists of N points spaced at
deltaX = Xmax/N where Xi = (i-1/2)*deltaX, i = 1, 2, 3,...N.
Furthermore there are cell interfaces located at Xi+1/2 and Xi-1/2 and
each interface has a + and - side.

Obviously I can declare Q[N+1] and get Q, Q[i+1], Q[i-1] for the
grid points but I am not sure the best way to represent Q[i+1/2]+ and
Q[i+1/2]-, and Q[i-1/2], etc. which are needed in my calculations.

Thank You,
Stephen
 
B

Barry Schwarz

Hi, I am working on a finite-volume numerical method project. I am not
great at programming though. I am looking for the best way to
represent this grid in C. The grid consists of N points spaced at
deltaX = Xmax/N where Xi = (i-1/2)*deltaX, i = 1, 2, 3,...N.
Furthermore there are cell interfaces located at Xi+1/2 and Xi-1/2 and
each interface has a + and - side.

Obviously I can declare Q[N+1] and get Q, Q[i+1], Q[i-1] for the
grid points but I am not sure the best way to represent Q[i+1/2]+ and
Q[i+1/2]-, and Q[i-1/2], etc. which are needed in my calculations.


You could use an array of struct.


Remove del for email
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top