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

Kynema API: /home/runner/work/kynema/kynema/kynema/src/step/calculate_convergence_error.hpp Source File
Kynema API
A flexible multibody structural dynamics code for wind turbines
Loading...
Searching...
No Matches
calculate_convergence_error.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <Kokkos_Core.hpp>
4#include <Kokkos_Profiling_ScopedRegion.hpp>
5
8#include "solver/solver.hpp"
9#include "state/state.hpp"
11
12namespace kynema::step {
13
15template <typename DeviceType>
17 const StepParameters& parameters, const Solver<DeviceType>& solver,
18 const State<DeviceType>& state, const Constraints<DeviceType>& constraints
19) {
20 auto region = Kokkos::Profiling::ScopedRegion("Calculate Convergence Error");
21
22 using RangePolicy = Kokkos::RangePolicy<typename DeviceType::execution_space>;
23
24 auto sum_error_squared_system = 0.;
25 Kokkos::parallel_reduce(
26 RangePolicy(0, solver.num_system_nodes),
28 parameters.absolute_convergence_tol,
29 parameters.relative_convergence_tol,
30 parameters.h,
31 state.active_dofs,
32 state.node_freedom_map_table,
33 state.q_delta,
34 solver.x,
35 },
36 sum_error_squared_system
37 );
38 auto sum_error_squared_constraints = 0.;
39 Kokkos::parallel_reduce(
40 RangePolicy(0, constraints.num_constraints),
42 parameters.absolute_convergence_tol,
43 parameters.relative_convergence_tol,
44 solver.num_system_dofs,
45 constraints.row_range,
46 constraints.lambda,
47 solver.x,
48 },
49 sum_error_squared_constraints
50 );
51
52 const auto sum_error_squared = sum_error_squared_system + sum_error_squared_constraints;
53 return std::sqrt(sum_error_squared / static_cast<double>(solver.num_dofs));
54}
55
56} // namespace kynema::step
Definition assemble_constraints_matrix.hpp:11
double CalculateConvergenceError(const StepParameters &parameters, const Solver< DeviceType > &solver, const State< DeviceType > &state, const Constraints< DeviceType > &constraints)
Calculation based on Table 1 of DOI: 10.1115/1.4033441.
Definition calculate_convergence_error.hpp:16
Container class for managing multiple constraints in a simulation.
Definition constraints.hpp:29
size_t num_constraints
Definition constraints.hpp:35
This object manages the assembly and solution of linear system arising from the generalized-alpha bas...
Definition solver.hpp:21
size_t num_system_nodes
Definition solver.hpp:73
size_t num_dofs
Definition solver.hpp:75
Container for storing the complete system state of the simulation at a given time increment.
Definition state.hpp:18
A Struct containing the paramters used to control the time stepping process.
Definition step_parameters.hpp:12
Reduction Kernel which calculates the sum of the squares of the error for each constraint for use in ...
Definition calculate_error_sum_squares.hpp:51
Reduction Kernel which calculates the sum of the square of the errors for each node in the system for...
Definition calculate_error_sum_squares.hpp:12