From 5044228967abc786857edbf7c4dd73e497f9afe4 Mon Sep 17 00:00:00 2001 From: jpekkila Date: Fri, 26 Jul 2019 14:22:22 +0300 Subject: [PATCH] The text editor I use to edit stuff remotely is a complete piece of &^$%$, does not synchronize the files correctly. This commit fixes the issues introduced in the last commit --- src/standalone/main.cc | 4 ++-- src/standalone/model/host_timestep.cc | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/standalone/main.cc b/src/standalone/main.cc index 0e14842..48d5fc6 100644 --- a/src/standalone/main.cc +++ b/src/standalone/main.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2018, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. This file is part of Astaroth. @@ -28,8 +28,8 @@ #include #include -#include "src/core/errchk.h" #include "run.h" +#include "src/core/errchk.h" // Write all errors from stderr to an in the current working // directory diff --git a/src/standalone/model/host_timestep.cc b/src/standalone/model/host_timestep.cc index 9245cef..fd8d0ce 100644 --- a/src/standalone/model/host_timestep.cc +++ b/src/standalone/model/host_timestep.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2014-2018, Johannes Pekkilae, Miikka Vaeisalae. + Copyright (C) 2014-2019, Johannes Pekkilae, Miikka Vaeisalae. This file is part of Astaroth. @@ -33,25 +33,28 @@ static AcReal timescale = AcReal(1.0); AcReal host_timestep(const AcReal& umax, const AcMeshInfo& mesh_info) { - const long double cdt = mesh_info.real_params[AC_cdt]; - const long double cdtv = mesh_info.real_params[AC_cdtv]; + const long double cdt = mesh_info.real_params[AC_cdt]; + const long double cdtv = mesh_info.real_params[AC_cdtv]; // const long double cdts = mesh_info.real_params[AC_cdts]; const long double cs2_sound = mesh_info.real_params[AC_cs2_sound]; - const long double nu_visc = mesh_info.real_params[AC_nu_visc]; - const long double eta = mesh_info.real_params[AC_eta]; - const long double chi = 0; // mesh_info.real_params[AC_chi]; // TODO not calculated - const long double gamma = mesh_info.real_params[AC_gamma]; - const long double dsmin = mesh_info.real_params[AC_dsmin]; + const long double nu_visc = mesh_info.real_params[AC_nu_visc]; + const long double eta = mesh_info.real_params[AC_eta]; + const long double chi = 0; // mesh_info.real_params[AC_chi]; // TODO not calculated + const long double gamma = mesh_info.real_params[AC_gamma]; + const long double dsmin = mesh_info.real_params[AC_dsmin]; // Old ones from legacy Astaroth - //const long double uu_dt = cdt * (dsmin / (umax + cs_sound)); - //const long double visc_dt = cdtv * dsmin * dsmin / nu_visc; + // const long double uu_dt = cdt * (dsmin / (umax + cs_sound)); + // const long double visc_dt = cdtv * dsmin * dsmin / nu_visc; // New, closer to the actual Courant timestep // See Pencil Code user manual p. 38 (timestep section) const long double uu_dt = cdt * dsmin / (fabsl(umax) + sqrtl(cs2_sound + 0.0l)); - const long double visc_dt = cdtv * dsmin * dsmin / max(max(nu_visc, eta), max(gamma, chi));// + 1; // TODO NOTE: comment the +1 out to get scientifically accurate results - //MV: White the +1? It was messing up my computations! + const long double visc_dt = cdtv * dsmin * dsmin / + max(max(nu_visc, eta), + max(gamma, chi)); // + 1; // TODO NOTE: comment the +1 out to + // get scientifically accurate results + // MV: White the +1? It was messing up my computations! const long double dt = min(uu_dt, visc_dt); return AcReal(timescale) * AcReal(dt);