Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cgmb committed Feb 5, 2020
1 parent 9e5efa9 commit d1fb369
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,8 @@ void sim_step() {

advect_markers(dt);
refresh_marker_counts();

// extrapolate values for new fluid cells from their neighbours
if (g_rainbow_enabled) {
extrapolate_p(g_r);
extrapolate_p(g_g);
Expand All @@ -960,6 +962,7 @@ void sim_step() {
zero_bounds_u(g_u);
zero_bounds_v(g_v);

// advect fluid properties along the fluid flow
advect_u(g_u, g_v, dt, g_utmp);
advect_v(g_u, g_v, dt, g_vtmp);
if (g_rainbow_enabled) {
Expand All @@ -972,11 +975,16 @@ void sim_step() {
advect_p(g_b, g_u, g_v, dt, g_btmp);
memcpy(g_b, g_btmp, sizeof(g_b));
}

// add acceleration due to gravity
apply_body_forces(g_vtmp, dt);

// set velocities constrained by solid boundaries
zero_bounds_u(g_utmp);
zero_bounds_v(g_vtmp);

// project our approximate solution for the updated velocity field
// to the nearest divergence-free solution
project(dt, g_utmp, g_vtmp, g_u, g_v);
} while (frame_time > 0.f);

Expand Down Expand Up @@ -1045,7 +1053,7 @@ void draw_rows(buffer* buf) {
}
}
buffer_appendz(buf, T_RESET);
buffer_appendz(buf, "\x1b[K"); // clear remainer of line
buffer_appendz(buf, "\x1b[K"); // clear remainder of line
if (y > y_cutoff) {
buffer_appendz(buf, "\r\n");
}
Expand Down

0 comments on commit d1fb369

Please sign in to comment.