transiflow.interface.HYMLS
- class Interface(parameters, nx, ny, nz=1, dim=None, dof=None, boundary_conditions=None, comm=None)
Bases:
InterfaceThis class defines an interface to the HYMLS backend for the discretization. This backend can be used for parallel simulations. It uses the HYMLS preconditioner for solving linear systems.
The HYMLS backend partitions the domain into Cartesian subdomains, while solving linear systems on skew Cartesian subdomains to deal with the C-grid discretization. The subdomains will be distributed over multiple processors if MPI is used to run the application.
See
Discretizationfor the descriptions of the constructor arguments.- Parameters:
- parametersdict
Key-value pairs that can be used to modify parameters in the discretization as well as the preconditioner, iterative solver and eigenvalue solver.
- array_from_vector(vector)
Create a numpy array suitable for postprocessing from a state vector.
- eigs(state, return_eigenvectors=False, enable_recycling=False)
Compute the generalized eigenvalues of $\beta * J(u, p) * v = \alpha * M(p) * v$.
- Parameters:
- statearray_like
State $u$ at which to evaluate $J(u, p)$.
- return_eigenvectorsbool, optional
Whether to return the eigenvectors $v$.
- enable_recyclingbool, optional
Whether to use the previous eigenvalue space as initial search space.
- Returns:
- eigsarray_like
Eigenvalues $\alpha / \beta$.
- varray_like
Corresponding eigenvectors in case
return_eigenvectorsisTrue.
- get_comm_rank()
Get the rank of the current processor.
- get_comm_size()
Get the total number of processors.
- get_parameter(name)
Get a parameter value from the discretization.
- Parameters:
- namestr
Name of the parameter in the parameter list.
- jacobian(state)
Compute the Jacobian matrix $J(u, p)$ of the right-hand side of the DAE. That is the Jacobian matrix of $F(u, p)$ in
\[M(p) \frac{\d u}{\d t} = F(u, p)\]The Jacobian matrix is computed on the overlapping subdomain map and then distributed using the non-overlapping map that is used by the linear solver.
- Parameters:
- statearray_like
State $u$ at which to evaluate $J(u, p)$.
- Returns:
- jacEpetra.FECrsMatrix
The matrix $J(u, p)$ in a CSR matrix format that allows for distributing the overlap.
- load_json(name)
Load the an object from a json file.
- Parameters:
- namestr
Name of the file without extension.
- load_parameters(name)
Load the parameter set from a file.
- Parameters:
- namestr
Name of the file without extension.
- load_state(name)
Load the state
xalong with the current parameter set.- Parameters:
- namestr
Name of the file.
- mass_matrix()
Compute the mass matrix of the DAE. That is the mass matrix $M(p)$ in
\[M(p) \frac{\d u}{\d t} = F(u, p)\]The mass matrix is computed on the overlapping subdomain map and then distributed using the non-overlapping map that is used by the linear solver.
- Returns:
- massEpetra.FECrsMatrix
The matrix $M(p)$ in a CSR matrix format that allows for distributing the overlap.
- rhs(state)
Compute the right-hand side of the DAE. That is the right-hand side $F(u, p)$ in
\[M(p) \frac{\d u}{\d t} = F(u, p)\]The RHS is computed on the overlapping subdomain map and then distributed using the non-overlapping map that is used by the linear solver.
- Parameters:
- statearray_like
State $u$ at which to evaluate $F(u, p)$.
- Returns:
- rhsarray_like
The value of $F(u, p)$.
- save_json(name, obj)
Save an object to a json file
- Parameters:
- namestr
Name of the file.
- objAny
Serializable object to save to the file.
- save_parameters(name)
Save the current parameter set to a file.
- Parameters:
- namestr
Name of the file without extension.
- save_state(name, x)
Save the state
xalong with the current parameter set.- Parameters:
- namestr
Name of the file.
- xarray_like
State at the current parameter values.
- set_parameter(name, value)
Set a parameter in the discretization.
- Parameters:
- namestr
Name of the parameter in the parameter list.
- valuescalar
Value of the parameter.
- solve(jac, rhs, rhs2=None, V=None, W=None, C=None, solver=None)
Solve $J(u, p) y = x$ for $y$.
- Parameters:
- jacMatrix
The Jacobian matrix $J(u, p)$ as returned by
jacobian().- rhsarray_like
The right-hand side vector $x$.
- rhs2array_like, optional
Extension of
rhsin case a bordered system is solved.- Varray_like, optional
Border case a bordered system
[A, V; W^T, C] [y; y2] = [x; x2]is solved.- Warray_like, optional
Border case a bordered system
[A, V; W^T, C] [y; y2] = [x; x2]is solved.- Cmatrix_like, optional
Border case a bordered system
[A, V; W^T, C] [y; y2] = [x; x2]is solved.
- vector(*args)
Return a zero-initialized state vector suitable for the currently defined problem type.
- vector_from_array(array)
Create a state vector suitable for this interface from an array.