.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples_gallery/simple_pdes/time_dependent_bcs.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_simple_pdes_time_dependent_bcs.py: Time-dependent boundary conditions ================================== This example solves a simple diffusion equation in one dimensions with time-dependent boundary conditions. .. GENERATED FROM PYTHON SOURCE LINES 8-21 .. image-sg:: /examples_gallery/simple_pdes/images/sphx_glr_time_dependent_bcs_001.png :alt: time dependent bcs :srcset: /examples_gallery/simple_pdes/images/sphx_glr_time_dependent_bcs_001.png :class: sphx-glr-single-img .. code-block:: Python from pde import PDE, CartesianGrid, MemoryStorage, ScalarField, plot_kymograph grid = CartesianGrid([[0, 10]], [64]) # generate grid state = ScalarField(grid) # generate initial condition eq = PDE({"c": "laplace(c)"}, bc={"value_expression": "sin(t)"}) storage = MemoryStorage() eq.solve(state, t_range=20, dt=1e-4, tracker=storage.tracker(0.1)) # plot the trajectory as a space-time plot plot_kymograph(storage) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 8.862 seconds) .. _sphx_glr_download_examples_gallery_simple_pdes_time_dependent_bcs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: time_dependent_bcs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: time_dependent_bcs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: time_dependent_bcs.zip `