Ejemplo n.º 1
0
NormVectorAux::NormVectorAux(const InputParameters & parameters) :
    AuxKernel(parameters),
    // Coupled variables
    _x_comp(coupledValue("x_component")),
    _y_comp(isCoupled("y_component") ? coupledValue("y_component") : _zero),
    _z_comp(isCoupled("z_component") ? coupledValue("z_component") : _zero)
{}
Ejemplo n.º 2
0
GapHeatTransfer::GapHeatTransfer(const InputParameters & parameters)
  : IntegratedBC(parameters),
    _gap_geometry_params_set(false),
    _gap_geometry_type(GapConductance::PLATE),
    _quadrature(getParam<bool>("quadrature")),
    _slave_flux(!_quadrature ? &_sys.getVector("slave_flux") : NULL),
    _gap_conductance(getMaterialProperty<Real>("gap_conductance" +
                                               getParam<std::string>("appended_property_name"))),
    _gap_conductance_dT(getMaterialProperty<Real>(
        "gap_conductance" + getParam<std::string>("appended_property_name") + "_dT")),
    _min_gap(getParam<Real>("min_gap")),
    _max_gap(getParam<Real>("max_gap")),
    _gap_temp(0),
    _gap_distance(std::numeric_limits<Real>::max()),
    _edge_multiplier(1.0),
    _has_info(false),
    _disp_vars(3, libMesh::invalid_uint),
    _gap_distance_value(_quadrature ? _zero : coupledValue("gap_distance")),
    _gap_temp_value(_quadrature ? _zero : coupledValue("gap_temp")),
    _penetration_locator(
        !_quadrature ? NULL
                     : &getQuadraturePenetrationLocator(
                           parameters.get<BoundaryName>("paired_boundary"),
                           getParam<std::vector<BoundaryName>>("boundary")[0],
                           Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")))),
    _warnings(getParam<bool>("warnings"))
{
  if (isParamValid("displacements"))
  {
    // modern parameter scheme for displacements
    for (unsigned int i = 0; i < coupledComponents("displacements"); ++i)
      _disp_vars[i] = coupled("displacements", i);
  }
  else
  {
    // Legacy parameter scheme for displacements
    if (isParamValid("disp_x"))
      _disp_vars[0] = coupled("disp_x");
    if (isParamValid("disp_y"))
      _disp_vars[1] = coupled("disp_y");
    if (isParamValid("disp_z"))
      _disp_vars[2] = coupled("disp_z");

    // TODO: these are only used in one Bison test. Deprecate soon!
  }

  if (_quadrature)
  {
    if (!parameters.isParamValid("paired_boundary"))
      mooseError(std::string("No 'paired_boundary' provided for ") + _name);
  }
  else
  {
    if (!isCoupled("gap_distance"))
      mooseError(std::string("No 'gap_distance' provided for ") + _name);

    if (!isCoupled("gap_temp"))
      mooseError(std::string("No 'gap_temp' provided for ") + _name);
  }
}
Ejemplo n.º 3
0
SlaveConstraint::SlaveConstraint(const std::string & name, InputParameters parameters) :
    DiracKernel(name, parameters),
    _component(getParam<unsigned int>("component")),
    _model(contactModel(getParam<std::string>("model"))),
    _formulation(contactFormulation(getParam<std::string>("formulation"))),
    _normalize_penalty(getParam<bool>("normalize_penalty")),
    _penetration_locator(getPenetrationLocator(getParam<BoundaryName>("master"), getParam<BoundaryName>("boundary"), Utility::string_to_enum<Order>(getParam<MooseEnum>("order")))),
    _penalty(getParam<Real>("penalty")),
    _friction_coefficient(getParam<Real>("friction_coefficient")),
    _residual_copy(_sys.residualGhosted()),
    _x_var(coupled("disp_x")),
    _y_var(isCoupled("disp_y") ? coupled("disp_y") : libMesh::invalid_uint),
    _z_var(isCoupled("disp_z") ? coupled("disp_z") : libMesh::invalid_uint),
    _vars(_x_var, _y_var, _z_var),
    _mesh_dimension(_mesh.dimension()),
    _nodal_area_var(getVar("nodal_area", 0)),
    _aux_system(_nodal_area_var->sys()),
    _aux_solution(_aux_system.currentSolution())
{
  if (parameters.isParamValid("tangential_tolerance"))
  {
    _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
  }
  if (parameters.isParamValid("normal_smoothing_distance"))
  {
    _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));
  }
  if (parameters.isParamValid("normal_smoothing_method"))
  {
    _penetration_locator.setNormalSmoothingMethod(parameters.get<std::string>("normal_smoothing_method"));
  }
}
Ejemplo n.º 4
0
MechanicalContactConstraint::MechanicalContactConstraint(const std::string & name, InputParameters parameters) :
  NodeFaceConstraint(name, parameters),
  _component(getParam<unsigned int>("component")),
  _model(contactModel(getParam<std::string>("model"))),
  _formulation(contactFormulation(getParam<std::string>("formulation"))),
  _penalty(getParam<Real>("penalty")),
  _friction_coefficient(getParam<Real>("friction_coefficient")),
  _tension_release(getParam<Real>("tension_release")),
  _update_contact_set(true),
  _time_last_called(-std::numeric_limits<Real>::max()),
  _residual_copy(_sys.residualGhosted()),
  _x_var(isCoupled("disp_x") ? coupled("disp_x") : 99999),
  _y_var(isCoupled("disp_y") ? coupled("disp_y") : 99999),
  _z_var(isCoupled("disp_z") ? coupled("disp_z") : 99999),
  _mesh_dimension(_mesh.dimension()),
  _vars(_x_var, _y_var, _z_var),
  _nodal_area_var(getVar("nodal_area", 0)),
  _aux_system( _nodal_area_var->sys() ),
  _aux_solution( _aux_system.currentSolution() )
{
  _overwrite_slave_residual = false;

  if (parameters.isParamValid("tangential_tolerance"))
    _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));

  if (parameters.isParamValid("normal_smoothing_distance"))
    _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));

  if (parameters.isParamValid("normal_smoothing_method"))
    _penetration_locator.setNormalSmoothingMethod(parameters.get<std::string>("normal_smoothing_method"));

  _penetration_locator.setUpdate(false);
}
Ejemplo n.º 5
0
EelEnergy::EelEnergy(const std::string & name,
                       InputParameters parameters) :
  Kernel(name, parameters),
    // Coupled variables
    _rhoA(coupledValue("rhoA")),
    _rhouA_x(coupledValue("rhouA_x")),
    _rhouA_y(_mesh.dimension()>=2 ? coupledValue("rhouA_y") : _zero),
    _rhouA_z(_mesh.dimension()==3 ? coupledValue("rhouA_z") : _zero),
    _pressure(coupledValue("pressure")),
    _area(coupledValue("area")),
    // Parameters:
    _Hw_fn_name(isParamValid("Hw_fn_name") ? getParam<std::string>("Hw_fn_name") : std::string(" ")),
    _Tw_fn_name(isParamValid("Tw_fn_name") ? getParam<std::string>("Tw_fn_name") : std::string(" ")),
    _Hw(getParam<Real>("Hw")),
    _Tw(getParam<Real>("Tw")),
    _aw(getParam<Real>("aw")),
    _gravity(getParam<RealVectorValue>("gravity")),
    // Equation of state:
    _eos(getUserObject<EquationOfState>("eos")),
    // Parameters for jacobian:
    _rhoA_nb(coupled("rhoA")),
    _rhouA_x_nb(coupled("rhouA_x")),
    _rhouA_y_nb(isCoupled("rhouA_y") ? coupled("rhouA_y") : -1),
    _rhouA_z_nb(isCoupled("rhouA_z") ? coupled("rhouA_z") : -1)
{
}
AqueousEquilibriumRxnAux::AqueousEquilibriumRxnAux(const InputParameters & parameters)
  : AuxKernel(parameters),
    _log_k(coupledValue("log_k")),
    _sto_v(getParam<std::vector<Real>>("sto_v")),
    _gamma_eq(coupledValue("gamma"))
{
  const unsigned int n = coupledComponents("v");

  // Check that the correct number of stoichiometric coefficients have been provided
  if (_sto_v.size() != n)
    mooseError("The number of stoichiometric coefficients in sto_v is not equal to the number of "
               "coupled species in ",
               _name);

  // Check that the correct number of activity coefficients have been provided (if applicable)
  if (isCoupled("gamma_v"))
    if (coupledComponents("gamma_v") != n)
      mooseError("The number of activity coefficients in gamma_v is not equal to the number of "
                 "coupled species in ",
                 _name);

  _vals.resize(n);
  _gamma_v.resize(n);

  for (unsigned int i = 0; i < n; ++i)
  {
    _vals[i] = &coupledValue("v", i);
    // If gamma_v has been supplied, use those values, but if not, use the default value
    _gamma_v[i] = (isCoupled("gamma_v") ? &coupledValue("gamma_v", i) : &coupledValue("gamma_v"));
  }
}
Ejemplo n.º 7
0
StressDivergence::StressDivergence(const InputParameters & parameters)
  : Kernel(parameters),
    _stress_older(getMaterialPropertyOlder<SymmTensor>(
        "stress" + getParam<std::string>("appended_property_name"))),
    _stress_old(getMaterialPropertyOld<SymmTensor>(
        "stress" + getParam<std::string>("appended_property_name"))),
    _stress(getMaterialProperty<SymmTensor>("stress" +
                                            getParam<std::string>("appended_property_name"))),
    _Jacobian_mult(getMaterialProperty<SymmElasticityTensor>(
        "Jacobian_mult" + getParam<std::string>("appended_property_name"))),
    _d_stress_dT(getMaterialProperty<SymmTensor>("d_stress_dT" +
                                                 getParam<std::string>("appended_property_name"))),
    _component(getParam<unsigned int>("component")),
    _xdisp_coupled(isCoupled("disp_x")),
    _ydisp_coupled(isCoupled("disp_y")),
    _zdisp_coupled(isCoupled("disp_z")),
    _temp_coupled(isCoupled("temp")),
    _xdisp_var(_xdisp_coupled ? coupled("disp_x") : 0),
    _ydisp_var(_ydisp_coupled ? coupled("disp_y") : 0),
    _zdisp_var(_zdisp_coupled ? coupled("disp_z") : 0),
    _temp_var(_temp_coupled ? coupled("temp") : 0),
    _zeta(getParam<Real>("zeta")),
    _alpha(getParam<Real>("alpha")),
    _avg_grad_test(_test.size(), std::vector<Real>(3, 0.0)),
    _avg_grad_phi(_phi.size(), std::vector<Real>(3, 0.0)),
    _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction"))
{
}
Ejemplo n.º 8
0
GluedContactConstraint::GluedContactConstraint(const InputParameters & parameters) :
    SparsityBasedContactConstraint(parameters),
    _component(getParam<unsigned int>("component")),
    _model(contactModel(getParam<std::string>("model"))),
    _formulation(contactFormulation(getParam<std::string>("formulation"))),
    _penalty(getParam<Real>("penalty")),
    _friction_coefficient(getParam<Real>("friction_coefficient")),
    _tension_release(getParam<Real>("tension_release")),
    _updateContactSet(true),
    _residual_copy(_sys.residualGhosted()),
    _x_var(isCoupled("disp_x") ? coupled("disp_x") : libMesh::invalid_uint),
    _y_var(isCoupled("disp_y") ? coupled("disp_y") : libMesh::invalid_uint),
    _z_var(isCoupled("disp_z") ? coupled("disp_z") : libMesh::invalid_uint),
    _vars(_x_var, _y_var, _z_var),
    _nodal_area_var(getVar("nodal_area", 0)),
    _aux_system(_nodal_area_var->sys()),
    _aux_solution(_aux_system.currentSolution())
{
//  _overwrite_slave_residual = false;

    if (parameters.isParamValid("tangential_tolerance"))
    {
        _penetration_locator.setTangentialTolerance(getParam<Real>("tangential_tolerance"));
    }
    if (parameters.isParamValid("normal_smoothing_distance"))
    {
        _penetration_locator.setNormalSmoothingDistance(getParam<Real>("normal_smoothing_distance"));
    }
    if (parameters.isParamValid("normal_smoothing_method"))
    {
        _penetration_locator.setNormalSmoothingMethod(parameters.get<std::string>("normal_smoothing_method"));
    }

    _penetration_locator.setUpdate(false);
}
Ejemplo n.º 9
0
TrussMaterial::TrussMaterial(const std::string  & name,
                             InputParameters parameters)
  :Material(name, parameters),
   _axial_stress(declareProperty<Real>("axial_stress")),
   _e_over_l(declareProperty<Real>("e_over_l")),
   _youngs_modulus(isParamValid("youngs_modulus") ? getParam<Real>("youngs_modulus") : 0),
   _youngs_modulus_coupled(isCoupled("youngs_modulus_var")),
   _youngs_modulus_var(_youngs_modulus_coupled ? coupledValue("youngs_modulus_var"): _zero),
   _has_temp(isCoupled("temp")),
   _temp(_has_temp ? coupledValue("temp") : _zero),
   _t_ref(getParam<Real>("t_ref")),
   _alpha(getParam<Real>("thermal_expansion")),
   _dim(1)
{
// This doesn't work: if there are just line elements, this
// returns 1 even if the mesh has higher dimensionality
//  unsigned int dim = _subproblem.mesh().dimension();


// This won't work for multiple threads because computeProperties will get called for
// all of the threads.
  NonlinearVariableName disp_x = parameters.get<NonlinearVariableName>("disp_x");
  _disp_x_var = &_fe_problem.getVariable(_tid,disp_x);
  _disp_y_var = NULL;
  _disp_z_var = NULL;

  if (parameters.isParamValid("disp_y"))
  {
    NonlinearVariableName disp_y = parameters.get<NonlinearVariableName>("disp_y");
    _disp_y_var = &_fe_problem.getVariable(_tid,disp_y);
    _dim = 2;

    if (parameters.isParamValid("disp_z"))
    {
      NonlinearVariableName disp_z = parameters.get<NonlinearVariableName>("disp_z");
      _disp_z_var = &_fe_problem.getVariable(_tid,disp_z);
      _dim = 3;
    }
  }

  if (parameters.isParamValid("youngs_modulus"))
  {
    if (_youngs_modulus_coupled)
    {
      mooseError("Cannot specify both youngs_modulus and youngs_modulus_var");
    }
  }
  else
  {
    if (!_youngs_modulus_coupled)
    {
      mooseError("Must specify either youngs_modulus or youngs_modulus_var");
    }
  }
}
Ejemplo n.º 10
0
GapConductance::GapConductance(const InputParameters & parameters)
  :Material(parameters),
   _appended_property_name( getParam<std::string>("appended_property_name") ),
   _temp(coupledValue("variable")),
   _gap_geometry_params_set(false),
   _gap_geometry_type(GapConductance::PLATE),
   _quadrature(getParam<bool>("quadrature")),
   _gap_temp(0),
   _gap_distance(88888),
   _radius(0),
   _r1(0),
   _r2(0),
   _has_info(false),
   _gap_distance_value(_quadrature ? _zero : coupledValue("gap_distance")),
   _gap_temp_value(_quadrature ? _zero : coupledValue("gap_temp")),
   _gap_conductance(declareProperty<Real>("gap_conductance"+_appended_property_name)),
   _gap_conductance_dT(declareProperty<Real>("gap_conductance"+_appended_property_name+"_dT")),
   _gap_conductivity(getParam<Real>("gap_conductivity")),
   _gap_conductivity_function(isParamValid("gap_conductivity_function") ? &getFunction("gap_conductivity_function") : NULL),
   _gap_conductivity_function_variable(isCoupled("gap_conductivity_function_variable") ? &coupledValue("gap_conductivity_function_variable") : NULL),
   _stefan_boltzmann(getParam<Real>("stefan_boltzmann")),
   _emissivity( getParam<Real>("emissivity_1") != 0 && getParam<Real>("emissivity_2") != 0 ?
                1/getParam<Real>("emissivity_1") + 1/getParam<Real>("emissivity_2") - 1 : 0 ),
   _min_gap(getParam<Real>("min_gap")),
   _max_gap(getParam<Real>("max_gap")),
   _temp_var(_quadrature ? getVar("variable",0) : NULL),
   _penetration_locator(NULL),
   _serialized_solution(_quadrature ? &_temp_var->sys().currentSolution() : NULL),
   _dof_map(_quadrature ? &_temp_var->sys().dofMap() : NULL),
   _warnings(getParam<bool>("warnings"))
{
  if (_quadrature)
  {
    if (!parameters.isParamValid("paired_boundary"))
      mooseError(std::string("No 'paired_boundary' provided for ") + _name);
  }
  else
  {
    if (!isCoupled("gap_distance"))
      mooseError(std::string("No 'gap_distance' provided for ") + _name);

    if (!isCoupled("gap_temp"))
      mooseError(std::string("No 'gap_temp' provided for ") + _name);
  }


  if (_quadrature)
  {
    _penetration_locator = &_subproblem.geomSearchData().getQuadraturePenetrationLocator(parameters.get<BoundaryName>("paired_boundary"),
                                                                                         getParam<std::vector<BoundaryName> >("boundary")[0],
                                                                                         Utility::string_to_enum<Order>(parameters.get<MooseEnum>("order")));
  }

}
Ejemplo n.º 11
0
NodalMassConservationPPS::NodalMassConservationPPS(const InputParameters & parameters) :
    NodalPostprocessor(parameters),
    _value(0.),
    _nx(coupledValue("nx")),
    _ny(coupledValue("ny")),
    _nz(coupledValue("nz")),
    _rho_u(coupledValue("rho_u")),
    _rho_v(isCoupled("rho_v") ? coupledValue("rho_v") : _zero),
    _rho_w(isCoupled("rho_w") ? coupledValue("rho_w") : _zero)
{
}
Ejemplo n.º 12
0
DashpotBC::DashpotBC(const std::string & name, InputParameters parameters) :
    IntegratedBC(name, parameters),
    _component(getParam<unsigned int>("component")),
    _coefficient(getParam<Real>("coefficient")),
    _disp_x_var(coupled("disp_x")),
    _disp_y_var(isCoupled("disp_y") ? coupled("disp_y") : 0),
    _disp_z_var(isCoupled("disp_z") ? coupled("disp_z") : 0),

    _disp_x_dot(coupledDot("disp_x")),
    _disp_y_dot(isCoupled("disp_y") ? coupledDot("disp_y") : _zero),
    _disp_z_dot(isCoupled("disp_z") ? coupledDot("disp_z") : _zero)
{}
Ejemplo n.º 13
0
FluxBasedStrainIncrement::FluxBasedStrainIncrement(const InputParameters & parameters)
  : DerivativeMaterialInterface<Material>(parameters),
    _grad_jx(&coupledGradient("xflux")),
    _has_yflux(isCoupled("yflux")),
    _has_zflux(isCoupled("zflux")),
    _grad_jy(_has_yflux ? &coupledGradient("yflux") : nullptr),
    _grad_jz(_has_zflux ? &coupledGradient("zflux") : nullptr),
    _gb(isCoupled("gb") ? coupledValue("gb") : _zero),
    _strain_increment(
        declareProperty<RankTwoTensor>(getParam<MaterialPropertyName>("property_name")))
{
}
Ejemplo n.º 14
0
StressDivergenceRZ::StressDivergenceRZ(const InputParameters & parameters)
    :Kernel(parameters),
     _stress(getMaterialProperty<SymmTensor>("stress")),
     _Jacobian_mult(getMaterialProperty<SymmElasticityTensor>("Jacobian_mult")),
     _d_stress_dT(getMaterialProperty<SymmTensor>("d_stress_dT")),
     _component(getParam<unsigned int>("component")),
     _rdisp_coupled(isCoupled("disp_r")),
     _zdisp_coupled(isCoupled("disp_z")),
     _temp_coupled(isCoupled("temp")),
     _rdisp_var(_rdisp_coupled ? coupled("disp_r") : 0),
     _zdisp_var(_zdisp_coupled ? coupled("disp_z") : 0),
     _temp_var(_temp_coupled ? coupled("temp") : 0)
{}
Ejemplo n.º 15
0
StressDivergenceTensors::StressDivergenceTensors(const InputParameters & parameters)
  : ALEKernel(parameters),
    _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
    _use_finite_deform_jacobian(getParam<bool>("use_finite_deform_jacobian")),
    _stress(getMaterialPropertyByName<RankTwoTensor>(_base_name + "stress")),
    _Jacobian_mult(getMaterialPropertyByName<RankFourTensor>(_base_name + "Jacobian_mult")),
    _component(getParam<unsigned int>("component")),
    _ndisp(coupledComponents("displacements")),
    _disp_var(_ndisp),
    _temp_coupled(isCoupled("temperature")),
    _temp_var(_temp_coupled ? coupled("temperature") : 0),
    _deigenstrain_dT(_temp_coupled ? &getMaterialPropertyDerivative<RankTwoTensor>(
                                         getParam<std::string>("thermal_eigenstrain_name"),
                                         getVar("temperature", 0)->name())
                                   : nullptr),
    _out_of_plane_strain_coupled(isCoupled("out_of_plane_strain")),
    _out_of_plane_strain_var(_out_of_plane_strain_coupled ? coupled("out_of_plane_strain") : 0),
    _out_of_plane_direction(getParam<MooseEnum>("out_of_plane_direction")),
    _avg_grad_test(_test.size(), std::vector<Real>(3, 0.0)),
    _avg_grad_phi(_phi.size(), std::vector<Real>(3, 0.0)),
    _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction"))
{
  for (unsigned int i = 0; i < _ndisp; ++i)
    _disp_var[i] = coupled("displacements", i);

  // Checking for consistency between mesh size and length of the provided displacements vector
  if (_out_of_plane_direction != 2 && _ndisp != 3)
    mooseError("For 2D simulations where the out-of-plane direction is x or y coordinate "
               "directions the number of supplied displacements must be three.");
  else if (_out_of_plane_direction == 2 && _ndisp != _mesh.dimension())
    mooseError("The number of displacement variables supplied must match the mesh dimension");

  if (_use_finite_deform_jacobian)
  {
    _deformation_gradient =
        &getMaterialProperty<RankTwoTensor>(_base_name + "deformation_gradient");
    _deformation_gradient_old =
        &getMaterialPropertyOld<RankTwoTensor>(_base_name + "deformation_gradient");
    _rotation_increment = &getMaterialProperty<RankTwoTensor>(_base_name + "rotation_increment");
  }

  // Error if volumetric locking correction is turned on for 1D problems
  if (_ndisp == 1 && _volumetric_locking_correction)
    mooseError("Volumetric locking correction should be set to false for 1-D problems.");

  // Generate warning when volumetric locking correction is used with second order elements
  if (_mesh.hasSecondOrderElements() && _volumetric_locking_correction)
    mooseWarning("Volumteric locking correction is not required for second order elements. Using "
                 "volumetric locking with second order elements could cause zigzag patterns in "
                 "stresses and strains.");
}
Ejemplo n.º 16
0
// DEPRECATED CONSTRUCTOR
StressDivergence::StressDivergence(const std::string & deprecated_name, InputParameters parameters)
  :Kernel(deprecated_name, parameters),
   _stress(getMaterialProperty<SymmTensor>("stress" + getParam<std::string>("appended_property_name"))),
   _Jacobian_mult(getMaterialProperty<SymmElasticityTensor>("Jacobian_mult" + getParam<std::string>("appended_property_name"))),
   _d_stress_dT(getMaterialProperty<SymmTensor>("d_stress_dT"+ getParam<std::string>("appended_property_name"))),
   _component(getParam<unsigned int>("component")),
   _xdisp_coupled(isCoupled("disp_x")),
   _ydisp_coupled(isCoupled("disp_y")),
   _zdisp_coupled(isCoupled("disp_z")),
   _temp_coupled(isCoupled("temp")),
   _xdisp_var(_xdisp_coupled ? coupled("disp_x") : 0),
   _ydisp_var(_ydisp_coupled ? coupled("disp_y") : 0),
   _zdisp_var(_zdisp_coupled ? coupled("disp_z") : 0),
   _temp_var(_temp_coupled ? coupled("temp") : 0)
{}
Ejemplo n.º 17
0
MultiDContactConstraint::MultiDContactConstraint(const InputParameters & parameters) :
    NodeFaceConstraint(parameters),
    _residual_copy(_sys.residualGhosted()),
    _jacobian_update(getParam<bool>("jacobian_update")),
    _component(getParam<unsigned int>("component")),
    _model(contactModel(getParam<std::string>("model"))),
    _penalty(getParam<Real>("penalty")),
    _x_var(isCoupled("disp_x") ? coupled("disp_x") : libMesh::invalid_uint),
    _y_var(isCoupled("disp_y") ? coupled("disp_y") : libMesh::invalid_uint),
    _z_var(isCoupled("disp_z") ? coupled("disp_z") : libMesh::invalid_uint),
    _mesh_dimension(_mesh.dimension()),
    _vars(_x_var, _y_var, _z_var)
{
  _overwrite_slave_residual = false;
}
Ejemplo n.º 18
0
StressDivergenceRZ::StressDivergenceRZ(const InputParameters & parameters)
  :Kernel(parameters),
   _stress(getMaterialProperty<SymmTensor>("stress")),
   _Jacobian_mult(getMaterialProperty<SymmElasticityTensor>("Jacobian_mult")),
   _d_stress_dT(getMaterialProperty<SymmTensor>("d_stress_dT")),
   _component(getParam<unsigned int>("component")),
   _rdisp_coupled(isCoupled("disp_r")),
   _zdisp_coupled(isCoupled("disp_z")),
   _temp_coupled(isCoupled("temp")),
   _rdisp_var(_rdisp_coupled ? coupled("disp_r") : 0),
   _zdisp_var(_zdisp_coupled ? coupled("disp_z") : 0),
   _temp_var(_temp_coupled ? coupled("temp") : 0),
   _avg_grad_test(_test.size(), std::vector<Real>(3, 0.0)),
   _avg_grad_phi(_phi.size(), std::vector<Real>(3, 0.0)),
   _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction"))
{}
Ejemplo n.º 19
0
RheaEnergy::RheaEnergy(const std::string & name,
                       InputParameters parameters) :
  Kernel(name, parameters),
    // Material values:
    _vel(coupledValue("velocity")),
    _temp(isCoupled("temperature") ? coupledValue("temperature") : _zero),
    _pressure(coupledValue("pressure")),
    // Radiation value:
    _epsilon(isCoupled("radiation") ? coupledValue("radiation") : _zero),
    _grad_eps(isCoupled("radiation") ?  coupledGradient("radiation") : _grad_zero),
    // Material property:
    _sigma_a(getMaterialProperty<Real>("sigma_a")),
    // Constant:
    _c(getParam<Real>("speed_of_light")),
    _a(getParam<Real>("a"))
{}
Ejemplo n.º 20
0
HeatConductionMaterial::HeatConductionMaterial(const InputParameters & parameters) :
    Material(parameters),

    _has_temp(isCoupled("temp")),
    _temperature(_has_temp ? coupledValue("temp") : _zero),
    _my_thermal_conductivity(isParamValid("thermal_conductivity") ? getParam<Real>("thermal_conductivity") : 0),
    _my_specific_heat(isParamValid("specific_heat") ? getParam<Real>("specific_heat") : 0),

    _thermal_conductivity(declareProperty<Real>("thermal_conductivity")),
    _thermal_conductivity_dT(declareProperty<Real>("thermal_conductivity_dT")),
    _thermal_conductivity_temperature_function( getParam<FunctionName>("thermal_conductivity_temperature_function") != "" ? &getFunction("thermal_conductivity_temperature_function") : NULL),

    _specific_heat(declareProperty<Real>("specific_heat")),
    _specific_heat_temperature_function( getParam<FunctionName>("specific_heat_temperature_function") != "" ? &getFunction("specific_heat_temperature_function") : NULL)
{
  if (_thermal_conductivity_temperature_function && !_has_temp)
  {
    mooseError("Must couple with temperature if using thermal conductivity function");
  }
  if (isParamValid("thermal_conductivity") && _thermal_conductivity_temperature_function)
  {
    mooseError("Cannot define both thermal conductivity and thermal conductivity temperature function");
  }
  if (_specific_heat_temperature_function && !_has_temp)
  {
    mooseError("Must couple with temperature if using specific heat function");
  }
  if (isParamValid("specific_heat") && _specific_heat_temperature_function)
  {
    mooseError("Cannot define both specific heat and specific heat temperature function");
  }
}
Ejemplo n.º 21
0
const VariableValue &
Coupleable::coupledValueOld(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name))
    return *getDefaultValue(var_name);

  validateExecutionerType(var_name);
  coupledCallback(var_name, true);
  MooseVariable * var = getVar(var_name, comp);

  if (!_coupleable_neighbor)
  {
    if (_nodal)
      return (_c_is_implicit) ? var->nodalSlnOld() : var->nodalSlnOlder();
    else
      return (_c_is_implicit) ? var->slnOld() : var->slnOlder();
  }
  else
  {
    if (_nodal)
      return (_c_is_implicit) ? var->nodalSlnOldNeighbor() : var->nodalSlnOlderNeighbor();
    else
      return (_c_is_implicit) ? var->slnOldNeighbor() : var->slnOlderNeighbor();
  }
}
Ejemplo n.º 22
0
TensorMechanicsMaterial::TensorMechanicsMaterial(const std::string & name,
                                             InputParameters parameters)
    : Material(name, parameters),
      _grad_disp_x(coupledGradient("disp_x")),
      _grad_disp_y(coupledGradient("disp_y")),
      _grad_disp_z(_mesh.dimension() == 3 ? coupledGradient("disp_z") : _grad_zero),
      _grad_disp_x_old(_fe_problem.isTransient() ? coupledGradientOld("disp_x") : _grad_zero),
      _grad_disp_y_old(_fe_problem.isTransient() ? coupledGradientOld("disp_y") : _grad_zero),
      _grad_disp_z_old(_fe_problem.isTransient() && _mesh.dimension() == 3 ? coupledGradientOld("disp_z") : _grad_zero),
      _stress(declareProperty<RankTwoTensor>("stress")),
      _elastic_strain(declareProperty<RankTwoTensor>("elastic_strain")),
      _elasticity_tensor(declareProperty<ElasticityTensorR4>("elasticity_tensor")),
      _Jacobian_mult(declareProperty<ElasticityTensorR4>("Jacobian_mult")),
      //_d_stress_dT(declareProperty<RankTwoTensor>("d_stress_dT")),
      _euler_angle_1(getParam<Real>("euler_angle_1")),
      _euler_angle_2(getParam<Real>("euler_angle_2")),
      _euler_angle_3(getParam<Real>("euler_angle_3")),
      _Cijkl_vector(getParam<std::vector<Real> >("C_ijkl")),
      _all_21(getParam<bool>("all_21")),
      _Cijkl(),
      _Euler_angles(_euler_angle_1, _euler_angle_2, _euler_angle_3),
      _has_T(isCoupled("temperature")),
      _T(_has_T ? &coupledValue("temperature") : NULL)
{
  // fill in the local tensors from the input vector information

  _Cijkl.fillFromInputVector(_Cijkl_vector, _all_21);
}
Ejemplo n.º 23
0
Real
KineticDisPreConcAux::computeValue()
{
  double _log_k = (isCoupled("lg_kw") ? _EC[_qp] : _log10_k);

  Real kconst = _ref_kconst*exp(-_e_act*(1/_ref_temp-1/_sys_temp)/_gas_const);
  Real omega = 1.0;

  if (_vals.size())
  {
    for (unsigned int i=0; i<_vals.size(); ++i)
    {
      if ((*_vals[i])[_qp] < 0.0) (*_vals[i])[_qp] =0.0;
      omega *= std::pow((*_vals[i])[_qp],_sto_v[i]);
    }

  }

  Real saturation_SI=omega/std::pow(10.0,_log_k);
  Real kinetic_rate=_r_area*kconst*(1.0-saturation_SI);

  if (std::abs(kinetic_rate) <= 1.0e-12)
    kinetic_rate =0.0;

  Real u_new_aux = _u_old[_qp]-kinetic_rate*_dt;

  if (u_new_aux < 0.0)  //dissolution case
    u_new_aux= 0.0;

  return u_new_aux;
}
Ejemplo n.º 24
0
GBEvolution::GBEvolution(const std::string & name,
                 InputParameters parameters)
    :Material(name, parameters),
   _temp(getParam<Real>("temp")),
   //_cg(coupledValue("cg")),
   _f0s(getParam<Real>("f0s")),
   _wGB(getParam<Real>("wGB")),
   _length_scale(getParam<Real>("length_scale")),
   _time_scale(getParam<Real>("time_scale")),
   _GBmob0(getParam<Real>("GBmob0")),
   _Q(getParam<Real>("Q")),
   _GBenergy(getParam<Real>("GBenergy")),
   _has_T(isCoupled("T")),
   _GBMobility(getParam<Real>("GBMobility")),
   _molar_vol(getParam<Real>("molar_volume")),
   _T(_has_T ? &coupledValue("T") : NULL),
   _sigma(declareProperty<Real>("sigma")),
   _M_GB(declareProperty<Real>("M_GB")),
   _kappa(declareProperty<Real>("kappa_op")),
   _gamma(declareProperty<Real>("gamma_asymm")),
   _L(declareProperty<Real>("L")),
   _l_GB(declareProperty<Real>("l_GB")),
   _mu(declareProperty<Real>("mu")),
   _entropy_diff(declareProperty<Real>("entropy_diff")),
   _molar_volume(declareProperty<Real>("molar_volume")),
   _act_wGB(declareProperty<Real>("act_wGB")),
   _tgrad_corr_mult(declareProperty<Real>("tgrad_corr_mult")),
   _kb(8.617343e-5) //Boltzmann constant in eV/K
{
  //Moose::out << "GB mob = " << _GBMobility << ", GBmob0 = " << _GBmob0 << std::endl;

  if (_GBMobility == -1 && _GBmob0 == 0)
    mooseError("Either a value for GBMobility or for GBmob0 and Q must be provided");
}
Ejemplo n.º 25
0
OutOfPlaneStress::OutOfPlaneStress(const InputParameters & parameters)
  : Kernel(parameters),
    _stress(getMaterialProperty<SymmTensor>("stress" +
                                            getParam<std::string>("appended_property_name"))),
    _Jacobian_mult(getMaterialProperty<SymmElasticityTensor>(
        "Jacobian_mult" + getParam<std::string>("appended_property_name"))),
    _d_stress_dT(getMaterialProperty<SymmTensor>("d_stress_dT" +
                                                 getParam<std::string>("appended_property_name"))),
    _xdisp_coupled(isCoupled("disp_x")),
    _ydisp_coupled(isCoupled("disp_y")),
    _temp_coupled(isCoupled("temp")),
    _xdisp_var(_xdisp_coupled ? coupled("disp_x") : 0),
    _ydisp_var(_ydisp_coupled ? coupled("disp_y") : 0),
    _temp_var(_temp_coupled ? coupled("temp") : 0)
{
}
Ejemplo n.º 26
0
TensorMechanicsMaterial::TensorMechanicsMaterial(const std::string & name,
                                                 InputParameters parameters) :
    Material(name, parameters),
    _grad_disp_x(coupledGradient("disp_x")),
    _grad_disp_y(coupledGradient("disp_y")),
    _grad_disp_z(_mesh.dimension() == 3 ? coupledGradient("disp_z") : _grad_zero),
    _grad_disp_x_old(_fe_problem.isTransient() ? coupledGradientOld("disp_x") : _grad_zero),
    _grad_disp_y_old(_fe_problem.isTransient() ? coupledGradientOld("disp_y") : _grad_zero),
    _grad_disp_z_old(_fe_problem.isTransient() && _mesh.dimension() == 3 ? coupledGradientOld("disp_z") : _grad_zero),
    _stress(declareProperty<RankTwoTensor>("stress")),
    _total_strain(declareProperty<RankTwoTensor>("total_strain")),
    _elastic_strain(declareProperty<RankTwoTensor>("elastic_strain")),
    _elasticity_tensor(declareProperty<ElasticityTensorR4>("elasticity_tensor")),
    _Jacobian_mult(declareProperty<ElasticityTensorR4>("Jacobian_mult")),
    // _d_stress_dT(declareProperty<RankTwoTensor>("d_stress_dT")),
    _euler_angle_1(getParam<Real>("euler_angle_1")),
    _euler_angle_2(getParam<Real>("euler_angle_2")),
    _euler_angle_3(getParam<Real>("euler_angle_3")),
    _Cijkl_vector(getParam<std::vector<Real> >("C_ijkl")),
    _Cijkl(),
    _Euler_angles(_euler_angle_1, _euler_angle_2, _euler_angle_3),
    _has_T(isCoupled("temperature")),
    _T(_has_T ? &coupledValue("temperature") : NULL),
    _fill_method((RankFourTensor::FillMethod)(int)getParam<MooseEnum>("fill_method"))
{
  _Cijkl.fillFromInputVector(_Cijkl_vector, _fill_method);

  const std::vector<FunctionName> & fcn_names( getParam<std::vector<FunctionName> >("initial_stress") );
  const unsigned num = fcn_names.size();
  if (!(num == 0 || num == 3*3))
    mooseError("Either zero or " << 3*3 << " initial stress functions must be provided to TensorMechanicsMaterial.  You supplied " << num << "\n");
  _initial_stress.resize(num);
  for (unsigned i = 0 ; i < num ; ++i)
    _initial_stress[i] = &getFunctionByName(fcn_names[i]);
}
Ejemplo n.º 27
0
StressDivergenceTruss::StressDivergenceTruss(const std::string & name, InputParameters parameters)
  :Kernel(name, parameters),
   _axial_stress(getMaterialProperty<Real>("axial_stress" + getParam<std::string>("appended_property_name"))),
   _E_over_L(getMaterialProperty<Real>("e_over_l" + getParam<std::string>("appended_property_name"))),
   _component(getParam<unsigned int>("component")),
   _xdisp_coupled(isCoupled("disp_x")),
   _ydisp_coupled(isCoupled("disp_y")),
   _zdisp_coupled(isCoupled("disp_z")),
   _temp_coupled(isCoupled("temp")),
   _xdisp_var(_xdisp_coupled ? coupled("disp_x") : 0),
   _ydisp_var(_ydisp_coupled ? coupled("disp_y") : 0),
   _zdisp_var(_zdisp_coupled ? coupled("disp_z") : 0),
   _temp_var(_temp_coupled ? coupled("temp") : 0),
   _area(coupledValue("area")),
   _orientation(NULL)
{}
Ejemplo n.º 28
0
StressDivergenceTensors::StressDivergenceTensors(const InputParameters & parameters)
  : ALEKernel(parameters),
    _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
    _use_finite_deform_jacobian(getParam<bool>("use_finite_deform_jacobian")),
    _stress(getMaterialPropertyByName<RankTwoTensor>(_base_name + "stress")),
    _Jacobian_mult(getMaterialPropertyByName<RankFourTensor>(_base_name + "Jacobian_mult")),
    _component(getParam<unsigned int>("component")),
    _ndisp(coupledComponents("displacements")),
    _disp_var(_ndisp),
    _temp_coupled(isCoupled("temperature")),
    _temp_var(_temp_coupled ? coupled("temperature") : 0),
    _avg_grad_test(_test.size(), std::vector<Real>(3, 0.0)),
    _avg_grad_phi(_phi.size(), std::vector<Real>(3, 0.0)),
    _volumetric_locking_correction(getParam<bool>("volumetric_locking_correction"))
{
  for (unsigned int i = 0; i < _ndisp; ++i)
    _disp_var[i] = coupled("displacements", i);

  // Checking for consistency between mesh size and length of the provided displacements vector
  if (_ndisp != _mesh.dimension())
    mooseError("The number of displacement variables supplied must match the mesh dimension.");

  if (_use_finite_deform_jacobian)
  {
    _deformation_gradient =
        &getMaterialProperty<RankTwoTensor>(_base_name + "deformation_gradient");
    _deformation_gradient_old =
        &getMaterialPropertyOld<RankTwoTensor>(_base_name + "deformation_gradient");
    _rotation_increment = &getMaterialProperty<RankTwoTensor>(_base_name + "rotation_increment");
  }

  // Error if volumetic locking correction is turned on for 1D problems
  if (_ndisp == 1 && _volumetric_locking_correction)
    mooseError("Volumetric locking correction should be set to false for 1-D problems.");
}
Ejemplo n.º 29
0
const VariableValue &
Coupleable::coupledValuePreviousNL(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name))
    return *getDefaultValue(var_name);

  _c_fe_problem.needsPreviousNewtonIteration(true);
  coupledCallback(var_name, true);
  MooseVariable * var = getVar(var_name, comp);

  if (!_coupleable_neighbor)
  {
    if (_nodal)
      return var->nodalSlnPreviousNL();
    else
      return var->slnPreviousNL();
  }
  else
  {
    if (_nodal)
      return var->nodalSlnPreviousNLNeighbor();
    else
      return var->slnPreviousNLNeighbor();
  }
}
Ejemplo n.º 30
0
VariableValue &
Coupleable::coupledValueOlder(const std::string & var_name, unsigned int comp)
{
  if (!isCoupled(var_name)) // Need to generate a "default value" filled VariableValue
  {
    VariableValue * value = _default_value[var_name];
    if (value == NULL)
    {
      value = new VariableValue(_coupleable_max_qps, _coupleable_params.defaultCoupledValue(var_name));
      _default_value[var_name] = value;
    }
    return *_default_value[var_name];
  }

  validateExecutionerType(var_name);
  coupledCallback(var_name, true);
  MooseVariable * var = getVar(var_name, comp);
  if (_nodal)
  {
    if (_c_is_implicit)
      return var->nodalSlnOlder();
    else
      mooseError("Older values not available for explicit schemes");
  }
  else
  {
    if (_c_is_implicit)
      return var->slnOlder();
    else
      mooseError("Older values not available for explicit schemes");
  }
}