Skip to content

Commit

Permalink
added initial conditions from XDMF
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Jan 18, 2024
1 parent 848a733 commit ec6f4f7
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion docs/source/userguide/initial_conditions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,26 @@ The value can also be a function of space:
import festim as F
from festim import x, y, z
my_ic = F.InitialCondition(value=x**2 + y**2 + z**2, field=0)
my_ic = F.InitialCondition(value=x**2 + y**2 + z**2, field=0)
Initial conditions can also be read from a previously written XDMF file. This is useful when restarting a simulation.

.. code-block:: python
import festim as F
my_ic = F.InitialCondition(
filename="ic_file.xdmf",
label="mobile",
timestep=-1,
field=0
)
In the snipset above, the initial condition is read from the file ``ic_file.xdmf``.
The label ``mobile`` is used to identify the mesh in the file.
The timestep ``-1`` indicates that the last timestep of the file should be read.

.. note::

The XDMF file must be readable. To do so, the XDMF file has to be created with checkpointing on. See :class:`festim.XDMFExport`.
For more information on checkpointing in FEniCS, see `this page <https://fenicsproject.discourse.group/t/loading-xdmf-data-back-in/1925/4>`_.

0 comments on commit ec6f4f7

Please sign in to comment.