Skip to content

Commit 6b2ecd7

Browse files
authored
Merge branch 'Mar5bar:main' into main
2 parents 089483f + 0554a96 commit 6b2ecd7

6 files changed

Lines changed: 26 additions & 6 deletions

File tree

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.md linguist-language=Markdown
2+
*.markdown linguist-language=Markdown

_user-guide/advanced-options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ Forward and backward differences can also be computed with second-order numerica
549549

550550
Throughout VisualPDE, you can make use of the special functions `sin`, `cos`, `tan`, `exp`, `log`, `sqrt`, `sinh`, `cosh`, `tanh` and `H`, where the latter is a [Heaviside function](https://en.wikipedia.org/wiki/Heaviside_step_function) smoothed over the interval $[-1,1]$ (see the [GLSL reference](https://registry.khronos.org/OpenGL-Refpages/gl4/html/smoothstep.xhtml) for details). All function arguments should be surrounded by parentheses, e.g. `sin(x)`. You can also use `min` and `max` as functions with two arguments, which return the minimum or maximum of their arguments, e.g. `min(u,1)` returns the minimum of $u$ and 1. If you wish to raise the output of a function to a power, you must enclose the function in parentheses, e.g. write `(cos(x))^2`, not `cos(x)^2`. You can also use `mod(a,b)` to compute the remainder of $a$ upon division by $b$ (see the [GLSL reference](https://registry.khronos.org/OpenGL-Refpages/gl4/html/mod.xhtml) for details).
551551

552-
A [bump function](https://en.m.wikipedia.org/wiki/Bump_function) with compact support can be used via the syntax `Bump(X, Y, radius)` (or `Bump(X, radius)` in 1D), which localises a bump of unit maximum of the given radius at the point $(X, Y)$.
552+
A [bump function](https://en.m.wikipedia.org/wiki/Bump_function) with compact support can be used via the syntax `Bump(X, Y, radius)` (or `Bump(X, radius)` in 1D, with `Y` implicitly set to `L_y/2`), which localises a bump of unit maximum of the given radius at the point $(X, Y)$.
553553

554554
A [bivariate Gaussian function](https://en.wikipedia.org/wiki/Multivariate_normal_distribution) can be used with similar syntax to the bump function: `Gauss(X, Y, s)` is a correctly normalised Gaussian function centred at $(X,Y)$ with standard deviation `s`. The extended syntax `Gauss(X, Y, s_x, s_y)` produces a potentially asymmetric Gaussian with standard deviations `s_x` and `s_y` in the $x$ and $y$ directions, with zero correlation. Correlation can be specified via `Gauss(X, Y, s_x, s_y, r)`, where `r` is the correlation between the two directions.
555555

sim/scripts/RD/main.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,6 +1769,9 @@ async function VisualPDE(url) {
17691769
imageSourceBlend: {
17701770
type: "t",
17711771
},
1772+
isTwoD: {
1773+
type: "bool",
1774+
},
17721775
L: {
17731776
type: "f",
17741777
},
@@ -3058,6 +3061,7 @@ async function VisualPDE(url) {
30583061
Midnight: "midnight",
30593062
Pastels: "pastels",
30603063
Pride: "pride",
3064+
"Red-green": "redGreen",
30613065
Retro: "retro",
30623066
"Simply blue": "blue",
30633067
"Snow Ghost": "snowghost",
@@ -8120,6 +8124,7 @@ async function VisualPDE(url) {
81208124
}
81218125
}
81228126
if (options.dimension == 1) options.minY = "0.0";
8127+
uniforms.isTwoD.value = options.dimension == 2;
81238128
resize();
81248129
setRDEquations();
81258130
setEquationDisplayType();

sim/scripts/RD/presets.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3315,13 +3315,13 @@ presets["bacteriaInAReach2D"] = {
33153315
domainViaIndicatorFun: true,
33163316
imagePathOne: "./images/river.png",
33173317
kineticParams:
3318-
"c0 = 0.1 in [0, 1];c1 = 0 in [0, 1];k = 0.006 in [0, 0.05];u = 1 in [0.1, 4];",
3318+
"c0 = 0.5 in [0, 1];c1 = 0 in [0, 1];k = 0.006 in [0, 0.05];u = 1 in [0.1, 4];",
33193319
maxColourValue: "5",
33203320
overlayExpr: "I_S",
33213321
parent: "bacteriaInAReach",
33223322
plotType: "plane",
33233323
reactionStr_1:
3324-
"-u*C_xb - 5*(0.4*L_y-y)*C_y/L_y - k*C + c0*0.1*Bump(0,L_y/2,L/20) + c1*0.1*Bump(L_x/2,0.7*L_y,L/20)",
3324+
"-u*C_xb - 5*(0.4*L_y-y)*C_y/L_y - k*C + c0*0.1*Bump(0,L_y/2,L/20)/u + c1*0.1*Bump(L_x/2,0.7*L_y,L/20)/u",
33253325
views: [
33263326
{
33273327
name: "Concentration",
@@ -3340,15 +3340,16 @@ presets["bacteriaInAReach"] = {
33403340
brushAction: "smoothadd",
33413341
brushRadius: "20",
33423342
brushType: "vline",
3343-
brushValue: "min(0.02, 1-C)",
3343+
brushValue: "min(1, max(0,5-C))",
33443344
colourbar: true,
3345-
colourmap: "turbo",
3345+
colourmap: "redGreen",
33463346
comboStr_1: "Left: Dirichlet = c0; Right: Ghost = 0;",
33473347
diffusionStr_1_1: "0",
33483348
diffusionStr_2_2: "0",
33493349
dimension: "1",
33503350
domainScale: "320",
33513351
dt: 0.01,
3352+
flippedColourmap: true,
33523353
initCond_1: "0",
33533354
initCond_2: "0",
33543355
kineticParams:

sim/scripts/auxiliary_GLSL_funs.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// auxiliary_GLSL_funs.js
22
export function auxiliary_GLSL_funs() {
33
return `const float pi = 3.141592653589793;
4+
uniform bool isTwoD;
45
float H(float VALUE)
56
{
67
float RES = smoothstep(-0.01, 0.01, VALUE);
@@ -33,7 +34,11 @@ export function auxiliary_GLSL_funs() {
3334
}
3435
3536
float Bump(float x, float y, float MX, float MY, float MAXR) {
36-
float RADIUSSQ = ((x-MX)*(x-MX)+(y-MY)*(y-MY)) / (MAXR*MAXR);
37+
float yDiff = 0.0;
38+
if (isTwoD) {
39+
yDiff = y - MY;
40+
}
41+
float RADIUSSQ = ((x-MX)*(x-MX)+(yDiff)*(yDiff)) / (MAXR*MAXR);
3742
if (RADIUSSQ < 1.0) {
3843
return exp(1.0-1.0/(1.0-RADIUSSQ));
3944
} else {

sim/scripts/colourmaps.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
export function getColours(sel) {
22
let colours = [];
33
switch (sel) {
4+
case "redGreen":
5+
colours.push([0.89, 0.07, 0.18, 0.0]);
6+
colours.push([0.95, 0.53, 0.24, 0.25]);
7+
colours.push([0.93, 0.82, 0.31, 0.5]);
8+
colours.push([0.62, 0.82, 0.32, 0.75]);
9+
colours.push([0.11, 0.64, 0.23, 1.0]);
10+
break;
411
case "fireOnTerrain":
512
colours.push([0.51, 0.36, 0.33, 0.0]);
613
colours.push([1, 0.99, 0.59, 0.45]);

0 commit comments

Comments
 (0)