Module simpa.core

Class Solver

java.lang.Object
simpa.core.api.Solver

public class Solver extends Object
Class for calculating the strength of sources.
  • Field Details

    • logger

      public static final org.apache.logging.log4j.Logger logger
  • Constructor Details

    • Solver

      public Solver(List<SurfacePoint> spoints, FieldType type)
      Constructor for direct solver
      Parameters:
      spoints - List of surface points.
    • Solver

      public Solver(List<SurfacePoint> spoints, FieldType type, SolverOptions opts)
      Parameters:
      spoints - List of surface points.
      type - The field type: static magnetic, static electric.
      opts - Options specifying the preconditioner type and its parameters.
    • Solver

      public Solver(FieldType type, List<List<SurfacePoint>> slices, SolverOptions opts)
      Special constructor for the slice preconditioner. This is useful for accelerator elements or anything which can be partitioned to slices.
      Parameters:
      type - The field type: static magnetic, static electric, or RF (not yet implemented).
      slices - List of not overlapping slices of the surface foints.
      opts - Options specifying the preconditioner type and its parameters. Since this constructor is specially made for the slice preconditioner, the preconditioner type inside the options should be always Preconditioner.SLICE and the solver is SolverType.GMRES
  • Method Details

    • solve

      public void solve(double relativeError)
      Calculates the strength of the sources and saves it to a file.
      Parameters:
      relativeError - Allowed relative error.
    • getResidual

      public double getResidual()
      Returns the relative error between the reproduced field by the sources and the given field by the user. After solving A.x=b, the relative norm error is: |b-A.x|/|b]
      Returns:
      The residual error.