34#ifndef PFC_INITIAL_CONDITIONS_SEED_GRID_HPP
35#define PFC_INITIAL_CONDITIONS_SEED_GRID_HPP
39#include "../field_modifier.hpp"
47 int m_Nx = 1, m_Ny = 2, m_Nz = 2;
48 double m_X0, m_radius;
49 double m_rho, m_amplitude;
53 void set_Nx(
int Nx) { m_Nx =
Nx; }
54 void set_Ny(
int Ny) { m_Ny =
Ny; }
55 void set_Nz(
int Nz) { m_Nz =
Nz; }
56 void set_X0(
double X0) { m_X0 =
X0; }
58 void set_density(
double rho) { m_rho =
rho; }
62 int get_Nx()
const {
return m_Nx; }
63 int get_Ny()
const {
return m_Ny; }
64 int get_Nz()
const {
return m_Nz; }
65 double get_X0()
const {
return m_X0; }
66 double get_radius()
const {
return m_radius; }
67 double get_density()
const {
return m_rho; }
68 double get_amplitude()
const {
return m_amplitude; }
73 : m_Nx(1), m_Ny(
Ny), m_Nz(
Nz), m_X0(
X0), m_radius(
radius) {}
78 const auto size = get_size(
w);
79 const auto spacing = get_spacing(
w);
81 std::vector<Seed>
seeds;
85 const double radius = get_radius();
87 const double Dy = spacing[1] * size[1] /
Ny;
88 const double Dz = spacing[2] * size[2] /
Nz;
89 const double X0 = m_X0;
90 const double Y0 =
Dy / 2.0;
91 const double Z0 =
Dz / 2.0;
94 std::cout <<
"Generating " <<
nseeds <<
" regular seeds with radius " <<
radius
97 std::mt19937_64
re(42);
98 std::uniform_real_distribution<double>
rt(-0.2 *
radius, 0.2 *
radius);
99 std::uniform_real_distribution<double>
rr(0.0, 8.0 *
atan(1.0));
101 for (
int j = 0;
j <
Ny;
j++) {
102 for (
int k = 0;
k <
Nz;
k++) {
112 pfc::field::apply(
m, get_field_name(), [
seeds](
const pfc::Real3 &
X) {
114 if (
seed.is_inside(
X)) {
115 return seed.get_value(
X);
Definition field_modifier.hpp:240
The Model class represents the physics model for simulations in OpenPFC.
Definition model.hpp:95
Definition seed_grid.hpp:45
void apply(Model &m, double) override
Apply the field modification to the model (pure virtual)
Definition seed_grid.hpp:75
Seed is a helper class to construct various of initial conditions.
Definition seed.hpp:39
Functional, coordinate-space field operations (header-only)
Helper class for constructing spherical seed initial conditions.
Represents the global simulation domain (the "world").
Definition world.hpp:91