// Set the initial condition for the Dam-Break problem

void DamBreakInitial::setIC( const Sfx::GridLattice aGrid1D,

            std::set<Hyd::SectionFlow>& aSetOfSect)

{

   // spatial step

   const uint32 w_NbSections=aGrid1D.getNoPoints()-1;

   // grid spacing

   const float64 w_Dx = aGrid1D.Delta(1);

   // number of mesh grid node (1D)

   int32 w_NumOfGridNodes = aGrid1D.getDivisions(1);

 

   // x-coordinate

   float64 w_X = aGrid1D.xMin(1);

 

   // Initialize the section flow for this simulation

   for( uint32 i=1;

      i <= boost::numeric_cast<uint32>(w_NumOfGridNodes); ++i)

   {

      Sfx::StateVector w_StateVar;             // State variable (A,Q)

      Hyd::SectionFlow w_SectFlow( i, w_X);    // Manning and bathy. = 0.

      if( w_SectFlow.X() < aGrid1D.xMax(1)/2.) // Shock location

      {    

         w_SectFlow.setH( m_Phi1);             // water level

         w_StateVar.A() = m_Phi1;              // wetted section area

      }

      else {

         w_SectFlow.setH( m_Phi0);                //

         w_StateVar.A() = m_Phi0;                 //   

      }

 

      w_StateVar.Q() = 0.;                     // discharge

      w_SectFlow.setStateVector( w_StateVar); // sate variable of the section

 

      //Swe::StateVector w_StateVar;

      m_SetSectFlow.insert( w_SectFlow);   // add it to the container

      w_X += aGrid1D.Delta(1);                 // next section

   }

}