Mallard 0.8.0
Unstructured, GPU accelerated, high-order finite volume CFD solver
Mallard website
Loading...
Searching...
No Matches
rosenbrock.h File Reference

Adaptive Rosenbrock integrator (RODAS) with dense LU, for one stiff autonomous ODE system per thread. More...

#include <Kokkos_Core.hpp>
#include <cstdint>
#include "lanes.h"

Go to the source code of this file.

Classes

struct  chemistry::RosenbrockOptions
 
struct  chemistry::RosenbrockResult
 
struct  chemistry::NoObserver
 An observer that ignores the trajectory. More...
 
struct  chemistry::Rodas
 Coefficients of RODAS (Hairer & Wanner, Solving ODEs II, IV.7; rodas.f), a stiffly accurate, L-stable Rosenbrock method of order 4 with an embedded order-3 solution, in the form with A = I / (gamma h) - J. More...
 
struct  chemistry::DenseLU
 Dense linear solver of integrate(): A = diagonal I - J factored by lu_factor in n * n doubles (LU, like J in the lanes' layout) and n integers (pivot). More...
 

Namespaces

namespace  chemistry
 

Enumerations

enum class  chemistry::RosenbrockStatus : uint8_t { chemistry::SUCCESS = 0 , chemistry::TOO_MANY_STEPS = 1 , chemistry::STEP_SIZE_UNDERFLOW = 2 }
 

Functions

template<typename Lanes >
KOKKOS_INLINE_FUNCTION bool chemistry::lu_factor (const Lanes &lanes, const uint32_t n, double *A, uint32_t *pivot)
 Dense LU factorization with partial pivoting of the n x n matrix A (by rows, or by columns for lanes with Lanes::column_major), in place; pivot[i] is the row swapped with row i. Rows below the pivot are eliminated one per lane, each in the same order as by one thread, so the factors do not depend on the lane count.
 
KOKKOS_INLINE_FUNCTION bool chemistry::lu_factor (const uint32_t n, double *A, uint32_t *pivot)
 
template<typename Lanes >
KOKKOS_INLINE_FUNCTION void chemistry::lu_solve (const Lanes &lanes, const uint32_t n, const double *LU, const uint32_t *pivot, double *b)
 Solve A x = b in place with the factors of lu_factor, by columns: each column's updates go one row per lane.
 
KOKKOS_INLINE_FUNCTION void chemistry::lu_solve (const uint32_t n, const double *LU, const uint32_t *pivot, double *b)
 
KOKKOS_INLINE_FUNCTION constexpr uint32_t chemistry::rosenbrock_vectors_size (const uint32_t n)
 Doubles of the vectors integrate() needs for a system of size n (besides the dense J).
 
template<typename Lanes , typename System , typename Solver >
KOKKOS_INLINE_FUNCTION void chemistry::rodas_step (const Lanes &lanes, const System &system, const Solver &solver, const uint32_t n, const double h, const double *y0, const double *f0, double *const k[6], double *y, double *f_tmp)
 One RODAS step of size h from y0 with f0 = f(y0), given the factored I / (gamma h) - J.
 
template<typename Lanes , typename System , typename Solver , typename Observer = NoObserver>
KOKKOS_INLINE_FUNCTION RosenbrockResult chemistry::integrate (const Lanes &lanes, const System &system, const Solver &solver, const double t_start, const double t_end, double *y, double &h, const RosenbrockOptions &options, double *J, double *vectors, Observer &&observer=Observer())
 Integrate dy/dt = f(y) from t_start to t_end with adaptive RODAS steps and error control sqrt(mean((err_i / (atol_i + rtol max(|y0_i|, |y1_i|)))^2)) <= 1.
 

Detailed Description

Adaptive Rosenbrock integrator (RODAS) with dense LU, for one stiff autonomous ODE system per thread.

Author
Matthew Bonanni (mbona.nosp@m.nni0.nosp@m.01@gm.nosp@m.ail..nosp@m.com)
Version
0.3
Date
2026-10-03