22#include <nlohmann/json.hpp>
43 using Tscal = shambase::VecComponent<Tvec>;
45 static constexpr u32 dim = shambase::VectorProperties<Tvec>::dimension;
92 using Variant = std::variant<Free, Periodic, ShearingPeriodic>;
155 using Free =
typename T::Free;
156 using Periodic =
typename T::Periodic;
157 using ShearingPeriodic =
typename T::ShearingPeriodic;
160 if (
const Free *v = std::get_if<Free>(&p.config)) {
164 }
else if (
const Periodic *v = std::get_if<Periodic>(&p.config)) {
166 {
"bc_type",
"periodic"},
168 }
else if (
const ShearingPeriodic *v = std::get_if<ShearingPeriodic>(&p.config)) {
171 {
"bc_type",
"shearing_periodic"},
172 {
"shear_base", v->shear_base},
173 {
"shear_dir", v->shear_dir},
174 {
"shear_speed", v->shear_speed},
191 using Tscal = shambase::VecComponent<Tvec>;
194 if (!j.contains(
"bc_type")) {
200 j.at(
"bc_type").get_to(bc_type);
202 using Free =
typename T::Free;
203 using Periodic =
typename T::Periodic;
204 using ShearingPeriodic =
typename T::ShearingPeriodic;
207 if (bc_type ==
"free") {
209 }
else if (bc_type ==
"periodic") {
211 }
else if (bc_type ==
"shearing_periodic") {
212 p.set_shearing_periodic(
213 j.at(
"shear_base").get<i32_3>(),
214 j.at(
"shear_dir").get<i32_3>(),
215 j.at(
"speed").get<Tscal>());
std::uint32_t u32
32 bit unsigned integer
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
void throw_unimplemented(SourceLocation loc=SourceLocation{})
Throw a std::runtime_error saying that the function is unimplemented.
namespace for the sph model
void raw_ln(Types... var2)
Prints a log message with multiple arguments followed by a newline.
Tscal expand_tolerance
The tolerance for the box expansion.
Periodic boundary condition.
Shearing periodic boundary condition.
Tscal shear_speed
The speed of the shear.
i32_3 shear_dir
The direction of the shear.
i32_3 shear_base
The base of the scalar product to define the number of shearing periodicity to be applied.
Boundary conditions configuration.
void print_status()
Prints the current boundary condition configuration to the logger.
static constexpr u32 dim
Number of dimensions of the problem.
void set_periodic()
Set the boundary condition to periodic boundaries.
void set_free()
Set the boundary condition to free boundaries.
Variant config
The actual configuration (default to free boundaries).
std::variant< Free, Periodic, ShearingPeriodic > Variant
Variant of all types of artificial viscosity possible.
void set_shearing_periodic(i32_3 shear_base, i32_3 shear_dir, Tscal speed)
Set the boundary condition to shearing periodic boundaries.
shambase::VecComponent< Tvec > Tscal
Type of the components of the vector of coordinates.
Contains functions for converting between SYCL vector types and C++ standard library array types.