From c48467b333c90df8611936743f1c47fc3132a100 Mon Sep 17 00:00:00 2001 From: austin Date: Thu, 19 Dec 2024 18:48:44 -0500 Subject: [PATCH] semistable single chunk pressurecell --- .../includes/fluid/sim/pressurecell/solver_consts.h | 12 ++++++------ .../fluid/simulator/FluidAcceleratedSimulator.java | 2 +- .../c/fluid/sim/pressurecell/add_gravity_tests.c | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h b/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h index 86de6de6..92cc93cd 100644 --- a/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h +++ b/src/main/c/includes/fluid/sim/pressurecell/solver_consts.h @@ -5,7 +5,7 @@ /** * Timestep to simulate by */ -#define FLUID_PRESSURECELL_SIM_STEP 0.01f +#define FLUID_PRESSURECELL_SIM_STEP 0.1f /** * Force of gravity in unit tests @@ -15,7 +15,7 @@ /** * Spacing of cells */ -#define FLUID_PRESSURECELL_SPACING (1.0f/DIM) +#define FLUID_PRESSURECELL_SPACING (1.0f) /** * Multiplier applied to pressure calculations to encourage advection @@ -30,12 +30,12 @@ /** * Diffusion constant */ -#define FLUID_PRESSURECELL_DIFFUSION_CONSTANT 0.0001f +#define FLUID_PRESSURECELL_DIFFUSION_CONSTANT 0.3f /** * Viscosity constant */ -#define FLUID_PRESSURECELL_VISCOSITY_CONSTANT 0.0001f +#define FLUID_PRESSURECELL_VISCOSITY_CONSTANT 0.3f /** * Amount of the residual to add to the pressure field each frame @@ -99,7 +99,7 @@ /** * Enables recapture of density when velocity pushes it outside of bounds */ -#define FLUID_PRESSURECELL_ENABLE_RECAPTURE 1 +#define FLUID_PRESSURECELL_ENABLE_RECAPTURE 0 /** * Enables clamping small density values to 0 @@ -109,7 +109,7 @@ /** * Enables renormalizing the velocity field to a max value of 1 during projection */ -#define FLUID_PRESSURECELL_ENABLE_VELOCITY_FIELD_NORMALIZAITON 1 +#define FLUID_PRESSURECELL_ENABLE_VELOCITY_FIELD_NORMALIZAITON 0 #endif \ No newline at end of file diff --git a/src/main/java/electrosphere/server/fluid/simulator/FluidAcceleratedSimulator.java b/src/main/java/electrosphere/server/fluid/simulator/FluidAcceleratedSimulator.java index 1d9c01d5..db49df25 100644 --- a/src/main/java/electrosphere/server/fluid/simulator/FluidAcceleratedSimulator.java +++ b/src/main/java/electrosphere/server/fluid/simulator/FluidAcceleratedSimulator.java @@ -24,7 +24,7 @@ public class FluidAcceleratedSimulator implements ServerFluidSimulator { /** * Timestep to simulate by */ - public static final float SIMULATE_TIMESTEP = 0.01f; + public static final float SIMULATE_TIMESTEP = 0.1f; /** * The gravity constant diff --git a/src/test/c/fluid/sim/pressurecell/add_gravity_tests.c b/src/test/c/fluid/sim/pressurecell/add_gravity_tests.c index aaa870da..9d03906b 100644 --- a/src/test/c/fluid/sim/pressurecell/add_gravity_tests.c +++ b/src/test/c/fluid/sim/pressurecell/add_gravity_tests.c @@ -63,7 +63,9 @@ int fluid_sim_pressurecell_add_gravity_test1(){ // // cell that originall had values // - expected = 0; + float gravForce = FLUID_PRESSURECELL_SIM_STEP * FLUID_PRESSURECELL_GRAVITY; + gravForce = fmax(fmin(1.0f, gravForce),-1.0f); //gravity force is clamped + expected = -0.87; actual = currentChunk->v[CENTER_LOC][IX(1,1,DIM-2)]; if(fabs(expected - actual) > FLUID_PRESSURE_CELL_ERROR_MARGIN){ rVal++;