Пример #1
0
void LamentStress<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  Teuchos::RCP<lament::matParams<ScalarT>> matp = Teuchos::rcp(new lament::matParams<ScalarT>());

  // Get the old state data
  Albany::MDArray oldDefGrad = (*workset.stateArrayPtr)[defGradName];
  Albany::MDArray oldStress = (*workset.stateArrayPtr)[stressName];

  int numStateVariables = (int)(this->lamentMaterialModelStateVariableNames.size());

  // \todo Get actual time step for calls to LAMENT materials.
  double deltaT = 1.0;

  vector<ScalarT> strainRate(6);              // symmetric tensor
  vector<ScalarT> spin(3);                     // skew-symmetric tensor
  vector<ScalarT> defGrad(9);              // symmetric tensor
  vector<ScalarT> leftStretch(6);              // symmetric tensor
  vector<ScalarT> rotation(9);                 // full tensor
  vector<double> stressOld(6);                // symmetric tensor
  vector<ScalarT> stressNew(6);               // symmetric tensor
  vector<double> stateOld(numStateVariables); // a single scalar for each state variable
  vector<double> stateNew(numStateVariables); // a single scalar for each state variable

  // \todo Set up scratch space for material models using getNumScratchVars() and setScratchPtr().

  // Create the matParams structure, which is passed to Lament
  matp->nelements = 1;
  matp->dt = deltaT;
  matp->time = 0.0;
  matp->strain_rate = &strainRate[0];
  matp->spin = &spin[0];
  matp->deformation_gradient = &defGrad[0];
  matp->left_stretch = &leftStretch[0];
  matp->rotation = &rotation[0];
  matp->state_old = &stateOld[0];
  matp->state_new = &stateNew[0];
  matp->stress_old = &stressOld[0];
  matp->stress_new = &stressNew[0];
//   matp->dt_mat = std::numeric_limits<double>::max();
  
  // matParams that still need to be added:
  // matp->temp_old  (temperature)
  // matp->temp_new
  // matp->sound_speed_old
  // matp->sound_speed_new
  // matp->volume
  // scratch pointer
  // function pointers (lots to be done here)

  for (int cell=0; cell < (int)workset.numCells; ++cell) {
    for (int qp=0; qp < (int)numQPs; ++qp) {

      // std::cout << "QP: " << qp << std::endl;

      // Fill the following entries in matParams for call to LAMENT
      //
      // nelements     - number of elements 
      // dt            - time step, this one is tough because Albany does not currently have a concept of time step for implicit integration
      // time          - current time, again Albany does not currently have a concept of time for implicit integration
      // strain_rate   - what Sierra calls the rate of deformation, it is the symmetric part of the velocity gradient
      // spin          - anti-symmetric part of the velocity gradient
      // left_stretch  - found as V in the polar decomposition of the deformation gradient F = VR
      // rotation      - found as R in the polar decomposition of the deformation gradient F = VR
      // state_old     - material state data for previous time step (material dependent, none for lament::Elastic)
      // state_new     - material state data for current time step (material dependent, none for lament::Elastic)
      // stress_old    - stress at previous time step
      // stress_new    - stress at current time step, filled by material model
      //
      // The total deformation gradient is available as field data
      // 
      // The velocity gradient is not available but can be computed at the logarithm of the incremental deformation gradient divided by deltaT
      // The incremental deformation gradient is computed as F_new F_old^-1

      // JTO:  here is how I think this will go (of course the first two lines won't work as is...)
      // Intrepid2::Tensor<RealType> F = newDefGrad;
      // Intrepid2::Tensor<RealType> Fn = oldDefGrad;
      // Intrepid2::Tensor<RealType> f = F*Intrepid2::inverse(Fn);
      // Intrepid2::Tensor<RealType> V;
      // Intrepid2::Tensor<RealType> R;
      // boost::tie(V,R) = Intrepid2::polar_left(F);
      // Intrepid2::Tensor<RealType> Vinc;
      // Intrepid2::Tensor<RealType> Rinc;
      // Intrepid2::Tensor<RealType> logVinc;
      // boost::tie(Vinc,Rinc,logVinc) = Intrepid2::polar_left_logV(f)
      // Intrepid2::Tensor<RealType> logRinc = Intrepid2::log_rotation(Rinc);
      // Intrepid2::Tensor<RealType> logf = Intrepid2::bch(logVinc,logRinc);
      // Intrepid2::Tensor<RealType> L = (1.0/deltaT)*logf;
      // Intrepid2::Tensor<RealType> D = Intrepid2::sym(L);
      // Intrepid2::Tensor<RealType> W = Intrepid2::skew(L);
      // and then fill data into the vectors below

      // new deformation gradient (the current deformation gradient as computed in the current configuration)
      Intrepid2::Tensor<ScalarT> Fnew( 3, defGradField,cell,qp,0,0);

      // old deformation gradient (deformation gradient at previous load step)
      Intrepid2::Tensor<ScalarT> Fold( oldDefGrad(cell,qp,0,0), oldDefGrad(cell,qp,0,1), oldDefGrad(cell,qp,0,2),
                                    oldDefGrad(cell,qp,1,0), oldDefGrad(cell,qp,1,1), oldDefGrad(cell,qp,1,2),
                                    oldDefGrad(cell,qp,2,0), oldDefGrad(cell,qp,2,1), oldDefGrad(cell,qp,2,2) );

      // incremental deformation gradient
      Intrepid2::Tensor<ScalarT> Finc = Fnew * Intrepid2::inverse(Fold);

      
      // DEBUGGING //
      //if(cell==0 && qp==0){
      // std::cout << "Fnew(0,0) " << Fnew(0,0) << endl;
      // std::cout << "Fnew(1,0) " << Fnew(1,0) << endl;
      // std::cout << "Fnew(2,0) " << Fnew(2,0) << endl;
      // std::cout << "Fnew(0,1) " << Fnew(0,1) << endl;
      // std::cout << "Fnew(1,1) " << Fnew(1,1) << endl;
      // std::cout << "Fnew(2,1) " << Fnew(2,1) << endl;
      // std::cout << "Fnew(0,2) " << Fnew(0,2) << endl;
      // std::cout << "Fnew(1,2) " << Fnew(1,2) << endl;
      // std::cout << "Fnew(2,2) " << Fnew(2,2) << endl;
        //}
      // END DEBUGGING //

      // left stretch V, and rotation R, from left polar decomposition of new deformation gradient
      Intrepid2::Tensor<ScalarT> V(3), R(3), U(3);
      boost::tie(V,R) = Intrepid2::polar_left(Fnew);
      //V = R * U * transpose(R);
      
      // DEBUGGING //
      //if(cell==0 && qp==0){
      // std::cout << "U(0,0) " << U(0,0) << endl;
      // std::cout << "U(1,0) " << U(1,0) << endl;
      // std::cout << "U(2,0) " << U(2,0) << endl;
      // std::cout << "U(0,1) " << U(0,1) << endl;
      // std::cout << "U(1,1) " << U(1,1) << endl;
      // std::cout << "U(2,1) " << U(2,1) << endl;
      // std::cout << "U(0,2) " << U(0,2) << endl;
      // std::cout << "U(1,2) " << U(1,2) << endl;
      // std::cout << "U(2,2) " << U(2,2) << endl;
      // std::cout << "========\n";
      // std::cout << "V(0,0) " << V(0,0) << endl;
      // std::cout << "V(1,0) " << V(1,0) << endl;
      // std::cout << "V(2,0) " << V(2,0) << endl;
      // std::cout << "V(0,1) " << V(0,1) << endl;
      // std::cout << "V(1,1) " << V(1,1) << endl;
      // std::cout << "V(2,1) " << V(2,1) << endl;
      // std::cout << "V(0,2) " << V(0,2) << endl;
      // std::cout << "V(1,2) " << V(1,2) << endl;
      // std::cout << "V(2,2) " << V(2,2) << endl;
      // std::cout << "========\n";
      // std::cout << "R(0,0) " << R(0,0) << endl;
      // std::cout << "R(1,0) " << R(1,0) << endl;
      // std::cout << "R(2,0) " << R(2,0) << endl;
      // std::cout << "R(0,1) " << R(0,1) << endl;
      // std::cout << "R(1,1) " << R(1,1) << endl;
      // std::cout << "R(2,1) " << R(2,1) << endl;
      // std::cout << "R(0,2) " << R(0,2) << endl;
      // std::cout << "R(1,2) " << R(1,2) << endl;
      // std::cout << "R(2,2) " << R(2,2) << endl;
        //}
      // END DEBUGGING //

      // incremental left stretch Vinc, incremental rotation Rinc, and log of incremental left stretch, logVinc
      
      Intrepid2::Tensor<ScalarT> Uinc(3), Vinc(3), Rinc(3), logVinc(3);
      //boost::tie(Vinc,Rinc,logVinc) = Intrepid2::polar_left_logV(Finc);
      boost::tie(Vinc,Rinc) = Intrepid2::polar_left(Finc);
      //Vinc = Rinc * Uinc * transpose(Rinc);
      logVinc = Intrepid2::log(Vinc);

      // log of incremental rotation
      Intrepid2::Tensor<ScalarT> logRinc = Intrepid2::log_rotation(Rinc);

      // log of incremental deformation gradient
      Intrepid2::Tensor<ScalarT> logFinc = Intrepid2::bch(logVinc, logRinc);

      // velocity gradient
      Intrepid2::Tensor<ScalarT> L = (1.0/deltaT)*logFinc;

      // strain rate (a.k.a rate of deformation)
      Intrepid2::Tensor<ScalarT> D = Intrepid2::sym(L);

      // spin
      Intrepid2::Tensor<ScalarT> W = Intrepid2::skew(L);

      // load everything into the Lament data structure

      strainRate[0] = ( D(0,0) );
      strainRate[1] = ( D(1,1) );
      strainRate[2] = ( D(2,2) );
      strainRate[3] = ( D(0,1) );
      strainRate[4] = ( D(1,2) );
      strainRate[5] = ( D(2,0) );

      spin[0] = ( W(0,1) );
      spin[1] = ( W(1,2) );
      spin[2] = ( W(2,0) );

      leftStretch[0] = ( V(0,0) );
      leftStretch[1] = ( V(1,1) );
      leftStretch[2] = ( V(2,2) );
      leftStretch[3] = ( V(0,1) );
      leftStretch[4] = ( V(1,2) );
      leftStretch[5] = ( V(2,0) );

      rotation[0] = ( R(0,0) );
      rotation[1] = ( R(1,1) );
      rotation[2] = ( R(2,2) );
      rotation[3] = ( R(0,1) );
      rotation[4] = ( R(1,2) );
      rotation[5] = ( R(2,0) );
      rotation[6] = ( R(1,0) );
      rotation[7] = ( R(2,1) );
      rotation[8] = ( R(0,2) );

      defGrad[0] = ( Fnew(0,0) );
      defGrad[1] = ( Fnew(1,1) );
      defGrad[2] = ( Fnew(2,2) );
      defGrad[3] = ( Fnew(0,1) );
      defGrad[4] = ( Fnew(1,2) );
      defGrad[5] = ( Fnew(2,0) );
      defGrad[6] = ( Fnew(1,0) );
      defGrad[7] = ( Fnew(2,1) );
      defGrad[8] = ( Fnew(0,2) );

      stressOld[0] = oldStress(cell,qp,0,0);
      stressOld[1] = oldStress(cell,qp,1,1);
      stressOld[2] = oldStress(cell,qp,2,2);
      stressOld[3] = oldStress(cell,qp,0,1);
      stressOld[4] = oldStress(cell,qp,1,2);
      stressOld[5] = oldStress(cell,qp,2,0);

      // copy data from the state manager to the LAMENT data structure
      for(int iVar=0 ; iVar<numStateVariables ; iVar++){
        const std::string& variableName = this->lamentMaterialModelStateVariableNames[iVar]+"_old";
        Albany::MDArray stateVar = (*workset.stateArrayPtr)[variableName];
        stateOld[iVar] = stateVar(cell,qp);
      }

      // Make a call to the LAMENT material model to initialize the load step
      this->lamentMaterialModel->loadStepInit(matp.get());

      // Get the stress from the LAMENT material

      // std::cout << "about to call lament->getStress()" << std::endl;

      this->lamentMaterialModel->getStress(matp.get());

      // std::cout << "after calling lament->getStress() 2" << std::endl;

      // rotate to get the Cauchy Stress
      Intrepid2::Tensor<ScalarT> lameStress( stressNew[0], stressNew[3], stressNew[5],
                                          stressNew[3], stressNew[1], stressNew[4],
                                          stressNew[5], stressNew[4], stressNew[2] );
      Intrepid2::Tensor<ScalarT> cauchy = R * lameStress * transpose(R);

      // DEBUGGING //
      //if(cell==0 && qp==0){
	// std::cout << "check strainRate[0] " << strainRate[0] << endl;
	// std::cout << "check strainRate[1] " << strainRate[1] << endl;
	// std::cout << "check strainRate[2] " << strainRate[2] << endl;
	// std::cout << "check strainRate[3] " << strainRate[3] << endl;
	// std::cout << "check strainRate[4] " << strainRate[4] << endl;
	// std::cout << "check strainRate[5] " << strainRate[5] << endl;
        //}
      // END DEBUGGING //

      // Copy the new stress into the stress field
      for (int i(0); i < 3; ++i)
        for (int j(0); j < 3; ++j)
          stressField(cell,qp,i,j) = cauchy(i,j);

      // stressField(cell,qp,0,0) = stressNew[0];
      // stressField(cell,qp,1,1) = stressNew[1];
      // stressField(cell,qp,2,2) = stressNew[2];
      // stressField(cell,qp,0,1) = stressNew[3];
      // stressField(cell,qp,1,2) = stressNew[4];
      // stressField(cell,qp,2,0) = stressNew[5];
      // stressField(cell,qp,1,0) = stressNew[3]; 
      // stressField(cell,qp,2,1) = stressNew[4]; 
      // stressField(cell,qp,0,2) = stressNew[5];

      // copy state_new data from the LAMENT data structure to the corresponding state variable field
      for(int iVar=0 ; iVar<numStateVariables ; iVar++)
	this->lamentMaterialModelStateVariableFields[iVar](cell,qp) = stateNew[iVar];

      // DEBUGGING //
      //if(cell==0 && qp==0){
      //   std::cout << "stress(0,0) " << this->stressField(cell,qp,0,0) << endl;
      //   std::cout << "stress(1,1) " << this->stressField(cell,qp,1,1) << endl;
      //   std::cout << "stress(2,2) " << this->stressField(cell,qp,2,2) << endl;
      //   std::cout << "stress(0,1) " << this->stressField(cell,qp,0,1) << endl;
      //   std::cout << "stress(1,2) " << this->stressField(cell,qp,1,2) << endl;
      //   std::cout << "stress(0,2) " << this->stressField(cell,qp,0,2) << endl;
      //   std::cout << "stress(1,0) " << this->stressField(cell,qp,1,0) << endl;
      //   std::cout << "stress(2,1) " << this->stressField(cell,qp,2,1) << endl;
      //   std::cout << "stress(2,0) " << this->stressField(cell,qp,2,0) << endl;
      //   //}
      // // END DEBUGGING //

    }
  }
}
Пример #2
0
void LameStressBase<EvalT, Traits>::
  calcStressRealType(PHX::MDField<RealType,Cell,QuadPoint,Dim,Dim>& stressFieldRef,
             PHX::MDField<RealType,Cell,QuadPoint,Dim,Dim>& defGradFieldRef,
             typename Traits::EvalData workset,
             Teuchos::RCP<LameMatParams>& matp) 
{
  // Get the old state data
  Albany::MDArray oldDefGrad = (*workset.stateArrayPtr)[defGradName];
  Albany::MDArray oldStress = (*workset.stateArrayPtr)[stressName];

  int numStateVariables = (int)(this->lameMaterialModelStateVariableNames.size());

  // Pointers used for filling the matParams structure
  double* strainRatePtr = matp->strain_rate;
  double* spinPtr = matp->spin;
  double* leftStretchPtr = matp->left_stretch;
  double* rotationPtr = matp->rotation;
  double* stateOldPtr = matp->state_old;
  double* stressOldPtr = matp->stress_old;

  double deltaT = matp->dt;

  for (int cell=0; cell < (int)workset.numCells; ++cell) {
    for (int qp=0; qp < (int)numQPs; ++qp) {

      // Fill the following entries in matParams for call to LAME
      //
      // nelements     - number of elements 
      // dt            - time step, this one is tough because Albany does not currently have a concept of time step for implicit integration
      // time          - current time, again Albany does not currently have a concept of time for implicit integration
      // strain_rate   - what Sierra calls the rate of deformation, it is the symmetric part of the velocity gradient
      // spin          - anti-symmetric part of the velocity gradient
      // left_stretch  - found as V in the polar decomposition of the deformation gradient F = VR
      // rotation      - found as R in the polar decomposition of the deformation gradient F = VR
      // state_old     - material state data for previous time step (material dependent, none for lame(nt)::Elastic)
      // state_new     - material state data for current time step (material dependent, none for lame(nt)::Elastic)
      // stress_old    - stress at previous time step
      // stress_new    - stress at current time step, filled by material model
      //
      // The total deformation gradient is available as field data
      // 
      // The velocity gradient is not available but can be computed at the logarithm of the incremental deformation gradient divided by deltaT
      // The incremental deformation gradient is computed as F_new F_old^-1

      // JTO:  here is how I think this will go (of course the first two lines won't work as is...)
      // Intrepid::Tensor<RealType> F = newDefGrad;
      // Intrepid::Tensor<RealType> Fn = oldDefGrad;
      // Intrepid::Tensor<RealType> f = F*Intrepid::inverse(Fn);
      // Intrepid::Tensor<RealType> V;
      // Intrepid::Tensor<RealType> R;
      // boost::tie(V,R) = Intrepid::polar_left(F);
      // Intrepid::Tensor<RealType> Vinc;
      // Intrepid::Tensor<RealType> Rinc;
      // Intrepid::Tensor<RealType> logVinc;
      // boost::tie(Vinc,Rinc,logVinc) = Intrepid::polar_left_logV(f)
      // Intrepid::Tensor<RealType> logRinc = Intrepid::log_rotation(Rinc);
      // Intrepid::Tensor<RealType> logf = Intrepid::bch(logVinc,logRinc);
      // Intrepid::Tensor<RealType> L = (1.0/deltaT)*logf;
      // Intrepid::Tensor<RealType> D = Intrepid::sym(L);
      // Intrepid::Tensor<RealType> W = Intrepid::skew(L);
      // and then fill data into the vectors below

      // new deformation gradient (the current deformation gradient as computed in the current configuration)
      Intrepid::Tensor<RealType> Fnew(
       defGradFieldRef(cell,qp,0,0), defGradFieldRef(cell,qp,0,1), defGradFieldRef(cell,qp,0,2),
       defGradFieldRef(cell,qp,1,0), defGradFieldRef(cell,qp,1,1), defGradFieldRef(cell,qp,1,2),
       defGradFieldRef(cell,qp,2,0), defGradFieldRef(cell,qp,2,1), defGradFieldRef(cell,qp,2,2) );

      // old deformation gradient (deformation gradient at previous load step)
      Intrepid::Tensor<RealType> Fold( oldDefGrad(cell,qp,0,0), oldDefGrad(cell,qp,0,1), oldDefGrad(cell,qp,0,2),
                                 oldDefGrad(cell,qp,1,0), oldDefGrad(cell,qp,1,1), oldDefGrad(cell,qp,1,2),
                                 oldDefGrad(cell,qp,2,0), oldDefGrad(cell,qp,2,1), oldDefGrad(cell,qp,2,2) );

      // incremental deformation gradient
      Intrepid::Tensor<RealType> Finc = Fnew * Intrepid::inverse(Fold);

      // left stretch V, and rotation R, from left polar decomposition of new deformation gradient
      Intrepid::Tensor<RealType> V(3), R(3);
      boost::tie(V,R) = Intrepid::polar_left_eig(Fnew);

      // incremental left stretch Vinc, incremental rotation Rinc, and log of incremental left stretch, logVinc
      Intrepid::Tensor<RealType> Vinc(3), Rinc(3), logVinc(3);
      boost::tie(Vinc,Rinc,logVinc) = Intrepid::polar_left_logV_lame(Finc);

      // log of incremental rotation
      Intrepid::Tensor<RealType> logRinc = Intrepid::log_rotation(Rinc);

      // log of incremental deformation gradient
      Intrepid::Tensor<RealType> logFinc = Intrepid::bch(logVinc, logRinc);

      // velocity gradient
      Intrepid::Tensor<RealType> L = RealType(1.0/deltaT)*logFinc;

      // strain rate (a.k.a rate of deformation)
      Intrepid::Tensor<RealType> D = Intrepid::sym(L);

      // spin
      Intrepid::Tensor<RealType> W = Intrepid::skew(L);

      // load everything into the Lame data structure

      strainRatePtr[0] = ( D(0,0) );
      strainRatePtr[1] = ( D(1,1) );
      strainRatePtr[2] = ( D(2,2) );
      strainRatePtr[3] = ( D(0,1) );
      strainRatePtr[4] = ( D(1,2) );
      strainRatePtr[5] = ( D(0,2) );

      spinPtr[0] = ( W(0,1) );
      spinPtr[1] = ( W(1,2) );
      spinPtr[2] = ( W(0,2) );

      leftStretchPtr[0] = ( V(0,0) );
      leftStretchPtr[1] = ( V(1,1) );
      leftStretchPtr[2] = ( V(2,2) );
      leftStretchPtr[3] = ( V(0,1) );
      leftStretchPtr[4] = ( V(1,2) );
      leftStretchPtr[5] = ( V(0,2) );

      rotationPtr[0] = ( R(0,0) );
      rotationPtr[1] = ( R(1,1) );
      rotationPtr[2] = ( R(2,2) );
      rotationPtr[3] = ( R(0,1) );
      rotationPtr[4] = ( R(1,2) );
      rotationPtr[5] = ( R(0,2) );
      rotationPtr[6] = ( R(1,0) );
      rotationPtr[7] = ( R(2,1) );
      rotationPtr[8] = ( R(2,0) );

      stressOldPtr[0] = oldStress(cell,qp,0,0);
      stressOldPtr[1] = oldStress(cell,qp,1,1);
      stressOldPtr[2] = oldStress(cell,qp,2,2);
      stressOldPtr[3] = oldStress(cell,qp,0,1);
      stressOldPtr[4] = oldStress(cell,qp,1,2);
      stressOldPtr[5] = oldStress(cell,qp,0,2);

      // increment the pointers
      strainRatePtr += 6;
      spinPtr += 3;
      leftStretchPtr += 6;
      rotationPtr += 9;
      stressOldPtr += 6;

      // copy data from the state manager to the LAME data structure
      for(int iVar=0 ; iVar<numStateVariables ; iVar++, stateOldPtr++){
        //std::string& variableName = this->lameMaterialModelStateVariableNames[iVar];
        //const Intrepid::FieldContainer<RealType>& stateVar = *oldState[variableName];
        const std::string& variableName = this->lameMaterialModelStateVariableNames[iVar]+"_old";
        Albany::MDArray stateVar = (*workset.stateArrayPtr)[variableName];
        *stateOldPtr = stateVar(cell,qp);
      }
    }
  }

  // Make a call to the LAME material model to initialize the load step
  this->lameMaterialModel->loadStepInit(matp.get());

  // Get the stress from the LAME material
  this->lameMaterialModel->getStress(matp.get());

  double* stressNewPtr = matp->stress_new;

  // Post-process data from Lame call
  for (int cell=0; cell < workset.numCells; ++cell) {
    for (int qp=0; qp < numQPs; ++qp) {

      // Copy the new stress into the stress field
      stressFieldRef(cell,qp,0,0) = stressNewPtr[0];
      stressFieldRef(cell,qp,1,1) = stressNewPtr[1];
      stressFieldRef(cell,qp,2,2) = stressNewPtr[2];
      stressFieldRef(cell,qp,0,1) = stressNewPtr[3];
      stressFieldRef(cell,qp,1,2) = stressNewPtr[4];
      stressFieldRef(cell,qp,0,2) = stressNewPtr[5];
      stressFieldRef(cell,qp,1,0) = stressNewPtr[3]; 
      stressFieldRef(cell,qp,2,1) = stressNewPtr[4]; 
      stressFieldRef(cell,qp,2,0) = stressNewPtr[5];

      stressNewPtr += 6;
    }
  }

  // !!!!! When should this be done???
  double* stateNewPtr = matp->state_new;
  for (int cell=0; cell < workset.numCells; ++cell) {
    for (int qp=0; qp < numQPs; ++qp) {
      // copy state_new data from the LAME data structure to the corresponding state variable field
      for(int iVar=0 ; iVar<numStateVariables ; iVar++, stateNewPtr++)
        this->lameMaterialModelStateVariableFields[iVar](cell,qp) = *stateNewPtr;
    }
  }

}