small-ish fixes
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-12-10 20:05:20 -05:00
parent 94e4e10a78
commit 36e40cd0ae
5 changed files with 12 additions and 9 deletions

View File

@ -1284,6 +1284,9 @@ multigrid implementation
(12/10/2024)
Implement conjugate gradient solver
Fix density advection dx being wrong
Update gravity const
Add bounds setting to velocity projection

View File

@ -87,9 +87,9 @@ LIBRARY_API void fluid_grid2_advectDensity(float ** d, float ** d0, float ** ur,
int i, j, k, i0, j0, k0, i1, j1, k1;
int m,n,o;
float x, y, z, s0, t0, s1, t1, u1, u0, dtx,dty,dtz;
dtx = dt*FLUID_GRID2_H;
dty = dt*FLUID_GRID2_H;
dtz = dt*FLUID_GRID2_H;
dtx = dt/FLUID_GRID2_H;
dty = dt/FLUID_GRID2_H;
dtz = dt/FLUID_GRID2_H;
float * center_d = GET_ARR_RAW(d,CENTER_LOC);
float * center_d0 = GET_ARR_RAW(d0,CENTER_LOC);

View File

@ -260,10 +260,9 @@ static inline void fluid_grid2_saveStep(float * values, const char * name){
* @param environment The environment data of the world
*/
static inline void fluid_grid2_applyGravity(Chunk * currentChunk, Environment * environment){
int N = DIM;
for(int x = 0; x < DIM; x++){
for(int y = 0; y < DIM; y++){
for(int z = 0; z < DIM; z++){
for(int x = 1; x < DIM-1; x++){
for(int y = 1; y < DIM-1; y++){
for(int z = 1; z < DIM-1; z++){
GET_ARR_RAW(currentChunk->v0,CENTER_LOC)[IX(x,y,z)] = GET_ARR_RAW(currentChunk->v0,CENTER_LOC)[IX(x,y,z)] + GET_ARR_RAW(currentChunk->d,CENTER_LOC)[IX(x,y,z)] * environment->consts.gravity;
}
}

View File

@ -242,6 +242,7 @@ LIBRARY_API void fluid_grid2_solveProjection(
//perform iteration of v cycle multigrid method
for(int l = 0; l < FLUID_GRID2_LINEARSOLVERTIMES; l++){
solver_multigrid_iterate(p,div,a,c);
fluid_grid2_setBoundsToNeighborsRaw(FLUID_GRID2_BOUND_NO_DIR,jru0);
}
// solver_conjugate_gradient_solve_serial(p,div,a,c);
@ -359,7 +360,7 @@ void fluid_grid2_advect_velocity(int b, float ** jrd, float ** jrd0, float * u,
int m,n,o;
float x, y, z, s0, t0, s1, t1, u1, u0, dtx,dty,dtz;
dtx=dty=dtz=dt*DIM;
dtx=dty=dtz=dt/FLUID_GRID2_H;
float * d = GET_ARR_RAW(jrd,CENTER_LOC);

View File

@ -29,7 +29,7 @@ public class FluidAcceleratedSimulator implements ServerFluidSimulator {
/**
* The gravity constant
*/
public static final float GRAVITY_CONST = -10f;
public static final float GRAVITY_CONST = -1000f;
/**
* Load fluid sim library