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

Kynema-FMB API: /home/runner/work/kynema-fmb/kynema-fmb/kynema-fmb/src/step/assemble_system_matrix.hpp Source File
Kynema-FMB 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_fmb::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 =
30 TeamPolicy(num_beams, Kokkos::AUTO(), std::max(vector_length, 1));
31 auto masses_sparse_matrix_policy = TeamPolicy(num_masses, Kokkos::AUTO());
32 auto springs_sparse_matrix_policy = TeamPolicy(num_springs, Kokkos::AUTO());
33
34 Kokkos::parallel_for(
35 "ContributeBeamsToSparseMatrix", beams_sparse_matrix_policy,
37 parameters.conditioner, elements.beams.num_nodes_per_element,
38 elements.beams.element_freedom_signature, elements.beams.element_freedom_table,
39 elements.beams.system_matrix_terms, solver.A
40 }
41 );
42 Kokkos::parallel_for(
43 "ContributeMassesToSparseMatrix", masses_sparse_matrix_policy,
45 parameters.conditioner, elements.masses.element_freedom_signature,
46 elements.masses.element_freedom_table, elements.masses.system_matrix_terms, solver.A
47 }
48 );
49 Kokkos::parallel_for(
50 "ContributeSpringsToSparseMatrix", springs_sparse_matrix_policy,
52 parameters.conditioner, elements.springs.element_freedom_signature,
53 elements.springs.element_freedom_table, elements.springs.stiffness_matrix_terms, solver.A
54 }
55 );
56}
57
58} // namespace kynema_fmb::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
Beams< DeviceType > beams
Definition elements.hpp:21
Springs< DeviceType > springs
Definition elements.hpp:23
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