src/MHD/MHD.cc
//------------------------------------------------------------------------------
// This helper function determines whether a set of materials has resistivity.
This helper function determines whether a set of materials has resistivity.
This helper function determines whether a set of materials has resistivity .
bool 
hasResistivity(const DataBase<Dim<3> >& dataBase,
               const State<Dim<3> >& state)
{
  bool haveResistivity = false;
  FieldList<Dim<3>, Dim<3>::Scalar> R = state.scalarFields(MHDFieldNames::resistivity);
  const ConnectivityMap<Dim<3> >& connectivityMap = dataBase.connectivityMap();
  int numNodeLists = R.numFields();
  for (int iNodeList = 0; iNodeList < numNodeLists; ++iNodeList) {
    const NodeList<Dim<3> >& nodeList = R[iNodeList]->nodeList(); 
    if (nodeList.numNodes() == 0) continue;
    const ConductingFluidNodeList* condFluidPtr = 
      dynamic_cast<const ConductingFluidNodeList*>(&nodeList);
    if (condFluidPtr == 0) continue;
    if (dynamic_cast<const NonDynamicState<Dim<3>, Field<Dim<3>, Dim<3>::Scalar> >*>(condFluidPtr->resistivityPolicy().get()) != 0) {
      const Field<Dim<3>, Dim<3>::Scalar>& Ri = condFluidPtr->resistivity();
      double minR = *min_element(Ri.begin(), Ri.end());
      double maxR = *max_element(Ri.begin(), Ri.end());
      if ((minR != 0.0) || (maxR != 0.0))
      {
        haveResistivity = true;
      }
    }
    else {
      haveResistivity = true;
    }
  }
  return haveResistivity;
}
bool hasResistivity ( const DataBase < Dim < 3 > > & dataBase , const State < Dim < 3 > > & state ) { bool haveResistivity = false ; FieldList < Dim < 3 > , Dim < 3 > :: Scalar > R = state . scalarFields ( MHDFieldNames :: resistivity ) ; const ConnectivityMap < Dim < 3 > > & connectivityMap = dataBase . connectivityMap ( ) ; int numNodeLists = R . numFields ( ) ; for ( int iNodeList = 0 ; iNodeList < numNodeLists ; ++ iNodeList ) { const NodeList < Dim < 3 > > & nodeList = R [ iNodeList ] -> nodeList ( ) ; if ( nodeList . numNodes ( ) == 0 ) continue ; const ConductingFluidNodeList * condFluidPtr = dynamic_cast < const ConductingFluidNodeList * > ( & nodeList ) ; if ( condFluidPtr == 0 ) continue ; if ( dynamic_cast < const NonDynamicState < Dim < 3 > , Field < Dim < 3 > , Dim < 3 > :: Scalar > > * > ( condFluidPtr -> resistivityPolicy ( ) . get ( ) ) != 0 ) { const Field < Dim < 3 > , Dim < 3 > :: Scalar > & Ri = condFluidPtr -> resistivity ( ) ; double minR = * min_element ( Ri . begin ( ) , Ri . end ( ) ) ; double maxR = * max_element ( Ri . begin ( ) , Ri . end ( ) ) ; if ( ( minR != 0.0 ) || ( maxR != 0.0 ) ) { haveResistivity = true ; } } else { haveResistivity = true ; } } return haveResistivity ; }
This helper function determines whether a set of materials has resistivity.
This helper function determines whether a set of materials has resistivity .
// We don't assume there's resistivity till we see some evidence of it. // If the nodelist is empty, we define it to be a perfect conductor // (for NOW). // Is this a conducting fluid?  If not, we can skip it, since there's no  // magnetic field otherwise. // Check the resistivity update policy to see whether there's any  // resistivity.  If the resistivity model is non-dynamic and the value of  // the resistivity is 0, then it's a perfect conductor.  Otherwise,  // there is resistivity.