49 double m_rho_low, m_rho_high;
50 std::string m_name =
"FixedBC";
65 const double Lx = get_size(
w, 0);
66 const double dx = get_spacing(
w, 0);
67 const double xpos =
Lx *
dx - xwidth;
69 pfc::field::apply_inplace(
70 m, get_field_name(), [=](
const pfc::Real3 &
X,
double current) {
71 const double x =
X[0];
72 if (std::abs(
x -
xpos) < xwidth) {
73 const double S = 1.0 / (1.0 + std::exp(-alpha * (
x -
xpos)));
74 return m_rho_low *
S + m_rho_high * (1.0 -
S);
Definition field_modifier.hpp:240
Definition fixed_bc.hpp:44
void apply(Model &m, double) override
Apply the field modification to the model (pure virtual)
Definition fixed_bc.hpp:63
const std::string & get_modifier_name() const override
Get the name of the field modifier.
Definition fixed_bc.hpp:61
The Model class represents the physics model for simulations in OpenPFC.
Definition model.hpp:95
Core type definitions for World parameters.
std::array< int, 3 > Int3
Type aliases for clarity.
Definition types.hpp:45
Base class for initial conditions and boundary conditions.
Functional, coordinate-space field operations (header-only)
Represents the global simulation domain (the "world").
Definition world.hpp:91