mtnlion.solution module

Tools for access and storage of simulation solutions.

class mtnlion.solution.Solution(problem_space: mtnlion.problem_space.ProblemSpaceAssembler, save_list: List[str], dae_space: dolfin.FunctionSpace)[source]

Bases: object

This class provides an interface for converting FEniCS functions into numpy-based solutions

get_1d(function: dolfin.Function, all_funcs=False) → Dict[str, mtnlion.domain.Domain[str, numpy.ndarray]][source]

Retrieve the one dimensional values from the given mixed element space function.

Parameters
  • function

  • all_funcs

Returns

static interp_time(time: numpy.ndarray, domain: Mapping[str, mtnlion.domain.Domain[str, numpy.ndarray]])[source]

Create an interpolation function for each of the solutions in storage :param time: The times at which to :param domain: Data to interpolate :return: Interpolation functions for the solution

project(function: Mapping[str, mtnlion.domain.Domain[str, ufl.core.expr.Expr]])[source]

Project an expression onto the DAE space

Parameters

function – Non mixed-element function

save_solution(iteration: int, time: float)[source]

Save the state of the solution vector given the iteration and current time.

Parameters
  • iteration – current simulation iteration

  • time – time at the same iteration

set_solution_time_steps(num_time_steps: int) → None[source]

Initialize the solution storage for the specified number of iterations

Parameters

num_time_steps – number of iterations in the simulation