KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
985 stars 242 forks source link

AMGCL for structural mechanics applications #9768

Open Maziarb opened 2 years ago

Maziarb commented 2 years ago

Hi @ddemidov ,

I'm interested to know whether the AMGCL solver can be used for structural mechanics problems. Particularly, is it possible to employ it for solving static, dynamic or eigen analyses?

In order to solve a static problem, I played with AMGCL's parameters based on this issue https://github.com/KratosMultiphysics/Kratos/pull/9691#issue-1145886263, but the solver didn't converge. It would be great if you could provide some guidance in this regard.

philbucher commented 2 years ago

You could try these parameters: https://github.com/KratosMultiphysics/Kratos/pull/7846#issuecomment-736773293

ddemidov commented 2 years ago

You could try these parameters:

If that does not work, then please provide the system matrix, the RHS, and the coordinates files for the problem. These should be generated by Kratos when verbosity=4 is set. I can try to play with the amgcl parameters, but keep in mind that there are problems that amgcl is not able to solve.

Maziarb commented 2 years ago

You could try these parameters:

If that does not work, then please provide the system matrix, the RHS, and the coordinates files for the problem. These should be generated by Kratos when verbosity=4 is set. I can try to play with the amgcl parameters, but keep in mind that there are problems that amgcl is not able to solve.

For my static case, the solver converged after almost 4800 iterations! But for the dynamic case the solution terminated after "Error: WARNING:: ELEMENT ID: 1 INVERTED. DETJ0: -9.79102e-06". In the link below, you can find the matrices, the coordinates and the Kratos files: https://syncandshare.lrz.de/getlink/fiUgqMTs8RLeXrnoJYguEqvq/

ddemidov commented 2 years ago

"Error: WARNING:: ELEMENT ID: 1 INVERTED. DETJ0: -9.79102e-06"

I think this comes from Kratos, not amgcl. When I try to solve the system, I am getting NaNs in the solution immediately, even if I use the simplest one-level preconditioner, so there could be a problem with how the matrix was assembled.

Maziarb commented 2 years ago

"Error: WARNING:: ELEMENT ID: 1 INVERTED. DETJ0: -9.79102e-06"

I think this comes from Kratos, not amgcl. When I try to solve the system, I am getting NaNs in the solution immediately, even if I use the simplest one-level preconditioner, so there could be a problem with how the matrix was assembled.

Yeah I got the same error using pardiso_lu. I'll change the mesh to find the error source.

mpentek commented 2 years ago

I use these settings with MPI (OpenMP also works) for the dynamic analysis of structures, seems to work:

        "linear_solver_settings"     : {
            "solver_type"                  :"amgcl",
            "preconditioner_type"            : "amg",
            "max_iteration"                  : 500,
            "tolerance"                      : 1e-6,
            "provide_coordinates"            : false,
            "smoother_type"                  : "ilut",
            "krylov_type"                    : "bicgstab_with_gmres_fallback",
            "gmres_krylov_space_dimension"   : 100,
            "use_block_matrices_if_possible" : false,
            "coarsening_type"                : "smoothed_aggregation",
            "scaling"                        : false,
            "verbosity"                      : 1,
            "coarse_enough"                  : 100,
            "max_levels"                     : -1
        },

Alternately this might also work:

            "linear_solver_settings": {
                "solver_type": "amgcl",
                "smoother_type": "spai0",
                "krylov_type": "gmres",
                "coarsening_type": "aggregation",
                "max_iteration": 250,
                "provide_coordinates": false,
                "gmres_krylov_space_dimension": 100,
                "verbosity": 1,
                "tolerance": 1e-7,
                "scaling": false,
                "block_size": 1,
                "use_block_matrices_if_possible": true,
                "coarse_enough": 5000
            },