22#include <nlohmann/json.hpp>
43 using Tscal = shambase::VecComponent<Tvec>;
92 using Variant = std::variant<Free, Periodic, ShearingPeriodic>;
122 logger::raw_ln(
"--- Bondaries config");
125 logger::raw_ln(
" Config Type : Free boundaries");
127 logger::raw_ln(
" Config Type : Periodic boundaries");
129 logger::raw_ln(
" Config Type : ShearingPeriodic (Stone 2010)");
130 logger::raw_ln(
" shear_base =", v->shear_base);
131 logger::raw_ln(
" shear_dir =", v->shear_dir);
132 logger::raw_ln(
" shear_speed =", v->shear_speed);
137 logger::raw_ln(
"--- Bondaries config config (deduced)");
139 logger::raw_ln(
"-------------");
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 to_json(nlohmann::json &j, const EOSConfig< Tvec > &p)
Serialize EOSConfig to json.
void from_json(const nlohmann::json &j, EOSConfig< Tvec > &p)
Deserializes an EOSConfig<Tvec> from a JSON object.
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.