{
  "title": "Diffusion & Temperature - AP Physics 2 (MVS)",
  "publicationStatus": "public",
  "labEnvironment": "production",
  "subtitle": "How does temperature affect the rate of diffusion?",
  "category": "",
  "subCategory": "",
  "screenshot": "",
  "aspectRatio": 1.9,
  "fontScale": 1,
  "lang": "en-US",
  "i18nMetadata": "",
  "credits": "",
  "helpOnLoad": false,
  "aboutOnLoad": false,
  "about": [
    "Explore the role of temperature on the rate of diffusion. Set the temperature, then remove the barrier, to measure how long it takes for a selected number of blue molecules to reach the detector.",
    "----",
    "*Note: Although the atoms in this model are in a flat plane, volume is calculated using 0.14 nm as the depth of the container.*"
  ],
  "theme": "",
  "showTopBar": true,
  "showBottomBar": true,
  "padding": 10,
  "models": [
    {
      "type": "md2d",
      "id": "model1",
      "url": "models/lab-version/1/md2d/external-projects/msu/diffusion-temperature-model.json",
      "onLoad": [
        "set({ timeStep: 0.00015, timeStepsPerTick: 75, modelSampleRate: 'default', numberOfAtoms: 0});",
        "onPropertyChange('time', function(t) {",
        "  var atoms               = atomsWithinRect(6.75, 0, 0.25, 1.96, 2);",
        "  var nNewAtomsInTarget   = 0;",
        "  var nAtomsInTargetTotal = get('nAtomsInTargetTotal')",
        "  for( var i = 0; i < atoms.length; i++) {",
        "    if (!getAtomProperties(atoms[i]).pinned) { ",
        "      setAtomProperties(atoms[i], {pinned: 1});",
        "      nNewAtomsInTarget++;",
        "    }",
        "  }",
        "  set('nAtomsInTargetTotal', nAtomsInTargetTotal + nNewAtomsInTarget);",
        "  set('experimentTime', get('experimentRunning') ? t - get('timeBarrierRemoved') : 0);",
        "});"
      ],
      "viewOptions": {
        "controlButtons": "play",
        "controlButtonStyle": "text",
        "textBoxes": [
          {
            "text": "Detector",
            "x": 6.8,
            "y": 0.2,
            "rotate": -90,
            "width": 2,
            "fontSize": 0.19,
            "textAlign": "center",
            "frame": "rectangle",
            "strokeOpacity": 0,
            "backgroundColor": "rgba(192, 192, 192, .5)",
            "layer": 1
          }
        ]
      },
      "modelOptions": {
        "unitsScheme": "mks"
      }
    }
  ],
  "propertiesToRetain": [],
  "parameters": [
    {
      "name": "nSelectedAtoms",
      "initialValue": 1
    },
    {
      "name": "nAtomsInTargetTotal",
      "initialValue": 0,
      "onChange": "if (value >= get('nSelectedAtoms')) { stop() }"
    },
    {
      "name": "timeBarrierRemoved",
      "initialValue": 0,
      "onChange": ""
    },
    {
      "name": "experimentRunning",
      "initialValue": false,
      "onChange": ""
    },
    {
      "name": "experimentTime",
      "initialValue": 0,
      "onChange": "",
      "label": "Experiment time",
      "unitType": "time"
    },
    {
      "name": "selectedTemperature",
      "initialValue": 500,
      "onChange": "set('targetTemperature', get('selectedTemperature'));",
      "label": "Temperature"
    }
  ],
  "outputs": [
    {
      "name": "volume",
      "value": "return (get('height') * get('width') * .14);",
      "label": "Volume",
      "unitAbbreviation": "nm³"
    },
    {
      "name": "theoreticalPressure",
      "value": "return ((getNumberOfAtoms() / 6.02e+23) * (.082e+24 * get('targetTemperature'))) / get('volume')",
      "label": "Pressure",
      "unitAbbreviation": "atm"
    }
  ],
  "filteredOutputs": [],
  "helpTips": [],
  "dataSets": [],
  "components": [
    {
      "id": "remove-obstacle",
      "type": "button",
      "action": [
        "if (isStopped()) {",
        "  alert('Press start before removing the barrier');",
        "} else if (getNumberOfObstacles() > 0) { ",
        "  removeObstacle(0); ",
        "  set('timeBarrierRemoved', get('time'));",
        "  set('experimentRunning', true)",
        "}"
      ],
      "text": "Remove barrier",
      "width": "",
      "height": "",
      "disabled": false,
      "tooltip": "",
      "helpIcon": false
    },
    {
      "id": "reset-barrier",
      "type": "button",
      "action": [
        "reloadModel();"
      ],
      "text": "Reset experiment",
      "width": "",
      "height": "",
      "disabled": false,
      "tooltip": "",
      "helpIcon": false
    },
    {
      "id": "temperature-slider",
      "type": "slider",
      "min": 100,
      "max": 2500,
      "steps": 12,
      "title": "Temperature (K)",
      "titlePosition": "top",
      "labels": [
        {
          "value": 100,
          "label": "100"
        },
        {
          "value": 2500,
          "label": "2500"
        }
      ],
      "width": "auto",
      "height": "auto",
      "displayValue": "return get('targetTemperature')",
      "property": "selectedTemperature",
      "retainProperty": true,
      "disabled": false,
      "tooltip": "",
      "helpIcon": false
    },
    {
      "id": "experiment-time-output",
      "type": "numericOutput",
      "property": "experimentTime",
      "label": "",
      "units": "",
      "orientation": "horizontal",
      "width": "auto",
      "height": "auto",
      "displayValue": "return format('.1f')(value)",
      "tooltip": "",
      "helpIcon": false
    },
    {
      "id": "pressure-output",
      "type": "numericOutput",
      "property": "theoreticalPressure",
      "label": "Pressure",
      "units": "",
      "orientation": "horizontal",
      "width": "auto",
      "height": "auto",
      "displayValue": "return format('.1f')(value)",
      "tooltip": "",
      "helpIcon": false
    },
    {
      "id": "volume-output",
      "type": "numericOutput",
      "property": "volume",
      "label": "Volume",
      "units": "",
      "orientation": "horizontal",
      "width": "auto",
      "height": "auto",
      "displayValue": "return format('.1f')(value)",
      "tooltip": "",
      "helpIcon": false
    },
    {
      "id": "nSelectedAtoms-slider",
      "type": "slider",
      "min": 1,
      "max": 5,
      "steps": 4,
      "title": "Number of Molecules",
      "titlePosition": "top",
      "labels": [
        {
          "value": 1,
          "label": "1"
        },
        {
          "value": 5,
          "label": "5"
        }
      ],
      "width": "auto",
      "height": "auto",
      "displayValue": "return get('nSelectedAtoms')",
      "property": "nSelectedAtoms",
      "retainProperty": true,
      "disabled": false,
      "tooltip": "",
      "helpIcon": false
    }
  ],
  "layout": {
    "bottom": [
      [
        "temperature-slider",
        "nSelectedAtoms-slider"
      ],
      [
        "experiment-time-output",
        "pressure-output",
        "volume-output"
      ]
    ],
    "right": [
      [
        "remove-obstacle"
      ],
      [
        "reset-barrier"
      ]
    ]
  },
  "template": [
    {
      "id": "top",
      "bottom": "model.top",
      "width": "model.width"
    },
    {
      "id": "right",
      "top": "model.top",
      "left": "model.right",
      "height": "model.height",
      "padding-top": "1.5em",
      "padding-left": "1em",
      "padding-right": "0.5em",
      "align": "center"
    },
    {
      "id": "bottom",
      "top": "model.bottom",
      "width": "interactive.width",
      "padding-top": "0.5em",
      "align": "center"
    }
  ]
}