Skip to content

Commit

Permalink
change params, slow down some speeds
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed Jun 19, 2024
1 parent 38944d4 commit ef43e8b
Show file tree
Hide file tree
Showing 14 changed files with 274 additions and 273 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- uses: calcit-lang/[email protected]
with:
version: "0.8.50"
version: "0.8.58"

- name: "compiles calcit to js"
run: caps --ci && cr --emit-js --once
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"version": "0.0.2-a1",
"main": "./lib/index.mjs",
"devDependencies": {
"@webgpu/types": "^0.1.40",
"@webgpu/types": "^0.1.42",
"bottom-tip": "^0.1.5",
"query-string": "^9.0.0",
"typescript": "^5.4.5",
"vite": "^5.2.9"
"vite": "^5.3.1"
},
"dependencies": {
"@calcit/procs": "^0.8.50",
"@calcit/procs": "^0.8.58",
"@triadica/touch-control": "^0.0.4-a1",
"ismobilejs": "^1.1.1"
},
Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/aizawa.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn aizawa(p: vec3f, dt: f32) -> LorenzResult {
let dy = d0 * x + (z - b) * y;
let dz = c + a * z - pow(z, 3.0) / 3.0 - (x * x + y * y) * (1. + e * z) + f * z * pow(x, 3.0);

var d = vec3<f32>(dx, dy, dz) * dt * 10.;
var d = vec3<f32>(dx, dy, dz) * dt * 0.8;
// let dl = length(d);
// if (dl > 0.2) {
// d = d / dl * 0.2;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/burke-shaw.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
return;
}

let ret = lorenz(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = lorenz(v_pos, params.delta_t * 0.0003 * (2. + 2. * rand(f32(index))));
// let ret = four_wing(v_pos, params.delta_t * 0.01 * (20. + 2. * rand(f32(index))));
// let ret = aizawa(v_pos, params.delta_t * 0.001 * (12. + 4. * rand(f32(index))));

Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/chen.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
}

// let ret = lorenz(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = chen(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = chen(v_pos, params.delta_t * 0.004 * (2. + 2. * rand(f32(index))));

// Write back
particles_b.particles[index].pos = ret.position;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/dequanli.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
return;
}

let ret = dequan_li(v_pos, params.delta_t * 0.0001 * (20. + 10. * rand(f32(index))));
let ret = dequan_li(v_pos, params.delta_t * 0.00004 * (20. + 10. * rand(f32(index))));

// Write back
particles_b.particles[index].pos = ret.position;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/fourwing.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
}

// let ret = lorenz(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = four_wing(v_pos, params.delta_t * 0.01 * (20. + 2. * rand(f32(index))));
let ret = four_wing(v_pos, params.delta_t * 0.0006 * (20. + 2. * rand(f32(index))));
// let ret = aizawa(v_pos, params.delta_t * 0.001 * (12. + 4. * rand(f32(index))));

// let ret = lorenz(v_pos, params.delta_t * 0.2);
Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/halvorsen.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
return;
}

let ret = iterate_fn(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = iterate_fn(v_pos, params.delta_t * 0.001 * (2. + 2. * rand(f32(index))));

// Write back
particles_b.particles[index].pos = ret.position;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/lorenz.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
return;
}

let ret = lorenz(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = lorenz(v_pos, params.delta_t * 0.0012 * (2. + 2. * rand(f32(index))));
// let ret = four_wing(v_pos, params.delta_t * 0.01 * (20. + 2. * rand(f32(index))));
// let ret = aizawa(v_pos, params.delta_t * 0.001 * (12. + 4. * rand(f32(index))));

Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/lorenz83.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
return;
}

let ret = lorenz83(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
let ret = lorenz83(v_pos, params.delta_t * 0.0008 * (2. + 2. * rand(f32(index))));
// let ret = four_wing(v_pos, params.delta_t * 0.01 * (20. + 2. * rand(f32(index))));
// let ret = aizawa(v_pos, params.delta_t * 0.001 * (12. + 4. * rand(f32(index))));

Expand Down
2 changes: 1 addition & 1 deletion src/apps/attractor/sprott.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {

// let ret = lorenz(v_pos, params.delta_t * 0.01 * (2. + 2. * rand(f32(index))));
// let ret = four_wing(v_pos, params.delta_t * 0.01 * (20. + 2. * rand(f32(index))));
let ret = sprott(v_pos, params.delta_t * 0.002 * (12. + 4. * rand(f32(index))));
let ret = sprott(v_pos, params.delta_t * 0.0004 * (12. + 4. * rand(f32(index))));

// let ret = lorenz(v_pos, params.delta_t * 0.2);
// let ret = chen(v_pos, params.delta_t * 0.8);
Expand Down
7 changes: 4 additions & 3 deletions src/apps/fireworks.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {

let small_index = index / level_1;

let age_limit = 3.0;
let age_limit = 1.0;
let velocity = 0.04;

if small_index % level_2 != 0u {
// pick a common base point or (small_index / level_2)
Expand All @@ -92,7 +93,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
}
return;
} else {
let ret = compute_move(v_pos, vol, params.delta_t * 0.2 * (0. + 4. * rand(f32(index))));
let ret = compute_move(v_pos, vol, params.delta_t * velocity * (0. + 4. * rand(f32(index))));

particles_b.particles[index].pos = ret.position;
particles_b.particles[index].velocity = ret.velocity;
Expand All @@ -104,7 +105,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
}

if particles_a.particles[index].ages < age_limit {
let ret = compute_move(v_pos, vol, params.delta_t * 0.2 * (0. + 4. * rand(f32(index))));
let ret = compute_move(v_pos, vol, params.delta_t * velocity * (0. + 4. * rand(f32(index))));
// Write back
particles_b.particles[index].pos = ret.position;
particles_b.particles[index].velocity = ret.velocity;
Expand Down
2 changes: 1 addition & 1 deletion src/apps/lamps.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ fn main(@builtin(global_invocation_id) GlobalInvocationID: vec3<u32>) {
continue;
}
let force = (p.pos - next_pos) / min(1.0, (distance * distance * distance));
next_velocity = next_velocity + 0.01 * force * params.delta_t;
next_velocity = next_velocity + 0.0006 * force * params.delta_t;
}

if length(next_velocity) > 100.0 {
Expand Down
Loading

0 comments on commit ef43e8b

Please sign in to comment.