Extraction of impulsion field through modifying source code

src.zip (448.8 KB)
I’m trying to extract impulsion field by modifying source codes.

In detail:

  1. Initialize impulsion field as 0.0.
  2. Calculate impulsion vectors when parcels collide with walls for each parcels.
  3. Save the sum of impulsion vectors for each “boundary cells” (or wall cells) in which the impulsion happened.
  4. Write an output file when the time step is reached, with the impulsion field.

After a simulation with this process, the impulsion field is expected to have values along only in the wall cells.

inputs.zip (3.5 KB)

But this code gives me the results shown in the capture below.

I think the step 3. (indexing) logic is the problem, but I cannot find what is the problem.

Let me know where is wrong in my logic.

Modified file list:

Also, let me know if it causes some problems.

Thank you for you all reading this.