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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/step/assemble_system_matrix.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
assemble_system_matrix.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <Kokkos_Profiling_ScopedRegion.hpp>
5
10#include "solver/solver.hpp"
11#include "step_parameters.hpp"
12
13namespace kynema::step {
14
15template <typename DeviceType>
17 StepParameters& parameters, Solver<DeviceType>& solver, Elements<DeviceType>& elements
18) {
19 auto region = Kokkos::Profiling::ScopedRegion("Assemble System Matrix");
20
21 using TeamPolicy = Kokkos::TeamPolicy<typename DeviceType::execution_space>;
22
23 const auto num_nodes = static_cast<int>(elements.beams.max_elem_nodes);
24 const auto num_beams = static_cast<int>(elements.beams.num_elems);
25 const auto num_masses = static_cast<int>(elements.masses.num_elems);
26 const auto num_springs = static_cast<int>(elements.springs.num_elems);
27
28 const auto vector_length = std::min(num_nodes, TeamPolicy::vector_length_max());
29 auto beams_sparse_matrix_policy = TeamPolicy(num_beams, Kokkos::AUTO(), vector_length);
30 auto masses_sparse_matrix_policy = TeamPolicy(num_masses, Kokkos::AUTO());
31 auto springs_sparse_matrix_policy = TeamPolicy(num_springs, Kokkos::AUTO());
32
33 Kokkos::parallel_for(
34 "ContributeBeamsToSparseMatrix", beams_sparse_matrix_policy,
36 parameters.conditioner, elements.beams.num_nodes_per_element,
37 elements.beams.element_freedom_signature, elements.beams.element_freedom_table,
38 elements.beams.system_matrix_terms, solver.A
39 }
40 );
41 Kokkos::parallel_for(
42 "ContributeMassesToSparseMatrix", masses_sparse_matrix_policy,
44 parameters.conditioner, elements.masses.element_freedom_signature,
45 elements.masses.element_freedom_table, elements.masses.system_matrix_terms, solver.A
46 }
47 );
48 Kokkos::parallel_for(
49 "ContributeSpringsToSparseMatrix", springs_sparse_matrix_policy,
51 parameters.conditioner, elements.springs.element_freedom_signature,
52 elements.springs.element_freedom_table, elements.springs.stiffness_matrix_terms, solver.A
53 }
54 );
55}
56
57} // namespace kynema::step
Definition assemble_constraints_matrix.hpp:11
void AssembleSystemMatrix(StepParameters &parameters, Solver< DeviceType > &solver, Elements< DeviceType > &elements)
Definition assemble_system_matrix.hpp:16
A container providing handle to all structural elements present in the model.
Definition elements.hpp:20
Masses< DeviceType > masses
Definition elements.hpp:22
Springs< DeviceType > springs
Definition elements.hpp:23
Beams< DeviceType > beams
Definition elements.hpp:21
This object manages the assembly and solution of linear system arising from the generalized-alpha bas...
Definition solver.hpp:21
CrsMatrixType A
Definition solver.hpp:77
KokkosSparse::CrsMatrix< ValueType, IndexType, DeviceType, void, IndexType > CrsMatrixType
Definition solver.hpp:65
A Struct containing the paramters used to control the time stepping process.
Definition step_parameters.hpp:12
double conditioner
Definition step_parameters.hpp:22
A Kernel which sums the system matrix contributions computed at each node in a beam into the correct ...
Definition contribute_beams_to_sparse_matrix.hpp:15
A Kernel which sums the system matrix contributions computed at a mass element's node into the correc...
Definition contribute_masses_to_sparse_matrix.hpp:15
A Kernel which sums the system matrix contributions computed at each of the nodes in a spring element...
Definition contribute_springs_to_sparse_matrix.hpp:15