DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
Grid.hpp
Go to the documentation of this file.
1#pragma once
2#include "Geometric.hpp"
3#include "Solver/Scalar.hpp"
4
5namespace DNDS::Geom
6{
7 inline void GetTanhDistributionBilateral(real x0, real x1, index NInterval, real d0, Eigen::Vector<real, Eigen::Dynamic> &d)
8 {
9 DNDS_assert(x1 > x0 && NInterval > 0);
10 real d00 = (x1 - x0) / NInterval;
11 if (d00 <= d0)
12 {
13 d.setLinSpaced(NInterval + 1, x0, x1);
14 return;
15 }
17 [&](real h)
18 { return -1 + std::tanh(h - 2 * h / NInterval) / (std::tanh(h) + verySmallReal) + d0 * 2 / (x1 - x0); },
19 1e-10, 20, 0.0, 20);
20 real Mh = std::tanh(h);
21
22 d = (Eigen::VectorXd::LinSpaced(NInterval + 1, -h, h).array().tanh() + Mh) / (2 * Mh) * (x1 - x0) + x0;
23 d(0) = x0;
24 d(NInterval) = x1;
25 }
26}
#define DNDS_assert(expr)
Debug-only assertion (compiled out when DNDS_NDEBUG is defined). Prints the expression + file/line + ...
Definition Errors.hpp:108
void GetTanhDistributionBilateral(real x0, real x1, index NInterval, real d0, Eigen::Vector< real, Eigen::Dynamic > &d)
Definition Grid.hpp:7
real BisectSolveLower(TF &&F, real v0, real v1, real fTarget, int maxIter)
Definition Scalar.hpp:10
DNDS_CONSTANT const real verySmallReal
Catch-all lower bound ("effectively zero").
Definition Defines.hpp:194
int64_t index
Global row / DOF index type (signed 64-bit; handles multi-billion-cell meshes).
Definition Defines.hpp:107
double real
Canonical floating-point scalar used throughout DNDSR (double precision).
Definition Defines.hpp:105