70#include "Operators/Vector/vector_dist_operators.hpp"
71#include "Vector/vector_dist_subset.hpp"
72#include "DCPSE/DCPSE_op/DCPSE_op.hpp"
73#include "OdeIntegrators/OdeIntegrators.hpp"
104void *PointerDistGlobal, *PointerDistSubset;
140template<
typename DXX,
typename DYY>
147 RHSFunctor(DXX &Dxx,DYY &Dyy):Dxx(Dxx),Dyy(Dyy)
157 auto C = getV<0>(Particles);
158 auto C_bulk = getV<0>(Particles_bulk);
159 auto dC = getV<2>(Particles);
160 auto dC_bulk = getV<2>(Particles_bulk);
167 C_bulk[x]=X.data.get<0>();
168 C_bulk[y]=X.data.get<1>();
172 dC_bulk[x] = 0.1*(Dxx(C[x])+Dyy(C[x]));
173 dC_bulk[y] = 0.1*(Dxx(C[y])+Dyy(C[y]));
176 dxdt.data.get<0>()=dC[x];
177 dxdt.data.get<1>()=dC[y];
196int main(
int argc,
char* argv[]) {
198 openfpm_init(&argc, &argv);
214 const size_t sz[2] = {41, 41};
216 size_t bc[2] = {NON_PERIODIC, NON_PERIODIC};
218 spacing[0] = 2.0 / (sz[0] - 1);
219 spacing[1] = 2.0 / (sz[1] - 1);
220 double rCut = 3.1 * spacing[0];
224 Particles.setPropNames({
"Concentration",
"Velocity",
"TempConcentration"});
226 auto it = Particles.getGridIterator(sz);
227 while (it.isNext()) {
230 double x = -1.0 + key.get(0) * spacing[0];
231 Particles.getLastPos()[0] = x;
232 double y = -1.0 + key.get(1) * spacing[1];
233 Particles.getLastPos()[1] = y;
235 if (x != -1.0 && x != 1.0 && y != -1.0 && y != 1) {
236 Particles.getLastSubset(0);
238 Particles.getLastSubset(1);
241 if (x == 0.0 && y > -0.5 && y < 0) {
242 Particles.template getLastProp<0>()[0] = 1.0;
243 Particles.template getLastProp<0>()[1] = 0.0;
244 }
else if (x == 0.0 && y > 0 && y < 0.5) {
245 Particles.template getLastProp<0>()[0] = 0.0;
246 Particles.template getLastProp<0>()[1] = 1.0;
248 Particles.template getLastProp<0>()[0] = 0.0;
249 Particles.template getLastProp<0>()[1] = 0.0;
254 Particles.ghost_get<0>();
257 Particles.write(
"Init");
278 PointerDistGlobal = (
void *) &Particles;
279 PointerDistSubset = (
void *) &Particles_bulk;
296 Derivative_xx Dxx(Particles, 2, rCut);
297 Derivative_yy Dyy(Particles, 2, rCut);
299 auto Pos = getV<PROP_POS>(Particles);
300 auto C = getV<0>(Particles);
301 auto V = getV<1>(Particles);
302 auto dC = getV<2>(Particles);
305 auto C_bulk = getV<0>(Particles_bulk);
306 auto V_bulk = getV<1>(Particles_bulk);
307 auto dC_bulk = getV<2>(Particles_bulk);
328 boost::numeric::odeint::runge_kutta4<state_type_2d_ofp, double, state_type_2d_ofp, double, boost::numeric::odeint::vector_space_algebra_ofp> Odeint_rk4;
336 X.data.get<x>() = C[x];
337 X.data.get<y>() = C[y];
365 double t = 0, tf = 1, dt = 1e-2;
368 V_bulk[x] = -Pos[y] * exp(-10.0 * (Pos[x] * Pos[x] + Pos[y] * Pos[y]));
369 V_bulk[y] = Pos[x] * exp(-10.0 * (Pos[x] * Pos[x] + Pos[y] * Pos[y]));
371 Particles.deleteGhost();
372 Particles.write_frame(
"PDE_Sol", ctr);
373 Particles.ghost_get<0>();
375 Odeint_rk4.do_step(
System, X, t, dt);
377 C_bulk[x] = X.data.get<0>();
378 C_bulk[y] = X.data.get<1>();
383 Particles.ghost_get<0>();
385 Particles_bulk.update();
386 Particles_boundary.update();
387 Dxx.update(Particles);
388 Dyy.update(Particles);
390 X.data.get<0>()=C[x];
391 X.data.get<1>()=C[y];
397 Dxx.deallocate(Particles);
398 Dyy.deallocate(Particles);
This class represent an N-dimensional box.
This class implement the point shape in an N-dimensional space.
void ghost_get(size_t opt=WITH_POSITION)
It synchronize the properties and position of the ghost particles.
aggregate of properties, from a list of object if create a struct that follow the OPENFPM native stru...
A 2d Odeint and Openfpm compatible structure.