Author Topic: Solving a given linear system with solvers in Kratos  (Read 569 times)

DanielB

  • Newbie
  • *
  • Posts: 17
Solving a given linear system with solvers in Kratos
« on: February 18, 2016, 11:23:43 AM »
Dear all,

since this forum is new, I am not quite sure whether this is the right place to pose this question. So if not I would be happy for any hints towards what to do better.

‚ÄčI have a linear system with a large sparse, positive definite matrix that I want to solve. It has nothing to do with finite elements (in fact it comes from a radial basis interpolation). Can I use the solvers in Kratos (e.g. CG) to solve that system? If yes, how?

Thanks for any help!

Best,
Daniel

MikeA

  • Newbie
  • *
  • Posts: 21
Re: Solving a given linear system with solvers in Kratos
« Reply #1 on: February 19, 2016, 01:00:35 PM »
I'll post my response here now that I am a forum member.

I just committed a new trilinos solver for solving large linear elastic problems. It is intended for structural problems but would probably be suitable for your problem.


To use it, copy the


trilinos_mesh_solver_structural_similarity.py


and rename it to something suitable for your application. The script imports the new linear solver called


trilinos_linear_elastic_ml_solver.py.


This solver is set by default to solve linear elastic problems where only the right hand side changes between solves. So it only computes the preconditioner the first time solve() is called. If your left hand side matrix is changing between solves, you can replace the line


self.linear_solver = trilinos_linear_elastic_ml_solver.MultilevelLinearSolver(linear_tol, nit_max)


with the lines


self.linear_solver = trilinos_linear_elastic_ml_solver.MultilevelLinearSolver(linear_tol, nit_max)
self.linear_solver.SetReformPrecAtEachStep(True)

MikeA

  • Newbie
  • *
  • Posts: 21
Re: Solving a given linear system with solvers in Kratos
« Reply #2 on: February 19, 2016, 01:52:09 PM »
I should add here that you also need to change the strategy because the structural mesh moving strategy will not work for your problem. I posted further info about the trilinos case in a new thread under Structural Application.

riccardo

  • Global Moderator
  • Newbie
  • *****
  • Posts: 47
Re: Solving a given linear system with solvers in Kratos
« Reply #3 on: February 19, 2016, 06:40:06 PM »
Hi Daniel,

The big question is: how is the system stored? In ublas? Plane CSR? Do you have access in python to the underlying arrays?

Cheers
Riccardo