sink_particle.md edited online with Bitbucket
Comments on JP's accretion suggestions.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user