Peano
Loading...
Searching...
No Matches
main.cpp File Reference
#include <spacetree/spacetree.h>
#include <spacetree/initial_conditions.h>
#include <spacetree/sort.h>
#include <lang/trace.h>
#include <io/writer/dma.h>
#include <vtk/writer/point.h>
#include "align.h"
#include "hydro_part.h"
#include "hydro_iact.h"
#include "setup.h"
#include "runner_do_ghost.h"
Include dependency graph for main.cpp:

Go to the source code of this file.

Data Structures

struct  HYDRO_STATS_T
 

Macros

#define dt_therm   DT_DRIFT
 
#define dt_kick_therm   DT_KICK_HYDRO
 

Typedefs

using Geo = Geometry<_2D, double>
 
using Tree = Spacetree<Geo, part, 64, 2, ThreadPoolTaskBackend>
 

Functions

auto createTree ()
 
void dumpData (Tree &q0, int i)
 
int main ()
 

Variables

struct HYDRO_STATS_T HYDRO_STATS
 
const auto HYDRO_PROPS
 
const auto COSMO
 
auto GetDefaultParticle
 
auto ReferenceDensityKernel
 
auto ReferenceHydroKernel
 
auto Kick1Kernel
 
auto Kick2Kernel
 
auto DriftKernel
 

Macro Definition Documentation

◆ dt_kick_therm

#define dt_kick_therm   DT_KICK_HYDRO

◆ dt_therm

#define dt_therm   DT_DRIFT

Definition at line 19 of file main.cpp.

Referenced by swift2::kernels::legacy::hydro_predict_extra().

Typedef Documentation

◆ Geo

using Geo = Geometry<_2D, double>

Definition at line 11 of file main.cpp.

◆ Tree

Definition at line 22 of file main.cpp.

Function Documentation

◆ createTree()

auto createTree ( )

Definition at line 68 of file main.cpp.

References N_PART.

Referenced by main().

Here is the caller graph for this function:

◆ dumpData()

void dumpData ( Tree & q0,
int i )

Definition at line 266 of file main.cpp.

References assert, DMA_FLAGS, and Spacetree< _Geometry, _Item, THRESHOLD, SPLIT_FACTOR, _TaskBackend >::onNode().

Here is the call graph for this function:

◆ main()

int main ( )

Definition at line 321 of file main.cpp.

References createTree(), and TRACE.

Here is the call graph for this function:

Variable Documentation

◆ COSMO

const auto COSMO
Initial value:
.a2_inv = 1.0,
.a_factor_internal_energy = 1.0,
.a_factor_Balsara_eps = 1.0,
.H = 0.0,
}
Cosmological parameters.
Definition cosmology.h:34
double a2_inv
Definition cosmology.h:43

Definition at line 42 of file main.cpp.

Referenced by runner_do_ghost().

◆ DriftKernel

auto DriftKernel
Initial value:
= [](Tree *leaf) {
for (int i = 0; i < leaf->items.size(); i++) {
auto &localPart = leaf->items[i];
localPart._x[0] += localPart.xpart.v_full[0] * DT_DRIFT;
localPart._x[1] += localPart.xpart.v_full[1] * DT_DRIFT;
localPart.v[0] += localPart.a_hydro[0] * DT_KICK_HYDRO;
localPart.v[1] += localPart.a_hydro[1] * DT_KICK_HYDRO;
hydro_predict_extra(&localPart, &localPart.xpart, DT_DRIFT, dt_therm, 0, &COSMO, &HYDRO_PROPS, nullptr, nullptr);
for (int k = 0; k < 2; k++) {
const float dx = localPart.xpart.v_full[k] * DT_DRIFT;
localPart.xpart.x_diff[k] -= dx;
localPart.xpart.x_diff_sort[k] -= dx;
}
}
}
#define dt_therm
Definition main.cpp:19
const auto COSMO
Definition main.cpp:42
const auto HYDRO_PROPS
Definition main.cpp:29
const float dx[3]
Definition hydro_iact.h:54
#define DT_KICK_HYDRO
Definition setup_big.h:4
#define DT_DRIFT
Definition setup_big.h:3

Definition at line 244 of file main.cpp.

◆ GetDefaultParticle

auto GetDefaultParticle
Initial value:
= [](const Geo::Point &pos) {
auto v = pos - 0.5;
auto v_norm = std::sqrt(v[0] * v[0] + v[1] * v[1]);
v[0] /= v_norm;
v[1] /= v_norm;
auto p = part{
._x = pos,
.v = {(float) -v[0], (float) -v[1], 0},
.mass = 1.0 / N_PART / N_PART,
.h = 4.f / N_PART,
.u = 1.0e-6 / (5.0 / 3 - 1),
};
hydro_first_init_part(&p, &p.xpart);
hydro_convert_quantities(&p, &p.xpart, &COSMO, &HYDRO_PROPS, nullptr);
return p;
}
#define N_PART
Definition setup_big.h:5
Point< dim, fp > Point
Definition geometry.h:242
Particle fields for the SPH particles.
Definition hydro_part.h:99
Geo::Point _x
Definition hydro_part.h:108

Definition at line 51 of file main.cpp.

◆ HYDRO_PROPS

const auto HYDRO_PROPS
Initial value:
.eta_neighbours = 1.2348,
.h_tolerance = 1e-4,
.h_max = 4.0 / N_PART,
.h_min = 1e-5,
.max_smoothing_iterations = 30,
.use_mass_weighted_num_ngb = 0,
.minimal_internal_energy = 0.,
.viscosity = {
},
}
#define hydro_props_default_viscosity_alpha
Contains all the constants and parameters of the hydro scheme.

Definition at line 29 of file main.cpp.

Referenced by runner_do_ghost().

◆ HYDRO_STATS

struct HYDRO_STATS_T HYDRO_STATS

◆ Kick1Kernel

auto Kick1Kernel
Initial value:
= [](Tree *leaf) {
for (int i = 0; i < leaf->items.size(); i++) {
auto &localPart = leaf->items[i];
localPart.xpart.v_full[0] += localPart.a_hydro[0] * DT_KICK_HYDRO;
localPart.xpart.v_full[1] += localPart.a_hydro[1] * DT_KICK_HYDRO;
hydro_kick_extra(&localPart, &localPart.xpart, dt_kick_therm, 0, 0, 0, 0, &COSMO, &HYDRO_PROPS, nullptr);
}
}
#define dt_kick_therm
Definition main.cpp:20

Definition at line 215 of file main.cpp.

◆ Kick2Kernel

auto Kick2Kernel
Initial value:
= [](Tree *leaf) {
for (int i = 0; i < leaf->items.size(); i++) {
auto &localPart = leaf->items[i];
hydro_end_force(&localPart, &COSMO);
}
for (int i = 0; i < leaf->items.size(); i++) {
auto &localPart = leaf->items[i];
localPart.xpart.v_full[0] += localPart.a_hydro[0] * DT_KICK_HYDRO;
localPart.xpart.v_full[1] += localPart.a_hydro[1] * DT_KICK_HYDRO;
hydro_kick_extra(&localPart, &localPart.xpart, dt_kick_therm, 0, 0, 0, 0, &COSMO, &HYDRO_PROPS, nullptr);
hydro_reset_predicted_values(&localPart, &localPart.xpart, &COSMO, nullptr);
}
}

Definition at line 226 of file main.cpp.

◆ ReferenceDensityKernel

auto ReferenceDensityKernel
Initial value:
= [](Tree *leaf) {
for (int i = 0; i < leaf->items.size(); i++) {
auto &localPart = leaf->items[i];
hydro_init_part(&localPart, nullptr);
}
do_density(leaf);
}
struct HYDRO_STATS_T HYDRO_STATS
void do_density(Tree *leaf)
void runner_do_ghost(Tree *leaf, const hydro_props *hydro_properties, HYDRO_STATS_T *hydro_stats)

Definition at line 77 of file main.cpp.

◆ ReferenceHydroKernel

auto ReferenceHydroKernel

Definition at line 88 of file main.cpp.