Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classes for making standard monitor functions #114

Merged
merged 22 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions demos/monge_ampere_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,21 +73,16 @@
#
# for some values of the parameters :math:`\alpha`, :math:`\beta`, and :math:`\gamma`.
# Unity is added at the start to ensure that the monitor function doesn't get too
# close to zero.
# close to zero. Here we can think of :math:`\alpha` as relating to the amplitude of the
# monitor function, :math:`\beta` as relating to the width of the ring, and
# :math:`\gamma` as the radius of the ring.
#
# Here we can think of :math:`\alpha` as relating to the amplitude of the monitor
# function, :math:`\beta` as relating to the width of the ring, and :math:`\gamma` as
# the radius of the ring.


def ring_monitor(mesh):
alpha = Constant(20.0)
beta = Constant(200.0)
gamma = Constant(0.15)
x, y = SpatialCoordinate(mesh)
r = (x - 0.5) ** 2 + (y - 0.5) ** 2
return Constant(1.0) + alpha / cosh(beta * (r - gamma)) ** 2
# For convenience, Movement provides a builder class for ring monitors,
# :class:`~movement.monitor.RingMonitorBuilder`, amongst other commonly used
# monitor functions. ::

mb = RingMonitorBuilder(centre=(0.5, 0.5), radius=0.4, amplitude=20.0, width=200.0)
ring_monitor = mb.get_monitor()

# With an initial mesh and a monitor function, we are able to construct a
# :class:`~movement.monge_ampere.MongeAmpereMover` instance and adapt the mesh. By
Expand Down
1 change: 1 addition & 0 deletions movement/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from movement.monitor import * # noqa
from movement.tangling import * # noqa

from movement.laplacian_smoothing import * # noqa
Expand Down
Loading
Loading