<commit_before>#include "ThermalContactAction.h"
#include "FEProblem.h"
#include "Factory.h"
#include "ActionFactory.h"
#include "AddSlaveFluxVectorAction.h"
#include "Conversion.h"
#include "MooseApp.h"

static unsigned int n = 0;                                  // numbering for gap heat transfer objects (we can have them on multiple interfaces)
static const std::string GAP_VALUE_VAR_NAME = "gap_value";
static const std::string PENETRATION_VAR_NAME = "penetration";

template<>
InputParameters validParams<ThermalContactAction>()
{
  MooseEnum orders("CONSTANT, FIRST, SECOND, THIRD, FORTH", "FIRST");
  
  InputParameters params = validParams<Action>();
  params.addRequiredParam<std::string>("type", "A string representing the Moose object that will be used for heat conduction over the gap");
  params.addParam<std::string>("gap_type", "GapValueAux", "A string representing the Moose object that will be used for computing the gap size");
  params.addRequiredParam<NonlinearVariableName>("variable", "The variable for thermal contact");
  params.addRequiredParam<BoundaryName>("master", "The master surface");
  params.addRequiredParam<BoundaryName>("slave", "The slave surface");
  params.addParam<NonlinearVariableName>("disp_x", "The x displacement");
  params.addParam<NonlinearVariableName>("disp_y", "The y displacement");
  params.addParam<NonlinearVariableName>("disp_z", "The z displacement");
  params.addParam<Real>("tangential_tolerance", "Tangential distance to extend edges of contact surfaces");
  params.addParam<MooseEnum>("order", orders, "The finite element order");
  params.addParam<bool>("warnings", false, "Whether to output warning messages concerning nodes not being found");
  params.addParam<std::vector<std::string> >("save_in", "The Auxiliary Variable to (optionally) save the boundary flux in");

  return params;
}

ThermalContactAction::ThermalContactAction(const std::string & name, InputParameters params) :
    Action(name, params)
{
}

void
ThermalContactAction::addBcs()
{
  /*
   * [./gap2]
   *   type = GapHeatTransfer
   *   variable = temp
   *   boundary = 10
   *   gap_distance = penetration
   *   gap_temp = gap_value
   *   disp_x = disp_x
   *   disp_y = disp_y
   *   disp_z = disp_z
   * [../]
   */

  InputParameters action_params = ActionFactory::instance()->getValidParams("AddBCAction");
  action_params.set<ActionWarehouse *>("awh") = getParam<ActionWarehouse *>("awh");
  action_params.set<std::string>("type") = getParam<std::string>("type");
  action_params.set<std::string>("name") = "BCs/gap_bc_" + Moose::stringify(n);
  Action *action = ActionFactory::instance()->create("AddBCAction", action_params);
  MooseObjectAction *moose_object_action = dynamic_cast<MooseObjectAction *>(action);
  mooseAssert (moose_object_action, "Dynamic Cast failed");

  InputParameters & params = moose_object_action->getObjectParams();

  // get valid params for the BC specified in 'type' field
  InputParameters bc_params = Factory::instance()->getValidParams(getParam<std::string>("type"));
  _parser->extractParams(_name, bc_params);
  params += bc_params;

  if(isParamValid("save_in"))
    params.set<std::vector<std::string> >("save_in") = getParam<std::vector<std::string> >("save_in");  

  params.set<NonlinearVariableName>("variable") = getParam<NonlinearVariableName>("variable");
  std::vector<AuxVariableName> vars(1);
  vars[0] = PENETRATION_VAR_NAME;
  params.set<std::vector<AuxVariableName> >("gap_distance") = vars;
//  vars[0] = GAP_VALUE_VAR_NAME;
  vars[0] = "fake_gap_temp";
  params.set<std::vector<AuxVariableName> >("gap_temp") = vars;
  std::vector<BoundaryName> bnds(1, getParam<BoundaryName>("slave"));
  params.set<std::vector<BoundaryName> >("boundary") = bnds;

  if (isParamValid("disp_x"))
  {
    params.addCoupledVar("disp_x", "The x displacement");
    std::vector<NonlinearVariableName> disp_x(1, getParam<NonlinearVariableName>("disp_x"));
    params.set< std::vector<NonlinearVariableName> >("disp_x") = disp_x;
  }
  if (isParamValid("disp_y"))
  {
    params.addCoupledVar("disp_y", "The y displacement");
    std::vector<NonlinearVariableName> disp_y(1, getParam<NonlinearVariableName>("disp_y"));
    params.set< std::vector<NonlinearVariableName> >("disp_y") = disp_y;
  }
  if (isParamValid("disp_z"))
  {
    params.addCoupledVar("disp_z", "The z displacement");
    std::vector<NonlinearVariableName> disp_z(1, getParam<NonlinearVariableName>("disp_z"));
    params.set< std::vector<NonlinearVariableName> >("disp_z") = disp_z;
  }<commit_msg>accidentally committed a debugging statement<commit_after>#include "ThermalContactAction.h"
#include "FEProblem.h"
#include "Factory.h"
#include "ActionFactory.h"
#include "AddSlaveFluxVectorAction.h"
#include "Conversion.h"
#include "MooseApp.h"

static unsigned int n = 0;                                  // numbering for gap heat transfer objects (we can have them on multiple interfaces)
static const std::string GAP_VALUE_VAR_NAME = "gap_value";
static const std::string PENETRATION_VAR_NAME = "penetration";

template<>
InputParameters validParams<ThermalContactAction>()
{
  MooseEnum orders("CONSTANT, FIRST, SECOND, THIRD, FORTH", "FIRST");
  
  InputParameters params = validParams<Action>();
  params.addRequiredParam<std::string>("type", "A string representing the Moose object that will be used for heat conduction over the gap");
  params.addParam<std::string>("gap_type", "GapValueAux", "A string representing the Moose object that will be used for computing the gap size");
  params.addRequiredParam<NonlinearVariableName>("variable", "The variable for thermal contact");
  params.addRequiredParam<BoundaryName>("master", "The master surface");
  params.addRequiredParam<BoundaryName>("slave", "The slave surface");
  params.addParam<NonlinearVariableName>("disp_x", "The x displacement");
  params.addParam<NonlinearVariableName>("disp_y", "The y displacement");
  params.addParam<NonlinearVariableName>("disp_z", "The z displacement");
  params.addParam<Real>("tangential_tolerance", "Tangential distance to extend edges of contact surfaces");
  params.addParam<MooseEnum>("order", orders, "The finite element order");
  params.addParam<bool>("warnings", false, "Whether to output warning messages concerning nodes not being found");
  params.addParam<std::vector<std::string> >("save_in", "The Auxiliary Variable to (optionally) save the boundary flux in");

  return params;
}

ThermalContactAction::ThermalContactAction(const std::string & name, InputParameters params) :
    Action(name, params)
{
}

void
ThermalContactAction::addBcs()
{
  /*
   * [./gap2]
   *   type = GapHeatTransfer
   *   variable = temp
   *   boundary = 10
   *   gap_distance = penetration
   *   gap_temp = gap_value
   *   disp_x = disp_x
   *   disp_y = disp_y
   *   disp_z = disp_z
   * [../]
   */

  InputParameters action_params = ActionFactory::instance()->getValidParams("AddBCAction");
  action_params.set<ActionWarehouse *>("awh") = getParam<ActionWarehouse *>("awh");
  action_params.set<std::string>("type") = getParam<std::string>("type");
  action_params.set<std::string>("name") = "BCs/gap_bc_" + Moose::stringify(n);
  Action *action = ActionFactory::instance()->create("AddBCAction", action_params);
  MooseObjectAction *moose_object_action = dynamic_cast<MooseObjectAction *>(action);
  mooseAssert (moose_object_action, "Dynamic Cast failed");

  InputParameters & params = moose_object_action->getObjectParams();

  // get valid params for the BC specified in 'type' field
  InputParameters bc_params = Factory::instance()->getValidParams(getParam<std::string>("type"));
  _parser->extractParams(_name, bc_params);
  params += bc_params;

  if(isParamValid("save_in"))
    params.set<std::vector<std::string> >("save_in") = getParam<std::vector<std::string> >("save_in");  

  params.set<NonlinearVariableName>("variable") = getParam<NonlinearVariableName>("variable");
  std::vector<AuxVariableName> vars(1);
  vars[0] = PENETRATION_VAR_NAME;
  params.set<std::vector<AuxVariableName> >("gap_distance") = vars;
  vars[0] = GAP_VALUE_VAR_NAME;
  params.set<std::vector<AuxVariableName> >("gap_temp") = vars;
  std::vector<BoundaryName> bnds(1, getParam<BoundaryName>("slave"));
  params.set<std::vector<BoundaryName> >("boundary") = bnds;

  if (isParamValid("disp_x"))
  {
    params.addCoupledVar("disp_x", "The x displacement");
    std::vector<NonlinearVariableName> disp_x(1, getParam<NonlinearVariableName>("disp_x"));
    params.set< std::vector<NonlinearVariableName> >("disp_x") = disp_x;
  }
  if (isParamValid("disp_y"))
  {
    params.addCoupledVar("disp_y", "The y displacement");
    std::vector<NonlinearVariableName> disp_y(1, getParam<NonlinearVariableName>("disp_y"));
    params.set< std::vector<NonlinearVariableName> >("disp_y") = disp_y;
  }
  if (isParamValid("disp_z"))
  {
    params.addCoupledVar("disp_z", "The z displacement");
    std::vector<NonlinearVariableName> disp_z(1, getParam<NonlinearVariableName>("disp_z"));
    params.set< std::vector<NonlinearVariableName> >("disp_z") = disp_z;
  }
{'fraction_non_alphanumeric': 0.14518257809062912, 'fraction_numerical': 0.0025296964364276285, 'mean_word_length': 6.092823712948518, 'pattern_counts': {'":': 0, '<': 103, '<?xml version=': 0, '>': 113, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5214747', 'n_tokens_mistral': 2928, 'n_tokens_neox': 2883, 'n_words': 588}