7 Initialisation snippet for the Sod shock problem in different spatial dimensions.
8 This problem should have been initialized via a HDF5 file which set up
9 the relevant variables.
10 Here we initialize the rest of arrays which are mostly trivial, but
11 also fine-tune the boundary particles.
13 Returns a string with C++ code.
20 /* Code inserted via the python initialisation snippet library.
21 * Do not modify unless you know what you are doing.
25 * Initial Conditions: Sod shockwave.
26 * This problem should have been initialized via a HDF5 file which set up
27 * the relevant variables.
28 * Here we initialize the rest of arrays which are mostly trivial.
31 logError("Unused and deprecated. Probably needs fixing.")
33 // Internal search radius used by Peano and with max value R = grid_size/2
34 tarch::la::Vector<Dimensions,double> GridSize = marker.h();
35 const double GridSizeHalf_x = 0.5 * GridSize(0);
37 const double h_max = particle->getSmlMax();
38 const double H_max = h_max * kernel_gamma;
39 double search_radius = 0.999 * std::min(H_max, GridSizeHalf_x);
41 particle->setSearchRadius( search_radius );
43 /* Constant density field */
44 particle->setDensity ( 1.0 );
45 particle->setMass( particle->getDensity() / std::pow(HYDRO_PART_NUMBER, HYDRO_DIMENSIONS) );
47 /* Initial estimate for smoothing length */
48 const double eta_fac = particle->getEtaFactor();
49 particle->setSmoothingLength( eta_fac * std::pow(particle->getMass()/particle->getDensity(), 1.0 / HYDRO_DIMENSIONS) );
50 particle->setSmoothingLengthPrevious( particle->getSmoothingLength() );
52 particle->setU( 1e-1 );
53 particle->setPressure( 1e-1 );
54 particle->setSoundSpeed( 1e-1 );
56 /* Initialize remaining fields */
59 for(int d=0; d<Dimensions; d++){
64 /* For 2D sims, we only get one component */
65 particle->setRot_v(0);
67 /* Initialise the "extended" arrays */
68 particle->setV_full( particle->getV() );
69 particle->setU_full( particle->getU() );
71 particle->setUDot (0.0);
72 particle->setHDot (0.0);
73 particle->setWcount(0.0);
75 particle->setRho_dh(0.0);
76 particle->setWcount_dh(0.0);
78 particle->setHLeft (particle->getSmlMin());
79 particle->setHRight(particle->getSmlMax());
81 particle->setSmoothingLengthConverged(false);
82 particle->setHasNoNeighbours(false);
83 particle->setSmoothingLengthIterCount(0);
85 // Artificial viscosity scheme
86 particle->setDiv_v (0.0);
87 particle->setV_sig_AV(2.0 * particle->getSoundSpeed());
88 particle->setBalsara (0.0);
90 particle->setPartid(1);
92 /* End of inserted block */
96 print(
"dimensions not supported!")
Initialisation snippet for the Sod shock problem in different spatial dimensions.
__init__(self, dimensions)