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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/step/assemble_system_residual.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
assemble_system_residual.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <Kokkos_Profiling_ScopedRegion.hpp>
5
11#include "solver/solver.hpp"
12#include "state/state.hpp"
13
14namespace kynema::step {
15
16template <typename DeviceType>
19) {
20 auto region = Kokkos::Profiling::ScopedRegion("Assemble System Residual");
21
22 using RangePolicy = Kokkos::RangePolicy<typename DeviceType::execution_space>;
23 using TeamPolicy = Kokkos::TeamPolicy<typename DeviceType::execution_space>;
24
25 const auto num_nodes = static_cast<int>(state.num_system_nodes);
26 const auto num_beams = static_cast<int>(elements.beams.num_elems);
27 const auto num_masses = static_cast<int>(elements.masses.num_elems);
28 const auto num_springs = static_cast<int>(elements.springs.num_elems);
29
30 auto forces_vector_policy = RangePolicy(0, num_nodes);
31 auto beams_vector_policy = TeamPolicy(num_beams, Kokkos::AUTO());
32 auto masses_vector_policy = RangePolicy(0, num_masses);
33 auto springs_vector_policy = RangePolicy(0, num_springs);
34
35 Kokkos::parallel_for(
36 "ContributeForcesToVector", forces_vector_policy,
39 }
40 );
41 Kokkos::fence();
42 Kokkos::parallel_for(
43 "ContributeBeamsToVector", beams_vector_policy,
45 elements.beams.num_nodes_per_element, elements.beams.element_freedom_table,
46 elements.beams.residual_vector_terms, solver.b
47 }
48 );
49 Kokkos::fence();
50 Kokkos::parallel_for(
51 "ContributeMassesToVector", masses_vector_policy,
53 elements.masses.element_freedom_table, elements.masses.residual_vector_terms, solver.b
54 }
55 );
56 Kokkos::fence();
57 Kokkos::parallel_for(
58 "ContributeSpringsToVector", springs_vector_policy,
60 elements.springs.element_freedom_table, elements.springs.residual_vector_terms, solver.b
61 }
62 );
63 Kokkos::fence();
64}
65
66} // namespace kynema::step
Definition assemble_constraints_matrix.hpp:11
void AssembleSystemResidual(Solver< DeviceType > &solver, Elements< DeviceType > &elements, State< DeviceType > &state)
Definition assemble_system_residual.hpp:17
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
MultiVectorType b
Definition solver.hpp:78
Container for storing the complete system state of the simulation at a given time increment.
Definition state.hpp:18
View< dof::FreedomSignature * > node_freedom_allocation_table
Definition state.hpp:25
size_t num_system_nodes
Definition state.hpp:23
View< size_t * > node_freedom_map_table
Definition state.hpp:27
View< double *[6]> f
Definition state.hpp:37
A Kernel which sums the residual contributions computed at each node in a beam into the correct locat...
Definition contribute_beams_to_vector.hpp:12
A Kernel which sums the nodal forces into the global RHS vector.
Definition contribute_forces_to_vector.hpp:13
A Kernel which sums the residual contributions computed at a mass element's node into the correct loc...
Definition contribute_masses_to_vector.hpp:12
A Kernel which sums the residual contributions computed at each of the nodes in a spring element into...
Definition contribute_springs_to_vector.hpp:12