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

This commit is contained in:
jpekkila
2019-07-26 14:22:22 +03:00
parent b90d261e89
commit 5044228967
2 changed files with 17 additions and 14 deletions

View File

@@ -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. This file is part of Astaroth.
@@ -28,8 +28,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "src/core/errchk.h"
#include "run.h" #include "run.h"
#include "src/core/errchk.h"
// Write all errors from stderr to an <errorlog_name> in the current working // Write all errors from stderr to an <errorlog_name> in the current working
// directory // directory

View File

@@ -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. This file is part of Astaroth.
@@ -33,25 +33,28 @@ static AcReal timescale = AcReal(1.0);
AcReal AcReal
host_timestep(const AcReal& umax, const AcMeshInfo& mesh_info) host_timestep(const AcReal& umax, const AcMeshInfo& mesh_info)
{ {
const long double cdt = mesh_info.real_params[AC_cdt]; const long double cdt = mesh_info.real_params[AC_cdt];
const long double cdtv = mesh_info.real_params[AC_cdtv]; const long double cdtv = mesh_info.real_params[AC_cdtv];
// const long double cdts = mesh_info.real_params[AC_cdts]; // 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 cs2_sound = mesh_info.real_params[AC_cs2_sound];
const long double nu_visc = mesh_info.real_params[AC_nu_visc]; 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 eta = mesh_info.real_params[AC_eta];
const long double chi = 0; // mesh_info.real_params[AC_chi]; // TODO not calculated 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 gamma = mesh_info.real_params[AC_gamma];
const long double dsmin = mesh_info.real_params[AC_dsmin]; const long double dsmin = mesh_info.real_params[AC_dsmin];
// Old ones from legacy Astaroth // Old ones from legacy Astaroth
//const long double uu_dt = cdt * (dsmin / (umax + cs_sound)); // const long double uu_dt = cdt * (dsmin / (umax + cs_sound));
//const long double visc_dt = cdtv * dsmin * dsmin / nu_visc; // const long double visc_dt = cdtv * dsmin * dsmin / nu_visc;
// New, closer to the actual Courant timestep // New, closer to the actual Courant timestep
// See Pencil Code user manual p. 38 (timestep section) // 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 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 const long double visc_dt = cdtv * dsmin * dsmin /
//MV: White the +1? It was messing up my computations! 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); const long double dt = min(uu_dt, visc_dt);
return AcReal(timescale) * AcReal(dt); return AcReal(timescale) * AcReal(dt);