Skip to content

Note

Click here to download the full example code

Plot scenarios

This example demonstrates how to execute a steady state simulation using ndk

import neurotechdevkit as ndk


def plot_scenario(chosen_scenario):
    print(f"Simulating scenario: {chosen_scenario.__name__}")
    scenario = chosen_scenario()
    scenario.make_grid()
    scenario.compile_problem()
    result = scenario.simulate_steady_state()
    result.render_steady_state_amplitudes(show_material_outlines=False)

Simulating scenario: scenario 0

plot_scenario(ndk.scenarios.built_in.Scenario0)

Steady-State Wave Amplitude

Out:

Simulating scenario: Scenario0
Estimated time to complete simulation: 44 seconds. Memory required is 8.09906664298232 GB (available 73.624408064 GB). These values are approximated.
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\

Simulating scenario: scenario 1 2D

plot_scenario(ndk.scenarios.built_in.Scenario1_2D)

Steady-State Wave Amplitude

Out:

Simulating scenario: Scenario1_2D
Estimated time to complete simulation: 47 seconds. Memory required is 8.110059917325207 GB (available 73.624408064 GB). These values are approximated.
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
gcc -O3 -g -fPIC -Wall -std=c99 -march=native -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -fopenmp /tmp/devito-jitcache-uid1001/8aed0abf685aca05537adb2a263f72cdb8d7f4cf.c -lm -o /tmp/devito-jitcache-uid1001/8aed0abf685aca05537adb2a263f72cdb8d7f4cf.so

Simulating scenario: scenario 2 2D

plot_scenario(ndk.scenarios.built_in.Scenario2_2D)

Steady-State Wave Amplitude

Out:

Simulating scenario: Scenario2_2D
Estimated time to complete simulation: 1 minutes. Memory required is 8.207058332240669 GB (available 73.624408064 GB). These values are approximated.
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
/home/circleci/.cache/pypoetry/virtualenvs/neurotechdevkit-3aSsmiER-py3.10/lib/python3.10/site-packages/devito/finite_differences/differentiable.py:224: DeprecationWarning: NotImplemented should not be used in a boolean context
  return super(Differentiable, self).__eq__(other) and\
gcc -O3 -g -fPIC -Wall -std=c99 -march=native -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -fopenmp /tmp/devito-jitcache-uid1001/0ec68a19d4dc4792357f350ee80ee7e46d45a036.c -lm -o /tmp/devito-jitcache-uid1001/0ec68a19d4dc4792357f350ee80ee7e46d45a036.so

Total running time of the script: ( 1 minutes 2.504 seconds)

Download Python source code: plot_scenarios.py

Download Jupyter notebook: plot_scenarios.ipynb

Gallery generated by mkdocs-gallery