//------------------------------------------------------------------------------
Albany::MechanicsProblem::
MechanicsProblem(const Teuchos::RCP<Teuchos::ParameterList>& params,
    const Teuchos::RCP<ParamLib>& param_lib,
    const int num_dims,
    const Teuchos::RCP<AAdapt::rc::Manager>& rc_mgr,
    Teuchos::RCP<const Teuchos::Comm<int>>& commT) :
    Albany::AbstractProblem(params, param_lib),
    have_source_(false),
    thermal_source_(SOURCE_TYPE_NONE),
    thermal_source_evaluated_(false),
    have_contact_(false),
    num_dims_(num_dims),
    have_mech_eq_(false),
    have_temperature_eq_(false),
    have_pore_pressure_eq_(false),
    have_transport_eq_(false),
    have_hydrostress_eq_(false),
    have_damage_eq_(false),
    have_stab_pressure_eq_(false),
    have_peridynamics_(false),
    have_topmod_adaptation_(false),
    have_sizefield_adaptation_(false),
    rc_mgr_(rc_mgr)
{

  std::string& method = params->get("Name", "Mechanics ");
  *out << "Problem Name = " << method << '\n';

  // Are any source functions specified?
  have_source_ = params->isSublist("Source Functions");

  // Is contact specified?
  have_contact_ = params->isSublist("Contact");

  // Is adaptation specified?
  bool adapt_sublist_exists = params->isSublist("Adaptation");

  if(adapt_sublist_exists){

    Teuchos::ParameterList const &
    adapt_params = params->sublist("Adaptation");

    std::string const &
    adaptation_method_name = adapt_params.get<std::string>("Method");

    have_sizefield_adaptation_ = (adaptation_method_name == "RPI Albany Size");

  }

  getVariableType(params->sublist("Displacement"),
      "DOF",
      mech_type_,
      have_mech_,
      have_mech_eq_);
  getVariableType(params->sublist("Temperature"),
      "None",
      temperature_type_,
      have_temperature_,
      have_temperature_eq_);
  getVariableType(params->sublist("Pore Pressure"),
      "None",
      pore_pressure_type_,
      have_pore_pressure_,
      have_pore_pressure_eq_);
  getVariableType(params->sublist("Transport"),
      "None",
      transport_type_,
      have_transport_,
      have_transport_eq_);
  getVariableType(params->sublist("HydroStress"),
      "None",
      hydrostress_type_,
      have_hydrostress_,
      have_hydrostress_eq_);
  getVariableType(params->sublist("Damage"),
      "None",
      damage_type_,
      have_damage_,
      have_damage_eq_);
  getVariableType(params->sublist("Stabilized Pressure"),
      "None",
      stab_pressure_type_,
      have_stab_pressure_,
      have_stab_pressure_eq_);

  // Compute number of equations
  int num_eq = 0;
  if (have_mech_eq_) num_eq += num_dims_;
  if (have_temperature_eq_) num_eq += 1;
  if (have_pore_pressure_eq_) num_eq += 1;
  if (have_transport_eq_) num_eq += 1;
  if (have_hydrostress_eq_) num_eq += 1;
  if (have_damage_eq_) num_eq += 1;
  if (have_stab_pressure_eq_) num_eq += 1;
  this->setNumEquations(num_eq);

  // Print out a summary of the problem
  *out << "Mechanics problem:" << '\n'
      << "\tSpatial dimension             : " << num_dims_ << '\n'
      << "\tMechanics variables           : "
      << variableTypeToString(mech_type_)
      << '\n'
      << "\tTemperature variables         : "
      << variableTypeToString(temperature_type_)
      << '\n'
      << "\tPore Pressure variables       : "
      << variableTypeToString(pore_pressure_type_)
      << '\n'
      << "\tTransport variables           : "
      << variableTypeToString(transport_type_)
      << '\n'
      << "\tHydroStress variables         : "
      << variableTypeToString(hydrostress_type_)
      << '\n'
      << "\tDamage variables              : "
      << variableTypeToString(damage_type_)
      << '\n'
      << "\tStabilized Pressure variables : "
      << variableTypeToString(stab_pressure_type_)
      << '\n';

  material_db_ = LCM::createMaterialDatabase(params, commT);

  // Determine the Thermal source 
  //   - the "Source Functions" list must be present in the input file,
  //   - we must have temperature and have included a temperature equation

  if (have_source_ && have_temperature_ && have_temperature_eq_) {
    // If a thermal source is specified
    if (params->sublist("Source Functions").isSublist("Thermal Source")) {

      Teuchos::ParameterList& thSrcPL = params->sublist("Source Functions")
          .sublist("Thermal Source");

      if (thSrcPL.get<std::string>("Thermal Source Type", "None")
          == "Block Dependent") {

        if (Teuchos::nonnull(material_db_)) {
          thermal_source_ = SOURCE_TYPE_MATERIAL;
        }
      }
      else {

        thermal_source_ = SOURCE_TYPE_INPUT;

      }
    }
  }

  //the following function returns the problem information required for
  //setting the rigid body modes (RBMs) for elasticity problems (in
  //src/Albany_SolverFactory.cpp) written by IK, Feb. 2012

  // Need numPDEs should be num_dims_ + nDOF for other governing equations  -SS

  int num_PDEs = neq;
  int num_elasticity_dim = 0;
  if (have_mech_eq_) num_elasticity_dim = num_dims_;
  int num_scalar = neq - num_elasticity_dim;
  int null_space_dim(0);
  if (have_mech_eq_) {
    if (num_dims_ == 1) {
      null_space_dim = 0;
    }
    else if (num_dims_ == 2) {
      null_space_dim = 3;
    }
    else if (num_dims_ == 3) {
      null_space_dim = 6;
    }
    else {
      TEUCHOS_TEST_FOR_EXCEPTION(
          true,
          std::logic_error,
          '\n' << "Error: " << __FILE__ << " line " << __LINE__ <<
          ": num_dims_ set incorrectly." << '\n');
    }
  }

  rigidBodyModes->setParameters(
      num_PDEs,
      num_elasticity_dim,
      num_scalar,
      null_space_dim);

  // Check whether we are doing adaptive insertion with topology modification.
  bool const
  have_adaptation = params->isSublist("Adaptation");

  if (have_adaptation == true) {
    Teuchos::ParameterList const &
    adapt_params = params->sublist("Adaptation");

    std::string const &
    adaptation_method_name = adapt_params.get<std::string>("Method");

    have_topmod_adaptation_ = adaptation_method_name == "Topmod";
  }

}
Beispiel #2
0
//------------------------------------------------------------------------------
Albany::MechanicsProblem::
MechanicsProblem(const Teuchos::RCP<Teuchos::ParameterList>& params,
    const Teuchos::RCP<ParamLib>& param_lib,
    const int num_dims,
    Teuchos::RCP<const Teuchos::Comm<int> >& commT) : 
    Albany::AbstractProblem(params, param_lib),
    have_source_(false),
    num_dims_(num_dims),
    have_mech_eq_(false),
    have_temperature_eq_(false),
    have_pore_pressure_eq_(false),
    have_transport_eq_(false),
    have_hydrostress_eq_(false),
    have_damage_eq_(false),
    have_stab_pressure_eq_(false),
    have_peridynamics_(false)
{

  std::string& method = params->get("Name", "Mechanics ");
  *out << "Problem Name = " << method << '\n';

  have_source_ = params->isSublist("Source Functions");

  getVariableType(params->sublist("Displacement"),
      "DOF",
      mech_type_,
      have_mech_,
      have_mech_eq_);
  getVariableType(params->sublist("Temperature"),
      "None",
      temperature_type_,
      have_temperature_,
      have_temperature_eq_);
  getVariableType(params->sublist("Pore Pressure"),
      "None",
      pore_pressure_type_,
      have_pore_pressure_,
      have_pore_pressure_eq_);
  getVariableType(params->sublist("Transport"),
      "None",
      transport_type_,
      have_transport_,
      have_transport_eq_);
  getVariableType(params->sublist("HydroStress"),
      "None",
      hydrostress_type_,
      have_hydrostress_,
      have_hydrostress_eq_);
  getVariableType(params->sublist("Damage"),
      "None",
      damage_type_,
      have_damage_,
      have_damage_eq_);
  getVariableType(params->sublist("Stabilized Pressure"),
      "None",
      stab_pressure_type_,
      have_stab_pressure_,
      have_stab_pressure_eq_);

  if (have_temperature_eq_)
    have_source_ = params->isSublist("Source Functions");

  // Compute number of equations
  int num_eq = 0;
  if (have_mech_eq_) num_eq += num_dims_;
  if (have_temperature_eq_) num_eq += 1;
  if (have_pore_pressure_eq_) num_eq += 1;
  if (have_transport_eq_) num_eq += 1;
  if (have_hydrostress_eq_) num_eq += 1;
  if (have_damage_eq_) num_eq += 1;
  if (have_stab_pressure_eq_) num_eq += 1;
  this->setNumEquations(num_eq);

  // Print out a summary of the problem
  *out << "Mechanics problem:" << '\n'
      << "\tSpatial dimension             : " << num_dims_ << '\n'
      << "\tMechanics variables           : "
      << variableTypeToString(mech_type_)
      << '\n'
      << "\tTemperature variables         : "
      << variableTypeToString(temperature_type_)
      << '\n'
      << "\tPore Pressure variables       : "
      << variableTypeToString(pore_pressure_type_)
      << '\n'
      << "\tTransport variables           : "
      << variableTypeToString(transport_type_)
      << '\n'
      << "\tHydroStress variables         : "
      << variableTypeToString(hydrostress_type_)
      << '\n'
      << "\tDamage variables              : "
      << variableTypeToString(damage_type_)
      << '\n'
      << "\tStabilized Pressure variables : "
      << variableTypeToString(stab_pressure_type_)
      << '\n';

  material_db_ = LCM::createMaterialDatabase(params, commT);

  //the following function returns the problem information required for
  //setting the rigid body modes (RBMs) for elasticity problems (in
  //src/Albany_SolverFactory.cpp) written by IK, Feb. 2012

  // Need numPDEs should be num_dims_ + nDOF for other governing equations  -SS

  int num_PDEs = neq;
  int num_elasticity_dim = 0;
  if (have_mech_eq_) num_elasticity_dim = num_dims_;
  int num_scalar = neq - num_elasticity_dim;
  int null_space_dim(0);
  if (have_mech_eq_) {
    if (num_dims_ == 1) {
      null_space_dim = 0;
    }
    if (num_dims_ == 2) {
      null_space_dim = 3;
    }
    if (num_dims_ == 3) {
      null_space_dim = 6;
    }
  }

  rigidBodyModes->setParameters(
      num_PDEs,
      num_elasticity_dim,
      num_scalar,
      null_space_dim);

}