From 66536ccec67e38a2f867ce64ee90d07cbd48f96c Mon Sep 17 00:00:00 2001 From: adany292 <adany292@student.liu.se> Date: Mon, 4 Nov 2024 11:45:13 +0100 Subject: [PATCH] Better parametrs + constant gravity. Constants still neeed fine tuning --- src/constants.h | 6 +++--- src/kernels_cuda.cu | 6 +++--- src/main.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/constants.h b/src/constants.h index 5a5d500..7b8bfe9 100644 --- a/src/constants.h +++ b/src/constants.h @@ -9,10 +9,10 @@ const float h_BOUND_Y_MAX = 12.0f; const float h_BOUND_Z_MIN = -4.0f; const float h_BOUND_Z_MAX = 4.0f; -const float h_GAS_CONSTANT = 300.0f; -const float h_VISCOSITY = 0.8f; +const float h_GAS_CONSTANT = 10.0f; +const float h_VISCOSITY = 0.2f; const float h_PI = 3.14159265358979323846f; -const float h_H = 0.4f; // Smoothing radius +const float h_H = 0.5f; // Smoothing radius #endif // CONSTANTS_H diff --git a/src/kernels_cuda.cu b/src/kernels_cuda.cu index 3a17177..9aae2a3 100644 --- a/src/kernels_cuda.cu +++ b/src/kernels_cuda.cu @@ -23,8 +23,8 @@ __constant__ float POLY6_CONST; __constant__ float SPIKY_GRAD_CONST; __constant__ float VISC_LAP_CONST; -__constant__ float PARTICLE_MASS = 8.0f; -__constant__ float REST_DENSITY = 1000.0f; +__constant__ float PARTICLE_MASS = 1.0f; +__constant__ float REST_DENSITY = 60.0f; __constant__ float GAS_CONSTANT; __constant__ float VISCOSITY; @@ -250,7 +250,7 @@ __global__ void computeForces( float3 fPressure = make_float3(0.0f, 0.0f, 0.0f); float3 fViscosity = make_float3(0.0f, 0.0f, 0.0f); - float3 fGravity = make_float3(0.0f, -16.0f * density_i, 0.0f); + float3 fGravity = make_float3(0.0f, -2.0f , 0.0f); unsigned int cellIndex = cellIndices[idx]; diff --git a/src/main.cpp b/src/main.cpp index 601bbe1..94dce15 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -23,10 +23,10 @@ #include "GL_utilities.h" // Number of particles -const int NUM_PARTICLES = 8000; // Should match a cubic grid for simplicity -const float GRID_SPACING = 0.5f; // Spacing between particles in the grid +const int NUM_PARTICLES = 64000; // Should match a cubic grid for simplicity +const float GRID_SPACING = 0.25f; // Spacing between particles in the grid -const float pointRadius = 8.0f; // Point size in world space +const float pointRadius = 6.0f; // Point size in world space const float pointScale = 16.0f; auto previousTime = std::chrono::high_resolution_clock::now(); -- GitLab