1 #include <vtestbed/base/constants.hh>     2 #include <vtestbed/config/openmp.hh>     3 #include <vtestbed/config/real_type.hh>     4 #include <vtestbed/core/derivative.hh>     5 #include <vtestbed/core/grid_interpolation.hh>     6 #include <vtestbed/core/wave_pressure.hh>     8 using vtb::core::Policy;
    25             using typename base_type::array3;
    26             using typename base_type::array4;
    27             using typename base_type::vec3;
    31             void solve(
const grid3& wavy_surface_grid,
    33                        const grid4& phi_grid,
    34                        array4 velocity_potential,
    39                 const grid4& phi_grid,
    40                 const array4& velocity_potential,
    41                 const array3& wavy_surface,
    45             calculate_pressure_force(
    46                 const grid4& pressure_grid,
    59     const grid3& wavy_surface_grid,
    61     const grid4& phi_grid,
    62     array4 velocity_potential,
    66     using blitz::RectDomain;
    67     grid3 grid_xyz = phi_grid.select(2,3,1);
    69         grid_xyz = clamp(grid_xyz, panels);
    70         if (grid_xyz.empty()) { 
return; }
    73     RectDomain<3> rect{grid_xyz.begin(), grid_xyz.end()-1};
    74     const auto _ = Range::all();
    75     const grid4& smaller_grid = phi_grid(_,rect[2],rect[0],rect[1]);
    76     array4 phi(velocity_potential(_,rect[2],rect[0],rect[1]));
    77     array4 pressure(smaller_grid.shape());
    78     this->calculate_pressure(smaller_grid, phi, wavy_surface, pressure);
    79     this->calculate_pressure_force(smaller_grid, pressure, panels);
    94     const auto& delta = grid.delta();
    95     const auto g = this->g();
    96     constexpr 
auto p0 = constants<T>::atmospheric_pressure();
    99         [&](
const int4& idx) {
   100             const T z = grid(idx(1),1);
   101             const auto& grad = gradient(idx, delta, phi);
   102             pressure(idx) = p0-this->density() * (
   103                 grad(0) + T(0.5)*(pow2(grad(1)) + pow2(grad(2)) + pow2(grad(3))) +
   114     const grid4& pressure_grid,
   119     const auto _ = Range::all();
   120     const auto& new_pressure_grid = pressure_grid.select(1,2,3);
   121     Array<T,3> new_pressure(pressure(pressure_grid.num_patches(0),_,_,_));
   123     const int npanels = panels.size();
   124     #if defined(VTB_WITH_OPENMP)   125     #pragma omp parallel for   127     for (
int i=0; i<npanels; ++i) {
   128         panel_type& panel = panels[i];
   129         const auto& centre = panel.centre();
   130         vec3 x{centre(2), centre(0), centre(1)};
   131         panel.force() = interpolate(x) * (-panel.normal()) * panel.area();
   137 vtb::core::make_wave_pressure_solver<VTB_REAL_TYPE,Policy::OpenMP>()
 
Base class for all wave pressure solvers.
Triangular ship hull panel (face).