void Simulation:: initialize() { const double Ly = sim_region.length.y; const double Lx = sim_region.length.x; U.ldz(); P.ldz(); bubbles.empty(); for( unit_t j=lower.y;j<=upper.y;++j) { for( unit_t i=lower.x;i<=upper.x;++i) { P[j][i] = Y[j] / Ly; P[j][i] = 0.1 * (0.5 - Alea()); U[j][i].y = 0.04 + 0.08 * cos( numeric<double>::pi * Y[j] / Ly ); U[j][i].y = 0.15; } } if( master ) { Bubble *b = bubbles.create(); //b->map_peanut( Vertex(sim_box.x/2,0), 0.15 * Lx, 0.9 + 0.09 * Alea() ); b->map_circle(Vertex(sim_box.x/3,0), 0.15 * Lx); b->set_pressure(2); } cycle = 0; bubbles_velocities = true; compute_fields(); }
void Bubble:: map_circle(const Vertex ¢er, Real radius) { assert(lambda>0); empty(); const Real theta_max = 2 * atan( lambda/(radius+radius) ); const size_t nmin = max_of<size_t>(3,size_t( ceil( numeric<Real>::two_pi/theta_max) )); const Real dtheta = numeric<Real>::two_pi / nmin; const Real theta0 = numeric<Real>::two_pi * Alea(); for( size_t i=0; i < nmin; ++i ) { const Real theta = i * dtheta + theta0; Tracer *p = append(); p->vertex.x = center.x + radius * Cos( theta ); p->vertex.y = center.y + radius * Sin( theta ); } raw_initialize(); }
double Exponentielle (double lambda) { return -((double) log(1 - Alea())/log(10))/lambda; }