Ejemplo n.º 1
0
void BiotCoefficient<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  int numCells = workset.numCells;

  if (is_constant) {
    for (int cell=0; cell < numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
    	  biotCoefficient(cell,qp) = constant_value;
      }
    }
  }
  else {
    for (int cell=0; cell < numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
	Teuchos::Array<MeshScalarT> point(numDims);
	for (int i=0; i<numDims; i++)
	  point[i] = Sacado::ScalarValue<MeshScalarT>::eval(coordVec(cell,qp,i));
		  biotCoefficient(cell,qp) = exp_rf_kl->evaluate(point, rv);
      }
    }
  }
  if (isPoroElastic) {
    for (int cell=0; cell < numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
    	  // assume that bulk modulus is linear with respect to porosity
    	  biotCoefficient(cell,qp) = 1.0 - Kskeleton_value/Kgrain_value;
      }
    }
  }
}
Ejemplo n.º 2
0
void BiotModulus<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  int numCells = workset.numCells;

  if (is_constant) {
    for (int cell=0; cell < numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
    	  biotModulus(cell,qp) = constant_value;
      }
    }
  }
  else {
    for (int cell=0; cell < numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
	Teuchos::Array<MeshScalarT> point(numDims);
	for (int i=0; i<numDims; i++)
	  point[i] = Sacado::ScalarValue<MeshScalarT>::eval(coordVec(cell,qp,i));
			biotModulus(cell,qp) = exp_rf_kl->evaluate(point, rv);
      }
    }
  }
  if (isPoroElastic) {
    for (int cell=0; cell < numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
    	    // 1/M = (B-phi)/Ks + phi/Kf
    	    biotModulus(cell,qp) = 1/((biotCoefficient(cell,qp) - porosity(cell,qp))/GrainBulkModulus
    	    		                  + porosity(cell,qp)/FluidBulkModulus);

      }
    }
  }
}
void
MixtureThermalExpansion<EvalT, Traits>::evaluateFields(
    typename Traits::EvalData workset)
{
  // Compute Strain tensor from displacement gradient
  for (int cell = 0; cell < workset.numCells; ++cell) {
    for (int qp = 0; qp < numQPs; ++qp) {
      mixtureThermalExpansion(cell, qp) =
          (biotCoefficient(cell, qp) * J(cell, qp) - porosity(cell, qp)) *
              alphaSkeleton(cell, qp) +
          porosity(cell, qp) * alphaPoreFluid(cell, qp);
    }
  }
}
Ejemplo n.º 4
0
void TLPoroStress<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{

  typedef Intrepid::FunctionSpaceTools FST;
  typedef Intrepid::RealSpaceTools<ScalarT> RST;

  if (numDims == 1) {
    Intrepid::FunctionSpaceTools::scalarMultiplyDataData<ScalarT>(totstress, J, stress);
    for (int cell=0; cell < workset.numCells; ++cell) {
          for (int qp=0; qp < numQPs; ++qp) {
              for (int dim=0; dim<numDims; ++ dim) {
                  for (int j=0; j<numDims; ++ j) {
        	    totstress(cell, qp, dim, j) = stress(cell, qp, dim, j) - biotCoefficient(cell,qp)*porePressure(cell,qp);
                 }
              }
          }
    }
  }
  else
    {

	   RST::inverse(F_inv, defGrad);
	   RST::transpose(F_invT, F_inv);
	   FST::scalarMultiplyDataData<ScalarT>(JF_invT, J, F_invT);
	   FST::scalarMultiplyDataData<ScalarT>(JpF_invT, porePressure,JF_invT);
	   FST::scalarMultiplyDataData<ScalarT>(JBpF_invT, biotCoefficient, JpF_invT);
  	   FST::tensorMultiplyDataData<ScalarT>(totstress, stress,JF_invT); // Cauchy to 1st PK

    // Compute Stress

    for (int cell=0; cell < workset.numCells; ++cell) {
      for (int qp=0; qp < numQPs; ++qp) {
    	  for (int dim=0; dim<numDims; ++ dim) {
    		  for (int j=0; j<numDims; ++ j) {
	         totstress(cell,qp,dim,j) -= JBpF_invT(cell,qp, dim,j);
    		  }
    	  }
      }
    }


  }
}
  void SurfaceTLPoroMassResidual<EvalT, Traits>::
  evaluateFields(typename Traits::EvalData workset)
  {
    typedef Intrepid::FunctionSpaceTools FST;
    typedef Intrepid::RealSpaceTools<ScalarT> RST;

    Albany::MDArray porePressureold = (*workset.stateArrayPtr)[porePressureName];
    Albany::MDArray Jold;
    if (haveMech) {
      Jold = (*workset.stateArrayPtr)[JName];
    }

    ScalarT dt = deltaTime(0);

        // Compute pore fluid flux
       if (haveMech) {
       	// Put back the permeability tensor to the reference configuration
    	    RST::inverse(F_inv, defGrad);
           RST::transpose(F_invT, F_inv);
           FST::scalarMultiplyDataData<ScalarT>(JF_invT, J, F_invT);
           FST::scalarMultiplyDataData<ScalarT>(KJF_invT, kcPermeability, JF_invT);
           FST::tensorMultiplyDataData<ScalarT>(Kref, F_inv, KJF_invT);
           FST::tensorMultiplyDataData<ScalarT> (flux, Kref, scalarGrad); // flux_i = k I_ij p_j
       } else {
           FST::scalarMultiplyDataData<ScalarT> (flux, kcPermeability, scalarGrad); // flux_i = kc p_i
       }

       for (std::size_t cell=0; cell < workset.numCells; ++cell){
             for (std::size_t qp=0; qp < numQPs; ++qp) {
               for (std::size_t dim=0; dim <numDims; ++dim){

                 fluxdt(cell, qp, dim) = -flux(cell,qp,dim)*dt*refArea(cell,qp)*thickness;
               }
             }
       }
          FST::integrate<ScalarT>(poroMassResidual, fluxdt,
          		surface_Grad_BF, Intrepid::COMP_CPP, false); // "true" sums into

    for (std::size_t cell(0); cell < workset.numCells; ++cell) {
      for (std::size_t node(0); node < numPlaneNodes; ++node) {
        // initialize the residual
        int topNode = node + numPlaneNodes;

        for (std::size_t pt=0; pt < numQPs; ++pt) {

          // If there is no diffusion, then the residual defines only on the mid-plane value

          // Local Rate of Change volumetric constraint term
           poroMassResidual(cell, node) -=
                         refValues(node,pt)*(
                         std::log(J(cell,pt)/Jold(cell, pt))*
                         biotCoefficient(cell,pt) +
                          (porePressure(cell, pt) - porePressureold(cell, pt))/ biotModulus(cell,pt)
                          ) *refArea(cell,pt)*thickness;

           poroMassResidual(cell, topNode) -=
        		           refValues(node,pt)*(
        		           std::log(J(cell,pt)/Jold(cell, pt))*
        		           biotCoefficient(cell,pt) +
        		           (porePressure(cell, pt) - porePressureold(cell, pt))/ biotModulus(cell,pt)
        		           ) *refArea(cell,pt)*thickness;



        } // end integrartion point loop
      } //  end plane node loop

      // Stabilization term (if needed)
    } // end cell loop




  }
  void SurfaceTLPoroMassResidual<EvalT, Traits>::
  evaluateFields(typename Traits::EvalData workset)
  {
    typedef Intrepid::FunctionSpaceTools FST;
    typedef Intrepid::RealSpaceTools<ScalarT> RST;

    Albany::MDArray porePressureold = (*workset.stateArrayPtr)[porePressureName];
    Albany::MDArray Jold;
    if (haveMech) {
      Jold = (*workset.stateArrayPtr)[JName];
    }

    ScalarT dt = deltaTime(0);

    // THE INTREPID REALSPACE TOOLS AND FUNCTION SPACE TOOLS NEED TO BE REMOVED!!!
    // Compute pore fluid flux
    if (haveMech) {
      // Put back the permeability tensor to the reference configuration
      RST::inverse(F_inv, defGrad);
      RST::transpose(F_invT, F_inv);
       FST::scalarMultiplyDataData<ScalarT>(JF_invT, J, F_invT);
       FST::scalarMultiplyDataData<ScalarT>(KJF_invT, kcPermeability, JF_invT);
      FST::tensorMultiplyDataData<ScalarT>(Kref, F_inv, KJF_invT);
      FST::tensorMultiplyDataData<ScalarT> (flux, Kref, scalarGrad); // flux_i = k I_ij p_j
    } else {
       FST::scalarMultiplyDataData<ScalarT> (flux, kcPermeability, scalarGrad); // flux_i = kc p_i
    }

    for (int cell(0); cell < workset.numCells; ++cell) {
      for (int node(0); node < numPlaneNodes; ++node) {
        // initialize the residual
        int topNode = node + numPlaneNodes;
        poroMassResidual(cell, topNode)  = 0.0;
        poroMassResidual(cell, node)  = 0.0;
      }
    }
 
    for (int cell(0); cell < workset.numCells; ++cell) {
      for (int node(0); node < numPlaneNodes; ++node) {
        int topNode = node + numPlaneNodes;

        for (int pt=0; pt < numQPs; ++pt) {

          // If there is no diffusion, then the residual defines only on the mid-plane value

          // Local Rate of Change volumetric constraint term
          poroMassResidual(cell, node) -= refValues(node,pt)*
            (std::log(J(cell,pt)/Jold(cell, pt))*
                     biotCoefficient(cell,pt) +
                     (porePressure(cell, pt) - porePressureold(cell, pt))/
                     biotModulus(cell,pt))*refArea(cell,pt);

          poroMassResidual(cell, topNode) -= refValues(node,pt)*
            (std::log(J(cell,pt)/Jold(cell, pt))*
                     biotCoefficient(cell,pt) +
                     (porePressure(cell, pt) - porePressureold(cell, pt))/
                     biotModulus(cell,pt))*refArea(cell,pt);

        } // end integrartion point loop
      } //  end plane node loop
    } // end cell loop


    for (int cell(0); cell < workset.numCells; ++cell) {
      for (int node(0); node < numPlaneNodes; ++node) {

        int topNode = node + numPlaneNodes;

        for (int pt=0; pt < numQPs; ++pt) {
          for (int dim=0; dim <numDims; ++dim){

            poroMassResidual(cell,node) -=  flux(cell, pt, dim)*dt*
              surface_Grad_BF(cell, node, pt, dim)*
              refArea(cell,pt);

            poroMassResidual(cell, topNode) -= flux(cell, pt, dim)*dt*
              surface_Grad_BF(cell, topNode, pt, dim)*
              refArea(cell,pt);
          }
        }
      }
    }

  }
  void TLPoroPlasticityResidMass<EvalT, Traits>::
  evaluateFields(typename Traits::EvalData workset)
  {
    bool print = false;
    //if (typeid(ScalarT) == typeid(RealType)) print = true;

    typedef Intrepid::FunctionSpaceTools FST;
    typedef Intrepid::RealSpaceTools<ScalarT> RST;

    // Use previous time step for Backward Euler Integration
    Albany::MDArray porePressureold
      = (*workset.stateArrayPtr)[porePressureName];

    Albany::MDArray Jold;
    if (haveMechanics) {
      Jold = (*workset.stateArrayPtr)[JName];
    } 

    // Pore-fluid diffusion coupling.
    for (std::size_t cell=0; cell < workset.numCells; ++cell) {
      for (std::size_t node=0; node < numNodes; ++node) {
        TResidual(cell,node)=0.0;
        for (std::size_t qp=0; qp < numQPs; ++qp) {

          // Volumetric Constraint Term
          if (haveMechanics)  {
            TResidual(cell,node) -= biotCoefficient(cell, qp)
              * (std::log(J(cell,qp)/Jold(cell,qp)))
              * wBF(cell, node, qp) ;
          }

          // Pore-fluid Resistance Term
          TResidual(cell,node) -=  ( porePressure(cell,qp)-porePressureold(cell, qp) )
            / biotModulus(cell, qp)*wBF(cell, node, qp);

        }
      }
    }
    // Pore-Fluid Diffusion Term

    ScalarT dt = deltaTime(0);

    if (haveMechanics) {
      RST::inverse(F_inv, defgrad);
      RST::transpose(F_invT, F_inv);
      FST::scalarMultiplyDataData<ScalarT>(JF_invT, J, F_invT);
      FST::scalarMultiplyDataData<ScalarT>(KJF_invT, kcPermeability, JF_invT);
      FST::tensorMultiplyDataData<ScalarT>(Kref, F_inv, KJF_invT);
      FST::tensorMultiplyDataData<ScalarT> (flux, Kref, TGrad); // flux_i = k I_ij p_j
    } else {
      FST::scalarMultiplyDataData<ScalarT> (flux, kcPermeability, TGrad); // flux_i = kc p_i
    }

    for (std::size_t cell=0; cell < workset.numCells; ++cell){
      for (std::size_t qp=0; qp < numQPs; ++qp) {
        for (std::size_t dim=0; dim <numDims; ++dim){
          fluxdt(cell, qp, dim) = -flux(cell,qp,dim)*dt;
        }
      }
    }
    FST::integrate<ScalarT>(TResidual, fluxdt,
                            wGradBF, Intrepid::COMP_CPP, true); // "true" sums into

    //---------------------------------------------------------------------------//
    // Stabilization Term

    for (std::size_t cell=0; cell < workset.numCells; ++cell){

      porePbar = 0.0;
      vol = 0.0;
      for (std::size_t qp=0; qp < numQPs; ++qp) {
        porePbar += weights(cell,qp)
          * (porePressure(cell,qp)-porePressureold(cell, qp) );
        vol  += weights(cell,qp);
      }
      porePbar /= vol;
      for (std::size_t qp=0; qp < numQPs; ++qp) {
        pterm(cell,qp) = porePbar;
      }

      for (std::size_t node=0; node < numNodes; ++node) {
        trialPbar = 0.0;
        for (std::size_t qp=0; qp < numQPs; ++qp) {
          trialPbar += wBF(cell,node,qp);
        }
        trialPbar /= vol;
        for (std::size_t qp=0; qp < numQPs; ++qp) {
          tpterm(cell,node,qp) = trialPbar;
        }

      }

    }
    ScalarT temp(0);

    for (std::size_t cell=0; cell < workset.numCells; ++cell) {

      for (std::size_t node=0; node < numNodes; ++node) {
        for (std::size_t qp=0; qp < numQPs; ++qp) {

          temp = 3.0 - 12.0*kcPermeability(cell,qp)*dt
            /(elementLength(cell,qp)*elementLength(cell,qp));

          //if ((temp > 0) & stabParameter(cell,qp) > 0) {
          if ((temp > 0) & stab_param_ > 0) {

            TResidual(cell,node) -= 
              ( porePressure(cell,qp)-porePressureold(cell, qp) )
              //* stabParameter(cell, qp)
              * stab_param_
              * std::abs(temp) // should be 1 but use 0.5 for safety
              * (0.5 + 0.5*std::tanh( (temp-1)/kcPermeability(cell,qp)  ))
              / biotModulus(cell, qp)
              * ( wBF(cell, node, qp)
                // -tpterm(cell,node,qp)
                );
            TResidual(cell,node) += pterm(cell,qp)
              //* stabParameter(cell, qp)
              * stab_param_
              * std::abs(temp) // should be 1 but use 0.5 for safety
              * (0.5 + 0.5*std::tanh( (temp-1)/kcPermeability(cell,qp)  ))
              / biotModulus(cell, qp)
              * ( wBF(cell, node, qp) );
          }
        }
      }
    }
  }