aboutsummaryrefslogtreecommitdiff
path: root/src/shader/code/vertex.glsl
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-04-16 22:45:11 +0200
committerAdrian Kummerlaender2019-04-16 22:45:11 +0200
commitfc02e4c5f8c8bbb014449dc27d7b69992ad6043f (patch)
treeaf962916b7b3239c698a4825ba24ea1ddc3377ce /src/shader/code/vertex.glsl
parent89718b245b0246e08f9d0545a636e0cf89642a72 (diff)
downloadcompustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.tar
compustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.tar.gz
compustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.tar.bz2
compustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.tar.lz
compustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.tar.xz
compustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.tar.zst
compustream-fc02e4c5f8c8bbb014449dc27d7b69992ad6043f.zip
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
Diffstat (limited to 'src/shader/code/vertex.glsl')
-rw-r--r--src/shader/code/vertex.glsl17
1 files changed, 13 insertions, 4 deletions
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)
);
}
}