From ad53a0b5f0187d8a53292b42e873237c68634e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miikka=20V=C3=A4is=C3=A4l=C3=A4?= Date: Mon, 5 Aug 2019 05:24:59 +0000 Subject: [PATCH] sink_particle.md edited online with Bitbucket Comments on JP's accretion suggestions. --- doc/manual/sink_particle.md | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/doc/manual/sink_particle.md b/doc/manual/sink_particle.md index 0b6b9e1..0b7f11b 100644 --- a/doc/manual/sink_particle.md +++ b/doc/manual/sink_particle.md @@ -81,10 +81,11 @@ Make is possible for the particle to accrete momentum in addition to mass, and t Create sink particles dynamically and allow the presence of multiple sinks. -Suggestion writen by JP: +### Suggestion writen by JP: + +Add to ```acc/mhd_solver/stencil_defines.h```: ``` -add to acc/mhd_solver/stencil_defines.h: // Scalar mass #define AC_FOR_USER_REAL_PARAM_TYPES(FUNC) \ ... @@ -100,14 +101,19 @@ add to acc/mhd_solver/stencil_defines.h: ... ... FUNC(AC_sink_particle_pos), +``` +Currently we do not do it like that as AcReal3 constant parameter. However, would be good thing to implement eventually. +``` // Vertex buffer for accretion #define AC_FOR_VTXBUF_HANDLES(FUNC) \ ... FUNC(VTXBUF_ACCRETION), +``` +Add to ```acc/mhd_solver/stencil_process.sps```: -acc/mhd_solver/stencil_process.sps: +``` Scalar your_accretion_function(int3 globalVertexIdx) @@ -118,6 +124,10 @@ acc/mhd_solver/stencil_process.sps: return *accretion from the current cell at globalVertexIdx* } + +``` +This step will require that we calculate the acctetion as **mass** in a grid cell volume. This is to eventually take an advantage of nonunifrorm grid. OIOn that way we do not need to worry about it in the collective operation stage. +``` // This should have a global scope out Scalar out_accretion = VTXBUF_ACCRETION; @@ -130,9 +140,12 @@ acc/mhd_solver/stencil_process.sps: out_accretion = your_accretion_function(globalVertexIdx); } +``` +Important to note that we need to take into account the reduction of density with other equations of motion. Or apply analogous style to forcing. +Create new file ```src/standalone/model/host_accretion.cc```: -src/standalone/model/host_accretion.cc: <- new file +``` #include "astaroth.h" void @@ -146,10 +159,12 @@ src/standalone/model/host_accretion.cc: <- new file info->real_params[AC_sink_particle_mass] = mass; // Save for the next iteration acLoadDeviceConstant(AC_sink_particle_mass, mass); // Load to the GPUs } +``` +We assume that acReduceScal will sum up the mass in the accretion buffer. +Call from```src/standalone/simulation.cc```: -src/standalone/simulation.cc: - +``` #include "model/host_accretion.h" int