varying boundary condition
double m_frequency;
public:
TimeVaryingBC(double freq) : m_frequency(freq) {}
auto& field = model.
get_real_field(get_field_name());
const auto& fft = model.
get_fft();
auto inbox = pfc::fft::get_inbox(fft);
double amplitude = std::sin(pfc::two_pi * m_frequency * time);
double dx = pfc::world::get_spacing(world, 0);
int idx = 0;
for (int k = inbox.low[2]; k <= inbox.high[2]; k++) {
for (int j = inbox.low[1]; j <= inbox.high[1]; j++) {
for (int i = inbox.low[0]; i <= inbox.high[0]; i++) {
if (i == 0) {
field[idx] = amplitude;
}
idx++;
}
}
}
}
};
Definition field_modifier.hpp:240
virtual void apply(Model &model, double time)=0
Apply the field modification to the model (pure virtual)
The Model class represents the physics model for simulations in OpenPFC.
Definition model.hpp:95
const World & get_world() const noexcept
Get the decomposition object associated with the model.
Definition model.hpp:191