38 template <
typename T_GRID,
typename T>
40 : m_grid(grid), m_inputs(inputs)
44 template <
typename T_GRID,
typename T>
49 template <
typename T_GRID,
typename T>
55 const auto& velocity_name = m_inputs.
name;
59 auto& velocity = levelset_velocity.
velocity();
63 "GALS::ANALYTICAL_FIELDS::Velocity::compute: CIRCULAR velocity field for 1D grid.");
65 T coeff =
pi() /
static_cast<T
>(3.15);
68 for (
int i = 0; i < num_cells[0]; ++i)
69 for (
int j = 0; j < num_cells[1]; ++j)
70 for (
int k = 0; k < num_cells[2]; ++k) {
71 for (
int cmpt = 0; cmpt < T_GRID::dim; ++cmpt) {
72 if (cmpt == 0) velocity_node[cmpt] = coeff * (m_inputs.
center[cmpt] - positions(i, j, k)[cmpt + 1]);
73 if (cmpt == 1) velocity_node[cmpt] = coeff * (positions(i, j, k)[cmpt - 1] - m_inputs.
center[cmpt]);
76 velocity(i, j, k) = velocity_node;
83 for (
int i = 0; i < num_cells[0]; ++i)
84 for (
int j = 0; j < num_cells[1]; ++j)
85 for (
int k = 0; k < num_cells[2]; ++k) {
86 for (
int cmpt = 0; cmpt < T_GRID::dim; ++cmpt) {
87 for (
int derv = 0; derv < T_GRID::dim; ++derv) {
88 if (cmpt == 0 && derv == 0) velocity_gradient[cmpt][derv] =
static_cast<T
>(0);
89 if (cmpt == 0 && derv == 1) velocity_gradient[cmpt][derv] = -coeff;
90 if (cmpt == 1 && derv == 0) velocity_gradient[cmpt][derv] = coeff;
91 if (cmpt == 1 && derv == 1) velocity_gradient[cmpt][derv] =
static_cast<T
>(0);
Array< T_GRID, Mat3< T > > & velocityGradient()
#define GALS_FUNCTION_NOT_IMPLEMENTED(var)
static std::map< std::string, VelocityFieldNames > velocity_name_map
Array< T_GRID, Vec3< T > > & velocity()
void compute(const GALS::CPU::Array< T_GRID, GALS::CPU::Vec3< T >> &positions, const T time, GALS::CPU::LevelsetVelocity< T_GRID, T > &levelset_velocity)