Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
ExternalForces.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
19
21#include "shambackends/vec.hpp"
25
27
28 template<class Tvec, template<class> class SPHKernel>
29 class ExternalForces {
30 public:
31 using Tscal = shambase::VecComponent<Tvec>;
32 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
33 using Kernel = SPHKernel<Tscal>;
34
35 using Config = SolverConfig<Tvec, SPHKernel>;
36 using Storage = SolverStorage<Tvec, u32>;
37
38 ShamrockCtx &context;
39 Config &solver_config;
40 Storage &storage;
41
42 ExternalForces(ShamrockCtx &context, Config &solver_config, Storage &storage)
43 : context(context), solver_config(solver_config), storage(storage) {}
44
50
56 void add_ext_forces();
57
58 void point_mass_accrete_particles();
59
60 private:
61 using SolverConfigExtForce = typename Config::ExtForceConfig;
62 using EF_PointMass = typename SolverConfigExtForce::PointMass;
63 using EF_PN_PW = typename SolverConfigExtForce::PN_PW;
64 using EF_LenseThirring = typename SolverConfigExtForce::LenseThirring;
65 using EF_ShearingBoxForce = typename SolverConfigExtForce::ShearingBoxForce;
66 using EF_VerticalDiscPotential = typename SolverConfigExtForce::VerticalDiscPotential;
67 using EF_VelocityDissipation = typename SolverConfigExtForce::VelocityDissipation;
68
69 inline PatchScheduler &scheduler() { return shambase::get_check_ref(context.sched); }
70 };
71
72} // namespace shammodels::sph::modules
std::uint32_t u32
32 bit unsigned integer
The MPI scheduler.
void add_ext_forces()
add external forces to the particle acceleration, note that forces dependant on velocity shlould be a...
void compute_ext_forces_indep_v()
is ran once per timestep, it computes the forces that are independant of velocity
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:110
namespace for the sph model modules
The configuration for a sph solver.
shammodels::ExtForceConfig< Tvec > ExtForceConfig
External force configuration.