simulation.cc autoformatting
This commit is contained in:
@@ -29,11 +29,11 @@
|
|||||||
#include "config_loader.h"
|
#include "config_loader.h"
|
||||||
#include "core/errchk.h"
|
#include "core/errchk.h"
|
||||||
#include "core/math_utils.h"
|
#include "core/math_utils.h"
|
||||||
|
#include "model/host_forcing.h"
|
||||||
#include "model/host_memory.h"
|
#include "model/host_memory.h"
|
||||||
#include "model/host_timestep.h"
|
#include "model/host_timestep.h"
|
||||||
#include "model/model_reduce.h"
|
#include "model/model_reduce.h"
|
||||||
#include "model/model_rk3.h"
|
#include "model/model_rk3.h"
|
||||||
#include "model/host_forcing.h"
|
|
||||||
#include "timer_hires.h"
|
#include "timer_hires.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -61,7 +61,6 @@ print_diagnostics(const AcMesh& mesh, const int& step, const AcReal& dt)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Write all setting info into a separate ascii file. This is done to guarantee
|
// Write all setting info into a separate ascii file. This is done to guarantee
|
||||||
// that we have the data specifi information in the thing, even though in
|
// that we have the data specifi information in the thing, even though in
|
||||||
// principle these things are in the astaroth.conf.
|
// principle these things are in the astaroth.conf.
|
||||||
@@ -204,7 +203,7 @@ run_simulation(void)
|
|||||||
load_config(&mesh_info);
|
load_config(&mesh_info);
|
||||||
|
|
||||||
AcMesh* mesh = acmesh_create(mesh_info);
|
AcMesh* mesh = acmesh_create(mesh_info);
|
||||||
//TODO: This need to be possible to define in astaroth.conf
|
// TODO: This need to be possible to define in astaroth.conf
|
||||||
acmesh_init_to(INIT_TYPE_GAUSSIAN_RADIAL_EXPL, mesh);
|
acmesh_init_to(INIT_TYPE_GAUSSIAN_RADIAL_EXPL, mesh);
|
||||||
|
|
||||||
acInit(mesh_info);
|
acInit(mesh_info);
|
||||||
@@ -231,23 +230,23 @@ run_simulation(void)
|
|||||||
acStore(mesh);
|
acStore(mesh);
|
||||||
save_mesh(*mesh, 0, t_step);
|
save_mesh(*mesh, 0, t_step);
|
||||||
|
|
||||||
const int max_steps = mesh_info.int_params[AC_max_steps];
|
const int max_steps = mesh_info.int_params[AC_max_steps];
|
||||||
const int save_steps = mesh_info.int_params[AC_save_steps];
|
const int save_steps = mesh_info.int_params[AC_save_steps];
|
||||||
const int bin_save_steps = mesh_info.int_params[AC_bin_steps]; // TODO Get from mesh_info
|
const int bin_save_steps = mesh_info.int_params[AC_bin_steps]; // TODO Get from mesh_info
|
||||||
|
|
||||||
AcReal bin_save_t = mesh_info.real_params[AC_bin_save_t];
|
AcReal bin_save_t = mesh_info.real_params[AC_bin_save_t];
|
||||||
AcReal bin_crit_t = bin_save_t;
|
AcReal bin_crit_t = bin_save_t;
|
||||||
|
|
||||||
//Forcing properties
|
// Forcing properties
|
||||||
AcReal relhel = mesh_info.real_params[AC_relhel];
|
AcReal relhel = mesh_info.real_params[AC_relhel];
|
||||||
AcReal magnitude = mesh_info.real_params[AC_forcing_magnitude];
|
AcReal magnitude = mesh_info.real_params[AC_forcing_magnitude];
|
||||||
AcReal kmin = mesh_info.real_params[AC_kmin];
|
AcReal kmin = mesh_info.real_params[AC_kmin];
|
||||||
AcReal kmax = mesh_info.real_params[AC_kmax];
|
AcReal kmax = mesh_info.real_params[AC_kmax];
|
||||||
|
|
||||||
AcReal kaver = (kmax - kmin)/AcReal(2.0);
|
AcReal kaver = (kmax - kmin) / AcReal(2.0);
|
||||||
|
|
||||||
/* initialize random seed: */
|
/* initialize random seed: */
|
||||||
srand (312256655);
|
srand(312256655);
|
||||||
|
|
||||||
/* Step the simulation */
|
/* Step the simulation */
|
||||||
for (int i = 1; i < max_steps; ++i) {
|
for (int i = 1; i < max_steps; ++i) {
|
||||||
@@ -255,20 +254,21 @@ run_simulation(void)
|
|||||||
const AcReal dt = host_timestep(umax, mesh_info);
|
const AcReal dt = host_timestep(umax, mesh_info);
|
||||||
|
|
||||||
#if LFORCING
|
#if LFORCING
|
||||||
//Generate a forcing vector before canculating an integration step.
|
// Generate a forcing vector before canculating an integration step.
|
||||||
|
|
||||||
// Generate forcing wave vector k_force
|
// Generate forcing wave vector k_force
|
||||||
AcReal3 k_force;
|
AcReal3 k_force;
|
||||||
k_force = helical_forcing_k_generator(kmax, kmin);
|
k_force = helical_forcing_k_generator(kmax, kmin);
|
||||||
|
|
||||||
//Randomize the phase
|
// Randomize the phase
|
||||||
AcReal phase = AcReal(2.0)*AcReal(M_PI)*get_random_number_01();
|
AcReal phase = AcReal(2.0) * AcReal(M_PI) * get_random_number_01();
|
||||||
|
|
||||||
// Generate e for k. Needed for the sake of isotrophy.
|
// Generate e for k. Needed for the sake of isotrophy.
|
||||||
AcReal3 e_force;
|
AcReal3 e_force;
|
||||||
if ((k_force.y == 0.0) && (k_force.z == 0.0)) {
|
if ((k_force.y == 0.0) && (k_force.z == 0.0)) {
|
||||||
e_force = (AcReal3){0.0, 1.0, 0.0};
|
e_force = (AcReal3){0.0, 1.0, 0.0};
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
e_force = (AcReal3){1.0, 0.0, 0.0};
|
e_force = (AcReal3){1.0, 0.0, 0.0};
|
||||||
}
|
}
|
||||||
helical_forcing_e_generator(&e_force, k_force);
|
helical_forcing_e_generator(&e_force, k_force);
|
||||||
|
Reference in New Issue
Block a user