Skip to content

Cache assemblers and interpolators. #749

Description

@JHopeCollins

assemble(form, **kwargs) and interpolate(form, **kwargs) internally create an Assembler or Interpolator object respectively. Creating those objects takes some symbolic work which you don't want to be doing repeatedly in a timestepping loop.

The Assembler is cached on the form, but it still takes some work to build the cache key and identify which Assembler is needed.

You can front load all this work using get_assembler and get_interpolator to manually save the Assembler and Interpolator objects, then call the methods on those objects yourself when needed.
This is equivalent to manually creating the Projector objects, which is already done in various places in gusto.

Example of creating the assembler:

https://github.com/firedrakeproject/firedrake/blob/f545557e7fff63dd1b94fe08362abebddf7e51ee/firedrake/matrix_free/operators.py#L163-L166

and calling the assembler:

https://github.com/firedrakeproject/firedrake/blob/f545557e7fff63dd1b94fe08362abebddf7e51ee/firedrake/matrix_free/operators.py#L227

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions