small CG solver work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-12-12 00:00:50 -05:00
parent a8c879e384
commit 0f4379920b
3 changed files with 6 additions and 5 deletions

View File

@ -5,17 +5,17 @@
/** /**
* The number of times to relax most solvers * The number of times to relax most solvers
*/ */
#define FLUID_GRID2_LINEARSOLVERTIMES 10 #define FLUID_GRID2_LINEARSOLVERTIMES 5
/** /**
* The number of times to relax most solvers * The number of times to relax most solvers
*/ */
#define FLUID_GRID2_SOLVER_MULTIGRID_MAX_ITERATIONS 5 #define FLUID_GRID2_SOLVER_MULTIGRID_MAX_ITERATIONS 10
/** /**
* Tolerance to target for multigrid precomputing in projection * Tolerance to target for multigrid precomputing in projection
*/ */
#define FLUID_GRID2_SOLVER_MULTIGRID_TOLERANCE 1.0f #define FLUID_GRID2_SOLVER_MULTIGRID_TOLERANCE 0.1f
/** /**
* The number of times to relax most solvers * The number of times to relax most solvers
@ -25,7 +25,7 @@
/** /**
* Tolerance to target for conjugate gradient precomputing in projection * Tolerance to target for conjugate gradient precomputing in projection
*/ */
#define FLUID_GRID2_SOLVER_CG_TOLERANCE 0.1f #define FLUID_GRID2_SOLVER_CG_TOLERANCE 0.01f
/** /**
* Width of a single grid cell * Width of a single grid cell

View File

@ -205,7 +205,7 @@ LIBRARY_API void fluid_grid2_solveProjection(
chunk->projectionIterations++; chunk->projectionIterations++;
} }
if(chunk->projectionResidual > FLUID_GRID2_SOLVER_CG_TOLERANCE || chunk->projectionResidual < -FLUID_GRID2_SOLVER_CG_TOLERANCE){ if(chunk->projectionResidual > FLUID_GRID2_SOLVER_CG_TOLERANCE || chunk->projectionResidual < -FLUID_GRID2_SOLVER_CG_TOLERANCE){
// printf("Projection residual didn't converge! %f \n",chunk->projectionResidual); printf("Projection residual didn't converge! %f \n",chunk->projectionResidual);
} }
//finest grain iteration with conjugate gradient method //finest grain iteration with conjugate gradient method

View File

@ -115,6 +115,7 @@ int solver_conjugate_gradient_init(float * phi, float * phi0, float a, float c){
* @param phi0 The phi array from the last frame * @param phi0 The phi array from the last frame
* @param a The a const * @param a The a const
* @param c The c const * @param c The c const
* @return The residual
*/ */
float solver_conjugate_gradient_iterate_parallel(float * phi, float * phi0, float a, float c){ float solver_conjugate_gradient_iterate_parallel(float * phi, float * phi0, float a, float c){
int i, j, k; int i, j, k;