/home/runner/work/kynema/kynema/kynema/src/step/solve_system.hpp Source File

Kynema API: /home/runner/work/kynema/kynema/kynema/src/step/solve_system.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
solve_system.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <Kokkos_Profiling_ScopedRegion.hpp>
5
9#include "solver/solver.hpp"
10#include "step_parameters.hpp"
11
12namespace kynema::step {
13
14template <typename DeviceType>
15inline void SolveSystem(StepParameters& parameters, Solver<DeviceType>& solver) {
16 auto region = Kokkos::Profiling::ScopedRegion("Solve System");
17
18 using RangePolicy = Kokkos::RangePolicy<typename DeviceType::execution_space>;
19
20 Kokkos::parallel_for(
21 "ConditionR", RangePolicy(0, solver.num_system_dofs),
22 solver::ConditionR<DeviceType>{parameters.conditioner, solver.b}
23 );
24
25 KokkosBlas::scal(solver.b, -1., solver.b);
26
27 {
28 auto solve_region = Kokkos::Profiling::ScopedRegion("Linear Solve");
29 dss::numeric_factorization(solver.handle, solver.A);
30 dss::solve(solver.handle, solver.A, solver.b, solver.x);
31 }
32
33 Kokkos::parallel_for(
34 "UnconditionSolution", RangePolicy(0, solver.num_dofs - solver.num_system_dofs),
36 solver.num_system_dofs, parameters.conditioner, solver.x
37 }
38 );
39}
40
41} // namespace kynema::step
void solve(DSSHandleType &dss_handle, CrsMatrixType &A, MultiVectorType &b, MultiVectorType &x)
Definition dss_solve.hpp:45
void numeric_factorization(DSSHandleType &dss_handle, CrsMatrixType &A)
Definition dss_numeric.hpp:45
Definition assemble_constraints_matrix.hpp:11
void SolveSystem(StepParameters &parameters, Solver< DeviceType > &solver)
Definition solve_system.hpp:15
This object manages the assembly and solution of linear system arising from the generalized-alpha bas...
Definition solver.hpp:21
MultiVectorType x
Definition solver.hpp:79
MultiVectorType b
Definition solver.hpp:78
CrsMatrixType A
Definition solver.hpp:77
size_t num_dofs
Definition solver.hpp:75
HandleType handle
Definition solver.hpp:81
size_t num_system_dofs
Definition solver.hpp:74
A Struct containing the paramters used to control the time stepping process.
Definition step_parameters.hpp:12
A Kernel which applies the given factor to the system RHS vector.
Definition condition_system.hpp:11
A Kernel which divides the RHS vector terms corresponding to the constraints by a given conditioner f...
Definition condition_system.hpp:24