Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ComputeCFL.hpp
Go to the documentation of this file.
1// -------------------------------------------------------//
2//
3// SHAMROCK code for hydrodynamics
4// Copyright (c) 2021-2026 Timothée David--Cléris <tim.shamrock@proton.me>
5// SPDX-License-Identifier: CeCILL Free Software License Agreement v2.1
6// Shamrock is licensed under the CeCILL 2.1 License, see LICENSE for more information
7//
8// -------------------------------------------------------//
9
10#pragma once
11
18
19#include "shambackends/vec.hpp"
25
27
28 template<class Tvec, class TgridVec>
29 class ComputeCFL {
30
31 public:
32 using Tscal = shambase::VecComponent<Tvec>;
33 using Tgridscal = shambase::VecComponent<TgridVec>;
34 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
35 static constexpr u32 split_count = shambase::pow_constexpr<dim>(2);
36
37 using Config = SolverConfig<Tvec, TgridVec>;
39 using u_morton = u64;
40 using AMRBlock = typename Config::AMRBlock;
41 using OrientedAMRGraph = OrientedAMRGraph<Tvec, TgridVec>;
42
43 ShamrockCtx &context;
44 Config &solver_config;
45 Storage &storage;
46
47 ComputeCFL(ShamrockCtx &context, Config &solver_config, Storage &storage)
48 : context(context), solver_config(solver_config), storage(storage) {}
49
51 Tscal compute_cfl();
52 Tscal compute_dust_cfl();
53
54 private:
55 inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); }
56
58 template<shammath::FluidStateSpec FSpec>
59 void compute_cfl_gas(shamrock::ComputeField<Tscal> &cfl_dt, FSpec fluid);
60 };
61
62} // namespace shammodels::basegodunov::modules
std::uint32_t u32
32 bit unsigned integer
std::uint64_t u64
64 bit unsigned integer
The MPI scheduler.
Tscal compute_cfl()
Gas CFL timestep, using the equation of state selected in solver_config.eos_config.
constexpr T pow_constexpr(T a) noexcept
Calculates the power of a number at compile time.
Definition integer.hpp:174
T & get_check_ref(const std::unique_ptr< T > &ptr, SourceLocation loc=SourceLocation())
Takes a std::unique_ptr and returns a reference to the object it holds. It throws a std::runtime_erro...
Definition memory.hpp:112
namespace for the basegodunov model modules
Gas and dust conservative/primitive states and axis-transform helpers shared by every gas and dust Ri...