From fc02e4c5f8c8bbb014449dc27d7b69992ad6043f Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 16 Apr 2019 22:45:11 +0200 Subject: Add basic physical scaling and Knudsen quality criterion The paper "Automatic grid refinement criterion for lattice Boltzmann method" [2015] by Lagrava et al. describes a criterion for measuring the local simulation quality using a comparison of the theoretical Knudsen number and the quotient of the cells's non-equilibrium and equilibrium function. While this criterion was developed to enable automatic selection of areas to be refined, it also offers a interesting and unique perspective on the fluid structure. As the criterion requires calculation of the modeled Reynolds-, Mach- and Knudsen-numbers I took the time to set up the basics for scaling the simulation to actually model a physical system. Or rather calculating which physical model is represented by the chosen resolution and relaxation time. [2015]: https://arxiv.org/abs/1507.06767 --- src/shader/code/vertex.glsl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src/shader/code/vertex.glsl') diff --git a/src/shader/code/vertex.glsl b/src/shader/code/vertex.glsl index 676b68e..7851292 100644 --- a/src/shader/code/vertex.glsl +++ b/src/shader/code/vertex.glsl @@ -10,7 +10,8 @@ out VS_OUT { uniform uint nX; uniform uint nY; -const float displayAmplifier = 3.0; +const float velocityDisplayAmplifier = 3.0; +const int qualityDisplayRestrictor = 6; float unit(float x) { return 1.0/(1.0+exp(-x)); @@ -40,6 +41,14 @@ bool isWallFrontier(int material) { return material == 2 || material == 3; } +float restrictedQuality(float quality) { + if ( quality < 0.0 ) { + return 0.0; + } else { + return min(1.0, quality / qualityDisplayRestrictor); + } +} + void main() { const vec2 idx = fluidVertexAtIndex(gl_VertexID); @@ -58,9 +67,9 @@ void main() { vs_out.color = vec3(0.0, 0.0, 0.0); } else { vs_out.color = mix( - vec3(-0.5, 0.0, 1.0), - vec3( 1.0, 0.0, 0.0), - displayAmplifier * norm(VertexPosition.xy) + vec3(0.0, 1.0, 0.0), + vec3(1.0, 0.0, 0.0), + restrictedQuality(VertexPosition.y) ); } } -- cgit v1.2.3