<!--
###########################################################################################
This is a JSFiddle example of "Cacatoo". This HTML page does not contain the code itself,
but determines where the grids, graphs, buttons, etc are placed. The real code is in the
Javascript Tab. I recommend enabling "Tabs (Columns)" under the settings in the top-right.
###########################################################################################
-->
<html>
<script src="https://bramvandijk88.github.io/cacatoo/scripts/cacatoo.js"></script>
<script src="https://bramvandijk88.github.io/cacatoo/scripts/all.js"></script>
<head>
<title>Cacatoo examples</title>
</head>
<script>
/*-------------------------End user-defined code ---------------------*/
</script>
<body onload="cacatoo()">
<div class="header" id="header">
<h2>Cacatoo (example project)</h2>
</div>
<div class="content" id="form_holder"></div>
<div class="", id="all_holder">
<div class="content" id="canvas_holder"> </div>
<div class="content" id="graph_holder"> </div>
</div>
<div class="output" id="output"></div>
<div class="footer" id="footer"></div>
</body>
</html>
/*-----------------------Start user-defined code ---------------------*/
var sim; // Changing sim to var to enable "save image" button
//model parameters, confusingly dubbed variables
//for technical reasons
var a = 0.025
var e = 0.005
var b = 4.5
var dt = 1
var disruption = 0.3
let sumV; //to sum up V over the grid
function cacatoo() {
//setting details like simulation field size,
//max run time, title, zoom scale, display
//frequency, boundary conditions etc
let config = {
title: "Fitzhugh Nagumo PDE",
description: "",
maxtime: 1000000,
ncol: 150,
nrow: 150, // dimensions of the grid to build
wrap: [false, false], // Wrap boundary [COLS, ROWS]
scale: 2, // scale of the grid (nxn pixels per grid cell
bgcolour: 'white',
graph_interval: 5,
graph_update: 25
}
//make a model object
sim = new Simulation(config)
sim.makeGridmodel("Fitz");
//set the colors for the 2D displays
//arguments: which variable, max value, start color, end color
sim.Fitz.colourGradient('V', 100, [255, 255, 255], [0, 0, 255])
sim.Fitz.colourGradient('W', 100, [255, 255, 255], [255, 0, 0])
//2D display for the V variable & colorbar
sim.createDisplay_continuous({
model: "Fitz",
property: "V",
label: "Action potential",
minval: 0,
maxval: 1,
decimals: 3,
nticks: 3
})
//2D display for the W variable & colorbar
sim.createDisplay_continuous({
model: "Fitz",
property: "W",
label: "Refractory tissue",
minval: 0,
maxval: 0.3,
decimals: 3,
nticks: 3
})
sim.reset = function(all = true) {
if(all) sim.time = 0
if (all) sim.Fitz.resetPlots()
for (let i = 0; i < sim.Fitz.nc; i++) {
for (let j = 0; j < sim.Fitz.nr; j++) {
if (all) {
if (i * i + j * j <= 100)
sim.Fitz.grid[i][j].V = 1
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.