23using namespace navier;
29 real_t kin_vis = 1.0 / Re_tau;
39 return delta * tanh(C * (2.0 * y - 1.0)) / tanh(C);
62 yp = (1.0 + y) *
ctx.Re_tau;
66 yp = (1.0 - y) *
ctx.Re_tau;
69 u(0) = 1.0 / k * log(1.0 + k * yp) + (C - (1.0 / k) * log(k)) * (1 - exp(
70 -yp / 11.0) - yp / 11.0 * exp(-yp / 3.0));
90int main(
int argc,
char *argv[])
99 int N =
ctx.order + 1;
100 int NL =
static_cast<int>(std::round(64.0 / N));
105 int NY = 2 *
static_cast<int>(std::round(48.0 / N));
110 for (
int i = 0; i < mesh.
GetNV(); ++i)
117 constexpr real_t zero = 0.0;
118 Vector x_translation({Lx, zero, zero});
119 Vector z_translation({zero, zero, Lz});
120 std::vector<Vector> translations = {x_translation, z_translation};
128 printf(
"NL=%d NX=%d NY=%d NZ=%d dx+=%f\n", NL, NX, NY, NZ, LC *
ctx.Re_tau);
129 std::cout <<
"Number of elements: " << mesh.
GetNE() << std::endl;
132 real_t hmin, hmax, kappa_min, kappa_max;
136 ctx.dt = 1.0 / pow(
ctx.order, 1.5) * hmin / umax;
138 auto *pmesh =
new ParMesh(MPI_COMM_WORLD, periodic_mesh);
163 bool last_step =
false;
165 flowsolver.
Setup(dt);
177 for (
int step = 0; !last_step; ++step)
179 if (
t + dt >= t_final - dt / 2)
184 flowsolver.
Step(
t, dt, step);
186 if (step % 1000 == 0)
200 printf(
"%11s %11s\n",
"Time",
"dt");
201 printf(
"%.5E %.5E\n",
t, dt);
virtual void RegisterField(const std::string &field_name, GridFunction *gf)
Add a grid function to the collection.
void SetCycle(int c)
Set time cycle (for time-dependent simulations)
void SetTime(real_t t)
Set physical time (for time-dependent simulations)
static void Init()
Initialize hypre by calling HYPRE_Init() and set default options. After calling Hypre::Init(),...
int GetNE() const
Returns number of elements.
static Mesh MakeCartesian3D(int nx, int ny, int nz, Element::Type type, real_t sx=1.0, real_t sy=1.0, real_t sz=1.0, bool sfc_ordering=true)
Creates a mesh for the parallelepiped [0,sx]x[0,sy]x[0,sz], divided into nx*ny*nz hexahedra if type =...
void GetCharacteristics(real_t &h_min, real_t &h_max, real_t &kappa_min, real_t &kappa_max, Vector *Vh=NULL, Vector *Vk=NULL)
int GetNV() const
Returns number of vertices. Vertices are only at the corners of elements, where you would expect them...
static Mesh MakePeriodic(const Mesh &orig_mesh, const std::vector< int > &v2v)
Create a periodic mesh by identifying vertices of orig_mesh.
std::vector< int > CreatePeriodicVertexMapping(const std::vector< Vector > &translations, real_t tol=1e-8) const
Creates a mapping v2v from the vertex indices of the mesh such that coincident vertices under the giv...
const real_t * GetVertex(int i) const
Return pointer to vertex i's coordinates.
static bool Root()
Return true if the rank in MPI_COMM_WORLD is zero.
static void Init(int &argc, char **&argv, int required=default_thread_required, int *provided=nullptr)
Singleton creation with Mpi::Init(argc, argv).
Class for parallel grid function.
void ProjectCoefficient(Coefficient &coeff) override
Project coeff Coefficient to this GridFunction. The projection computation depends on the choice of t...
Class for parallel meshes.
Helper class for ParaView visualization data.
void SetHighOrderOutput(bool high_order_output_)
void SetLevelsOfDetail(int levels_of_detail_)
virtual void Save() override
void SetDataFormat(VTKFormat fmt)
A general vector function coefficient.
Transient incompressible Navier Stokes solver in a split scheme formulation.
void Setup(real_t dt)
Initialize forms, solvers and preconditioners.
void AddVelDirichletBC(VectorCoefficient *coeff, Array< int > &attr)
Add a Dirichlet boundary condition to the velocity field.
ParGridFunction * GetCurrentPressure()
Return a pointer to the current pressure ParGridFunction.
void PrintTimingData()
Print timing summary of the solving routine.
void EnablePA(bool pa)
Enable partial assembly for every operator.
ParGridFunction * GetCurrentVelocity()
Return a pointer to the current velocity ParGridFunction.
void AddAccelTerm(VectorCoefficient *coeff, Array< int > &attr)
Add an acceleration term to the RHS of the equation.
void Step(real_t &time, real_t dt, int cur_step, bool provisional=false)
Compute solution at the next time step t+dt.
real_t u(const Vector &xvec)
std::function< real_t(const Vector &)> f(real_t mass_coeff)
void vel_ic_reichardt(const Vector &coords, real_t t, Vector &u)
real_t mesh_stretching_func(const real_t y)
struct s_NavierContext ctx
void vel_wall(const Vector &x, real_t t, Vector &u)
void accel(const Vector &x, real_t t, Vector &f)