mglin question


bc69
07-26-2004, 05:06 PM
I've got a question about the mglin example in the C++ Examples Book.

After running mglin, the example does a check by setting up an array called f[][]. It then loads the values returned from mglin into the f array, comparing neighboring cells (if I understand correctly, this pattern of cells that it's comparing is a Laplacian). It then multiplies that value by (JMAX-1)*(JMAX-1), or effectively, the number of cells in the array.

What is the reason for multiplying by this number? Should I do this to my results? I noticed that most of the examples multiply by (JMAX-1) squared or just (JMAX -1) when filling out the f array.

Sorry if this is a basic question that seems obvious. I don't have a math background. Any help is appreciated.

thanks,
Brian

Saul Teukolsky
07-26-2004, 07:47 PM
Hi Brian,

When you substitute into the difference equations you get rho*delta^2, not rho (see eq. 19.0.6 in the book). Multiplying by (JMAX-1)^2 is just dividing by delta^2 to get rho itself.

Saul Teukolsky

bc69
07-27-2004, 10:09 AM
Ok.

Thanks!

It's nice that I bought a book where the authors actually participate in community discussions (even the most basic ones).

Brian