src/SPH/SPHHydroBaseGSRZ.cc
//------------------------------------------------------------------------------
// Apply the ghost boundary conditions for hydro state fields.
//------------------------------------------------------------------------------
Apply the ghost boundary conditions for hydro state fields.
Apply the ghost boundary conditions for hydro state fields .
void
SPHHydroBaseGSRZ::
applyGhostBoundaries(State<Dim<2> >& state,
                     StateDerivatives<Dim<2> >& derivs) {
  FieldList<Dimension, Scalar> mass = state.fields(HydroFieldNames::mass, 0.0);
  const FieldList<Dimension, Vector> pos = state.fields(HydroFieldNames::position, Vector::zero);
  const unsigned numNodeLists = mass.numFields();
  for (unsigned nodeListi = 0; nodeListi != numNodeLists; ++nodeListi) {
    const unsigned n = mass[nodeListi]->numElements();
    for (unsigned i = 0; i != n; ++i) {
      const Scalar circi = 2.0*M_PI*abs(pos(nodeListi, i).y());
      CHECK(circi > 0.0);
      mass(nodeListi, i) /= circi;
    }
  }
  SPHHydroBase<Dim<2> >::applyGhostBoundaries(state, derivs);
  for (ConstBoundaryIterator boundItr = this->boundaryBegin();
       boundItr != this->boundaryEnd();
       ++boundItr) (*boundItr)->finalizeGhostBoundary();
  for (unsigned nodeListi = 0; nodeListi != numNodeLists; ++nodeListi) {
    const unsigned n = mass[nodeListi]->numElements();
    for (unsigned i = 0; i != n; ++i) {
      const Scalar circi = 2.0*M_PI*abs(pos(nodeListi, i).y());
      CHECK(circi > 0.0);
      mass(nodeListi, i) *= circi;
    }
  }
}
void SPHHydroBaseGSRZ :: applyGhostBoundaries ( State < Dim < 2 > > & state , StateDerivatives < Dim < 2 > > & derivs ) { FieldList < Dimension , Scalar > mass = state . fields ( HydroFieldNames :: mass , 0.0 ) ; const FieldList < Dimension , Vector > pos = state . fields ( HydroFieldNames :: position , Vector :: zero ) ; const unsigned numNodeLists = mass . numFields ( ) ; for ( unsigned nodeListi = 0 ; nodeListi != numNodeLists ; ++ nodeListi ) { const unsigned n = mass [ nodeListi ] -> numElements ( ) ; for ( unsigned i = 0 ; i != n ; ++ i ) { const Scalar circi = 2.0 * M_PI * abs ( pos ( nodeListi , i ) . y ( ) ) ; CHECK ( circi > 0.0 ) ; mass ( nodeListi , i ) /= circi ; } } SPHHydroBase < Dim < 2 > > :: applyGhostBoundaries ( state , derivs ) ; for ( ConstBoundaryIterator boundItr = this -> boundaryBegin ( ) ; boundItr != this -> boundaryEnd ( ) ; ++ boundItr ) ( * boundItr ) -> finalizeGhostBoundary ( ) ; for ( unsigned nodeListi = 0 ; nodeListi != numNodeLists ; ++ nodeListi ) { const unsigned n = mass [ nodeListi ] -> numElements ( ) ; for ( unsigned i = 0 ; i != n ; ++ i ) { const Scalar circi = 2.0 * M_PI * abs ( pos ( nodeListi , i ) . y ( ) ) ; CHECK ( circi > 0.0 ) ; mass ( nodeListi , i ) *= circi ; } } }
Apply the ghost boundary conditions for hydro state fields.
Apply the ghost boundary conditions for hydro state fields .
// Convert the mass to mass/length before BCs are applied. // Apply ordinary SPH BCs. // Scale back to mass.