3 Initialisation snippet for testing the calculation of the SPH density.
4 Returns a string with C++ code.
9 // Start of template in src/exaparty/api/scenario/TestDensityCalculation.py
12 * Most of the initialised variables are dummy (i.e. not used)
15 // Internal search radious used by Peano and with max value R = grid_size/2
17 // Internal search radius used by Peano and with max value R = grid_size/2
18 tarch::la::Vector<Dimensions,double> GridSize = marker.h();
19 const double GridSizeHalf_x = 0.5 * GridSize(0);
21 const double h_max = particle->getSmlMax();
22 const double H_max = h_max * kernel_gamma;
23 double search_radius = 0.999 * std::min(H_max, GridSizeHalf_x);
25 particle->setSearchRadius( search_radius);
27 particle->setDensity ( 1.0 );
28 particle->setMass( particle->getDensity() / std::pow(HYDRO_PART_NUMBER, HYDRO_DIMENSIONS) );
30 particle->setU( 1e-1 );
31 particle->setUDot( 0 );
32 particle->setU_full( 1e-1 );
33 particle->setPressure( 1e-1 );
34 particle->setSoundSpeed( 1e-1 );
36 /* Compute initial smoothing length */
37 const double eta_fac = particle->getEtaFactor();
38 particle->setSmoothingLength( eta_fac * std::pow(particle->getMass()/particle->getDensity(), 1.0 / HYDRO_DIMENSIONS) );
40 /* Initialize remaining fields */
43 for(int d=0; d<Dimensions; d++){
45 particle->setV_full (d,0);
49 particle->setRot_v(0);
50 particle->setHDot (0.0);
51 particle->setWcount(0.0);
53 particle->setRho_dh(0.0);
54 particle->setWcount_dh(0.0);
56 particle->setSmlIterLeftBound(particle->getSmlMin());
57 particle->setSmlIterRightBound(particle->getSmlMax());
59 particle->setHasNoNeighbours(false);
60 particle->setCellHasUpdatedParticle(false);
61 particle->setSmoothingLengthIterCount(0);
63 // Artificial viscosity scheme
64 particle->setDiv_v (0.0);
65 particle->setV_sig_AV(2.0 * particle->getSoundSpeed());
66 particle->setBalsara (0.0);
69 particle->setPartid(1);
72 // End of inserted block
Initialisation snippet for testing the calculation of the SPH density.