Skip to content

Commit

Permalink
finished testing
Browse files Browse the repository at this point in the history
  • Loading branch information
RemDelaporteMathurin committed Jun 10, 2024
1 parent a66238a commit ddc66f7
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion docs/source/userguide/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Settings

The settings of a FESTIM simulation are defined with a :class:`festim.Settings` object.

.. code-block:: python
.. testcode::

import festim as F

Expand Down
8 changes: 4 additions & 4 deletions docs/source/userguide/sources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Volumetric sources

Volumetric sources can be set in a simulation by using the :class:`festim.Source` class.

.. code:: python
.. testcode::

import festim as F

Expand All @@ -28,7 +28,7 @@ Implantation flux

Hydrogen implanted in a material can be simulated by a Gaussian-shaped volumetric source with the :class:`festim.ImplantationFlux` class.

.. code:: python
.. testcode::

import festim as F

Expand All @@ -51,7 +51,7 @@ Radioactive decay

Radioactive decay can be simulated by a volumetric source with the :class:`festim.RadioactiveDecay` class.

.. code:: python
.. testcode::

import festim as F

Expand All @@ -61,6 +61,6 @@ Radioactive decay can be simulated by a volumetric source with the :class:`festi
F.RadioactiveDecay(
decay_constant=1.78e-9,
volume=1,
fields="all",
field="all",
),
]
10 changes: 5 additions & 5 deletions docs/source/userguide/stepsize.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ For transient problems, a :class:`festim.Stepsize` is required.
It represents the time discretisation of the problem.
Here is an example creating a stepsize of 1.2 seconds:

.. code-block:: python
.. testcode::

import festim as F
my_stepsize = F.Stepsize(initial_value=1.2)

To use the adaptive time stepping implemented in FESTIM, the arguments ``stepsize_change_ratio`` needs to be set to a value above 1.

.. code-block:: python
.. testcode::

my_stepsize = F.Stepsize(initial_value=1.2, stepsize_change_ratio=1.5)

Expand All @@ -25,7 +25,7 @@ Moreover, if the solver doesn't converge, the stepsize will be reduced and the s
Setting the ``dt_min`` argument will prevent the stepsize from becoming too small and will stop the simulation when this happens.
To cap the stepsize after some time, the parameters ``t_stop`` and ``stepsize_stop_max`` can be used.

.. code-block:: python
.. testcode::

my_stepsize = F.Stepsize(
initial_value=1.2,
Expand All @@ -41,7 +41,7 @@ To cap the stepsize after some time, the parameters ``t_stop`` and ``stepsize_st
Another option for controlling the stepsize is to use the ``max_stepsize`` parameter. This parameter defines the maximal value of the stepsize during simulations,
and it can be set as a constant or a callable function of time:

.. code-block:: python
.. testcode::

def max_stepsize(t):
if t <= 5:
Expand All @@ -60,7 +60,7 @@ and it can be set as a constant or a callable function of time:
The ``milestones`` argument can be used to make sure the simulation passes through specific times.
This will modify the stepsize as needed.

.. code-block:: python
.. testcode::

my_stepsize = F.Stepsize(
initial_value=1.2,
Expand Down
14 changes: 9 additions & 5 deletions docs/source/userguide/temperature.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Temperature
===========

.. testsetup::

from festim import HeatTransferProblem, TemperatureFromXDMF

Definition of a temperature field or problem is essential for hydrogen transport
and FESTIM as a whole.
Regardless of how you define the temperature of the problem, it is passed to the :code:`T` attribute of the :class:`festim.Simulation` object.
Expand All @@ -12,7 +16,7 @@ Analytical expressions

The temperature can be defined as a constant value in Kelvin (K):

.. code-block:: python
.. testcode::

my_temperature = 300

Expand Down Expand Up @@ -40,7 +44,7 @@ More complex expressions can be expressed with sympy:
would be passed to FESTIM as:

.. code-block:: python
.. testcode::

from festim import x, t
import sympy as sp
Expand All @@ -49,12 +53,12 @@ would be passed to FESTIM as:

Conditional expressions are also possible:

.. code-block:: python
.. testcode::

from festim import x, t
import sympy as sp

my_temp = sp.Piecewise((400, F.t < 10), (300, True))
my_temp = sp.Piecewise((400, t < 10), (300, True))

---------------------------
From a heat transfer solver
Expand All @@ -64,7 +68,7 @@ Temperature can also be obtained by solving the heat equation.
Users can define heat transfer problems using :class:`festim.HeatTransferProblem`.


.. code-block:: python
.. testcode::

my_temp = HeatTransferProblem()

Expand Down
12 changes: 6 additions & 6 deletions docs/source/userguide/traps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ A trap in FESTIM is defined by:
* its density
* the materials where it is located

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -26,7 +26,7 @@ A trap in FESTIM is defined by:

If the trap is located in several materials, instead of creating another :class:`festim.Trap` object, simply use a list of materials:

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -37,7 +37,7 @@ If the trap is located in several materials, instead of creating another :class:

The trap density can be a function of space and time. For example:

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -52,7 +52,7 @@ The trap density can be a function of space and time. For example:

Boolean expressions can also be used to restrict the trap to certain regions:

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -76,7 +76,7 @@ Extrinsic traps
An extrinsic trap is defined as a trap with a density evolving over time.
If the temporal evolution of the trap's density is known `a priori`, then a "normal" trap can be used with a time dependent expression as density (see above).

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -94,7 +94,7 @@ Let's imagine a case where you have two subdomains. Trap 1 is defined only in th
It would be possible to define one trap in each subdomain.
Grouping traps together helps save computational time by reducing the number of degrees of freedom.

.. code-block:: python
.. testcode::

import festim as F

Expand Down
8 changes: 4 additions & 4 deletions docs/source/userguide/troubleshooting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The first thing to check is the details of the Newton solver iterations.
To do so, you must set the ``log_level`` to ``20`` (default is ``40``).
This will provide more information during the solving stage.

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -47,7 +47,7 @@ This is often due to an excessively high absolute tolerance.
The Newton solver then converges in zero iterations. In other words, nothing is solved.
First, check that this is the case by setting the log level to 20:

.. code-block:: python
.. testcode::

import festim as F

Expand All @@ -57,9 +57,9 @@ First, check that this is the case by setting the log level to 20:

Then increase the absolute tolerance of the solver:

.. code-block:: python
.. testcode::

my_model.settings = F.Settings(
...,
absolute_tolerance=1e10,
relative_tolerance=1e-10,
)

0 comments on commit ddc66f7

Please sign in to comment.