nickabattista / IB2d

An easy to use immersed boundary method in 2D, with full implementations in MATLAB and Python that contains over 75 built-in examples, including multiple options for fiber-structure models and advection-diffusion, Boussinesq approximations, and/or artificial forcing.
GNU General Public License v3.0
164 stars 90 forks source link

mesh point inconsistency #21

Closed mountaindust closed 2 years ago

mountaindust commented 2 years ago

I'm only going to speak to this from the VTK output perspective, not the internal plotting.

Let's suppose you run a simulation with grid parameters as follows (see Flow_Around_Cylinder): Nx = 512 Ny = 128 Lx = 1.0 Ly = 0.25

For simplicity, let's consider only the x-direction. The important thing here is that the fluid domain is of unit length (periodic) in the x-direction, from 0 to 1.0. However, when the VTK files are written, if you look at the mesh points in the x-dimension, you'll find something surprising: they begin at x=0.0 but end at 0.9980341. That last number is not roundoff error. Here's what I think happened:

This is a problem because it means that the fluid data is incorrectly placed in the spatial domain with respect to the original parameters of the simulation. The error is slight and amounts to a straight translation (the domain is now [-0.00098, 0.9990]x[-0.00098,0.246] in this example, instead of [0,1]x[0,0.25]), but in some applications it could matter, particularly where the results are being used for something other than just visualization of the fluid flow.

My suggestion for solving this is two part:

Until this is addressed, Planktos will expect this inconsistency and auto-correct it. So please notify me in LOUD terms if this issue is closed!!

mountaindust commented 2 years ago

Turns out that the last grid point is missing due to periodicity. No problem after all!