Exemple #1
0
GapHeatTransfer::GapHeatTransfer(const std::string & name, InputParameters parameters)
    :IntegratedBC(name, parameters),
     _gap_type_set(false),
     _gap_type(Moose::COORD_XYZ),
     _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(88888),
     _edge_multiplier(1.0),
     _has_info(false),
     _xdisp_coupled(isCoupled("disp_x")),
     _ydisp_coupled(isCoupled("disp_y")),
     _zdisp_coupled(isCoupled("disp_z")),
     _xdisp_var(_xdisp_coupled ? coupled("disp_x") : 0),
     _ydisp_var(_ydisp_coupled ? coupled("disp_y") : 0),
     _zdisp_var(_zdisp_coupled ? coupled("disp_z") : 0),
     _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 (_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);
    }
}
Exemple #2
0
ForchheimerMass::ForchheimerMass(const InputParameters & parameters) :
  Kernel(parameters),
  // Coupled gradients
  _grad_u_vel(coupledGradient("u")),
  _grad_v_vel(coupledGradient("v")),
  _grad_w_vel(coupledGradient("w")),
  _grad_p(coupledGradient("p")),
  // Coupled variables
  _u_vel(coupledValue("u")),
  _v_vel(coupledValue("v")),
  _w_vel(coupledValue("w")),
  _p(coupledValue("p")),
  // Density from Richards
  _density(getUserObject<RichardsDensity>("gas_density_userobject")),
  // Variable numberings
  _u_vel_var_number(coupled("u")),
  _v_vel_var_number(coupled("v")),
  _w_vel_var_number(coupled("w")),
  _p_var_number(coupled("p"))
{
}
FunctionMaterialBase::FunctionMaterialBase(const std::string & name,
                                               InputParameters parameters) :
    DerivativeMaterialInterface<Material>(name, parameters),
    _F_name(getParam<std::string>("f_name")),
    _prop_F(&declareProperty<Real>(_F_name)),
    _number_of_nl_variables(_fe_problem.getNonlinearSystem().nVariables()),
    _arg_index(_number_of_nl_variables)
{
  // loop counters
  unsigned int i, j, k;

  // fetch names and numbers of all coupled variables
  _mapping_is_unique = true;
  for (std::set<std::string>::const_iterator it = _pars.coupledVarsBegin(); it != _pars.coupledVarsEnd(); ++it)
  {
    std::map<std::string, std::vector<MooseVariable *> >::iterator vars = _coupled_vars.find(*it);

    // no MOOSE variable was provided for this coupling, skip derivatives w.r.t. this variable
    if (vars == _coupled_vars.end())
      continue;

    // check if we have a 1:1 mapping between parameters and variables
    if (vars->second.size() != 1)
      _mapping_is_unique = false;

    // iterate over all components
    for (unsigned int j = 0; j < vars->second.size(); ++j)
    {
      // make sure each nonlinear variable is coupled in only once
      if (std::find(_arg_names.begin(), _arg_names.end(), vars->second[j]->name()) != _arg_names.end())
        mooseError("A nonlinear variable can only be coupled in once.");

      // insert the map values
      //unsigned int number = vars->second[j]->number();
      unsigned int number = coupled(*it, j);
      _arg_names.push_back(vars->second[j]->name());
      _arg_numbers.push_back(number);
      _arg_param_names.push_back(*it);

      // populate number -> arg index lookup table skipping aux variables
      if (number < _number_of_nl_variables)
        _arg_index[number] = _args.size();

      // get variable value
      _args.push_back(&coupledValue(*it, j));
    }
  }
  _nargs = _arg_names.size();

  // check number of coupled variables
  if (_nargs == 0)
    mooseError("Need at least one couple variable for Function Materials.");
}
JouleHeatingSource::JouleHeatingSource(const InputParameters & parameters)
  : DerivativeMaterialInterface<JvarMapKernelInterface<HeatSource>>(parameters),
    _grad_elec(coupledGradient("elec")),
    _elec_var(coupled("elec")),
    _elec_cond(getMaterialProperty<Real>("electrical_conductivity")),
    _delec_cond_dT(getMaterialPropertyDerivative<Real>("electrical_conductivity", _var.name())),
    _delec_cond_darg(_coupled_moose_vars.size())
{
  for (unsigned int i = 0; i < _delec_cond_darg.size(); ++i)
    _delec_cond_darg[i] = &getMaterialPropertyDerivative<Real>("electrical_conductivity",
                                                               _coupled_moose_vars[i]->name());
}
Exemple #5
0
PorousFlow2PhasePP::PorousFlow2PhasePP(const InputParameters & parameters) :
    PorousFlowVariableBase(parameters),

    _phase0_porepressure_nodal(coupledNodalValue("phase0_porepressure")),
    _phase0_porepressure_qp(coupledValue("phase0_porepressure")),
    _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
    _phase0_porepressure_varnum(coupled("phase0_porepressure")),
    _p0var(_dictator_UO.isPorousFlowVariable(_phase0_porepressure_varnum) ? _dictator_UO.porousFlowVariableNum(_phase0_porepressure_varnum) : 0),

    _phase1_porepressure_nodal(coupledNodalValue("phase1_porepressure")),
    _phase1_porepressure_qp(coupledValue("phase1_porepressure")),
    _phase1_gradp_qp(coupledGradient("phase1_porepressure")),
    _phase1_porepressure_varnum(coupled("phase1_porepressure")),
    _p1var(_dictator_UO.isPorousFlowVariable(_phase1_porepressure_varnum) ? _dictator_UO.porousFlowVariableNum(_phase1_porepressure_varnum) : 0),

    _tvar(_dictator_UO.isPorousFlowVariable(_temperature_varnum) ? _dictator_UO.porousFlowVariableNum(_temperature_varnum) : 0)

{
  if (_dictator_UO.numPhases() != 2)
    mooseError("The Dictator announces that the number of phases is " << _dictator_UO.numPhases() << " whereas PorousFlow2PhasePP can only be used for 2-phase simulation.  When you have an efficient government, you have a dictatorship.");
}
RichardsHalfGaussianSinkFlux::RichardsHalfGaussianSinkFlux(const InputParameters & parameters)
  : SideIntegralVariablePostprocessor(parameters),
    _feproblem(dynamic_cast<FEProblemBase &>(_subproblem)),
    _maximum(getParam<Real>("max")),
    _sd(getParam<Real>("sd")),
    _centre(getParam<Real>("centre")),
    _richards_name_UO(getUserObject<RichardsVarNames>("richardsVarNames_UO")),
    _pvar(_richards_name_UO.richards_var_num(coupled("variable"))),
    _m_func(getFunction("multiplying_fcn")),
    _pp(getMaterialProperty<std::vector<Real>>("porepressure"))
{
}
ComputeExternalGrainForceAndTorque::ComputeExternalGrainForceAndTorque(const InputParameters & parameters) :
    DerivativeMaterialInterface<ShapeElementUserObject>(parameters),
    GrainForceAndTorqueInterface(),
    _c_name(getVar("c", 0)->name()),
    _c_var(coupled("c")),
    _dF_name(getParam<MaterialPropertyName>("force_density")),
    _dF(getMaterialPropertyByName<std::vector<RealGradient> >(_dF_name)),
    _dFdc(getMaterialPropertyByName<std::vector<RealGradient> >(propertyNameFirst(_dF_name, _c_name))),
    _op_num(coupledComponents("etas")),
    _grain_tracker(getUserObject<GrainTrackerInterface>("grain_data")),
    _vals_var(_op_num),
    _vals_name(_op_num),
    _dFdeta(_op_num)
{
  for (unsigned int i = 0; i < _op_num; ++i)
  {
    _vals_var[i] = coupled("etas", i);
    _vals_name[i] = getVar("etas", i)->name();
    _dFdeta[i] = &getMaterialPropertyByName<std::vector<RealGradient> >(propertyNameFirst(_dF_name, _vals_name[i]));
  }
}
Exemple #8
0
DesorptionToPorespace::DesorptionToPorespace(const std::string & name,
                                             InputParameters parameters) :
    Kernel(name,parameters),
    _conc_val(&coupledValue("conc_var")),
    _conc_var(coupled("conc_var")),

    _desorption_time_const(getMaterialProperty<Real>("desorption_time_const")),
    _adsorption_time_const(getMaterialProperty<Real>("adsorption_time_const")),
    _equilib_conc(getMaterialProperty<Real>("desorption_equilib_conc")),
    _equilib_conc_prime(getMaterialProperty<Real>("desorption_equilib_conc_prime"))
{
}
OrderParameterFunctionMaterial::OrderParameterFunctionMaterial(const std::string & name,
                                                               InputParameters parameters) :
    DerivativeMaterialInterface<Material>(name, parameters),
    _eta(coupledValue("eta")),
    _eta_var(coupled("eta")),
    _eta_name(getVar("eta", 0)->name()),
    _function_name(getParam<std::string>("function_name")),
    _prop_f(declareProperty<Real>(_function_name)),
    _prop_df(declarePropertyDerivative<Real>(_function_name, _eta_name)),
    _prop_d2f(declarePropertyDerivative<Real>(_function_name, _eta_name, _eta_name))
{
}
Exemple #10
0
ACMultiInterface::ACMultiInterface(const InputParameters & parameters) :
    Kernel(parameters),
    _num_etas(coupledComponents("etas")),
    _eta(_num_etas),
    _grad_eta(_num_etas),
    _eta_vars(_fe_problem.getNonlinearSystem().nVariables(), -1),
    _kappa_names(getParam<std::vector<MaterialPropertyName> >("kappa_names")),
    _kappa(_num_etas),
    _L(getMaterialProperty<Real>("mob_name"))
{
  if (_num_etas != _kappa_names.size())
    mooseError("Supply the same nummber of etas and kappa_names.");

  unsigned int nvariables = _fe_problem.getNonlinearSystem().nVariables();

  int a = -1;
  for (unsigned int i = 0; i < _num_etas; ++i)
  {
    // get all order parameters and their gradients
    _eta[i] = &coupledValue("etas", i);
    _grad_eta[i] = &coupledGradient("etas", i);

    // populate lookup table form jvar to _eta index
    unsigned int var = coupled("etas", i);
    if (var < nvariables)
      _eta_vars[var] = i;

    // get the index of the variable the kernel is operating on
    if (coupled("etas", i) == _var.number())
      a = i;

    // get gradient prefactors
    _kappa[i] = &getMaterialPropertyByName<Real>(_kappa_names[i]);
  }

  if (a < 0)
    mooseError("Kernel variable must be listed in etas for ACMultiInterface kernel " << name());
  else
    _a = a;
}
Exemple #11
0
INSSplitMomentum::INSSplitMomentum(const InputParameters & parameters)
  : Kernel(parameters),

    // Coupled variables
    _u_vel(coupledValue("u")),
    _v_vel(_mesh.dimension() >= 2 ? coupledValue("v") : _zero),
    _w_vel(_mesh.dimension() == 3 ? coupledValue("w") : _zero),

    _a1(coupledValue("a1")),
    _a2(_mesh.dimension() >= 2 ? coupledValue("a2") : _zero),
    _a3(_mesh.dimension() == 3 ? coupledValue("a3") : _zero),

    // Gradients
    _grad_u_vel(coupledGradient("u")),
    _grad_v_vel(_mesh.dimension() >= 2 ? coupledGradient("v") : _grad_zero),
    _grad_w_vel(_mesh.dimension() == 3 ? coupledGradient("w") : _grad_zero),

    // Variable numberings
    _u_vel_var_number(coupled("u")),
    _v_vel_var_number(_mesh.dimension() >= 2 ? coupled("v") : libMesh::invalid_uint),
    _w_vel_var_number(_mesh.dimension() == 3 ? coupled("w") : libMesh::invalid_uint),

    _a1_var_number(coupled("a1")),
    _a2_var_number(_mesh.dimension() >= 2 ? coupled("a2") : libMesh::invalid_uint),
    _a3_var_number(_mesh.dimension() == 3 ? coupled("a3") : libMesh::invalid_uint),

    // Required parameters
    _gravity(getParam<RealVectorValue>("gravity")),
    _component(getParam<unsigned>("component")),

    // Material properties
    _mu(getMaterialProperty<Real>("mu_name")),
    _rho(getMaterialProperty<Real>("rho_name"))
{
}
Exemple #12
0
ContactMaster::ContactMaster(const InputParameters & parameters) :
    DiracKernel(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>("boundary"),
                                               getParam<BoundaryName>("slave"),
                                               Utility::string_to_enum<Order>(getParam<MooseEnum>("order")))),
    _penalty(getParam<Real>("penalty")),
    _friction_coefficient(getParam<Real>("friction_coefficient")),
    _tension_release(getParam<Real>("tension_release")),
    _capture_tolerance(getParam<Real>("capture_tolerance")),
    _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),
    _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())
{
  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"));

  if (_model == CM_GLUED ||
      (_model == CM_COULOMB && _formulation == CF_DEFAULT))
    _penetration_locator.setUpdate(false);

  if (_friction_coefficient < 0)
    mooseError("The friction coefficient must be nonnegative");
}
// DEPRECATED CONSTRUCTOR
StressDivergencePFFracTensors::StressDivergencePFFracTensors(const std::string & deprecated_name, InputParameters parameters) :
    StressDivergenceTensors(deprecated_name, parameters),
    _c_coupled(isCoupled("c")),
    _c_var(_c_coupled ? coupled("c") : 0)
{
  if (_c_coupled)
  {
    if (!isParamValid("pff_jac_prop_name"))
      mooseError("StressDivergencePFFracTensors: Provide pff_jac_prop_name that contains d_stress_d_c: Coupled variable only used in Jacobian evaluation");
    else
      _d_stress_dc  = &getMaterialProperty<RankTwoTensor>("pff_jac_prop_name");
  }
}
CoupledTPBPotentialYSZQS::CoupledTPBPotentialYSZQS(const InputParameters & parameters) :
    Kernel(parameters),
    _s0(getParam<Real>("s0")),
    _z(getParam<Real>("z")),
    _F(getParam<Real>("F")),
    _R(getParam<Real>("R")),
    _T(getParam<Real>("T")),
    _func_phi_LSM(getFunction("function_phi_LSM")),
    _pO2_CE(getParam<Real>("pO2_CE")),
    _num_p_O2(coupled("p_O2")),
    _p_O2(coupledValue("p_O2"))
{
}
Exemple #15
0
INSProjection::INSProjection(const std::string & name, InputParameters parameters) :
  Kernel(name, parameters),

  // Coupled variables
  _a1(coupledValue("a1")),
  _a2(_mesh.dimension() >= 2 ? coupledValue("a2") : _zero),
  _a3(_mesh.dimension() == 3 ? coupledValue("a3") : _zero),

  // Gradients
  _grad_p(coupledGradient("p")),

  // Variable numberings
  _a1_var_number(coupled("a1")),
  _a2_var_number(_mesh.dimension() >= 2 ? coupled("a2") : libMesh::invalid_uint),
  _a3_var_number(_mesh.dimension() == 3 ? coupled("a3") : libMesh::invalid_uint),
  _p_var_number(coupled("p")),

  // Required parameters
  _rho(getParam<Real>("rho")),
  _component(getParam<unsigned>("component"))
{
}
ExcitationReaction::ExcitationReaction(const InputParameters & parameters)
  : Kernel(parameters),

    _r_units(1. / getParam<Real>("position_units")),
    _n_gas(getMaterialProperty<Real>("n_gas")),
    _diffem(getMaterialProperty<Real>("diffem")),
    _muem(getMaterialProperty<Real>("muem")),
    _alpha_source(getMaterialProperty<Real>("alpha_ex")),
    // _alpha_sink(getMaterialProperty<Real>("alpha_dex")),
    _d_iz_d_actual_mean_en(getMaterialProperty<Real>("d_iz_d_actual_mean_en")),
    _d_muem_d_actual_mean_en(getMaterialProperty<Real>("d_muem_d_actual_mean_en")),
    _d_diffem_d_actual_mean_en(getMaterialProperty<Real>("d_diffem_d_actual_mean_en")),
    _mean_en(coupledValue("mean_en")),
    _grad_potential(coupledGradient("potential")),
    _em(coupledValue("em")),
    _grad_em(coupledGradient("em")),
    _mean_en_id(coupled("mean_en")),
    _potential_id(coupled("potential")),
    _em_id(coupled("em")),
    _reactant(getParam<bool>("reactant"))
{
}
Exemple #17
0
LowMachPreconditioner::LowMachPreconditioner(const InputParameters & parameters) :
  Kernel(parameters),
    // Coupled auxilary 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_old(coupledValueOld("pressure")),
    _pressure_older(coupledValueOlder("pressure")),
    _area(coupledValue("area")),
    // Equation of state:
    _eos(getUserObject<EquationOfState>("eos")),
    // Parameters:
    _Mach_ref(getParam<Real>("Mach_nb_ref")),
    // 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)


{}
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"))),
  _normalize_penalty(getParam<bool>("normalize_penalty")),
  _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"));

  if (_model == CM_GLUED ||
      (_model == CM_COULOMB && _formulation == CF_DEFAULT))
    _penetration_locator.setUpdate(false);

  if (_friction_coefficient < 0)
    mooseError("The friction coefficient must be nonnegative");
}
ElectronAdvectionDoNothingBC::ElectronAdvectionDoNothingBC(const InputParameters & parameters) :
    IntegratedBC(parameters),

    _position_units(1./getParam<Real>("position_units")),

    _muem(getMaterialProperty<Real>("muem")),
    _d_muem_d_actual_mean_en(getMaterialProperty<Real>("d_muem_d_actual_mean_en")),
    _sign(getMaterialProperty<Real>("sgnem")),

    // Coupled variables

    _potential_id(coupled("potential")),
    _grad_potential(coupledGradient("potential")),
    _mean_en(coupledValue("mean_en")),
    _mean_en_id(coupled("mean_en")),

    _d_actual_mean_en_d_mean_en(0),
    _d_muem_d_mean_en(0),
    _d_actual_mean_en_d_u(0),
    _d_muem_d_u(0)
{
}
Exemple #20
0
RigidBodyModesRZ::RigidBodyModesRZ(const InputParameters & parameters) :
  NodalUserObject(parameters),
  _subspace_name(parameters.get<std::string>("subspace_name")),
  _subspace_indices(parameters.get<std::vector<unsigned int> >("subspace_indices")),
  _disp_r_i(coupled("disp_r")),
  _disp_z_i(coupled("disp_z"))
{
  if (_subspace_indices.size() != 1) {
    std::stringstream err;
    err << "Expected 1 RZ rigid body mode, got " << _subspace_indices.size()  << " instead\n";
    mooseError(err.str());
  }
  for (unsigned int i = 0; i < _subspace_indices.size(); ++i)
  {
    if (_subspace_indices[i] >= _fe_problem.subspaceDim(_subspace_name))
    {
      std::stringstream err;
      err << "Invalid " << i << "-th " << _subspace_name << " index " << _subspace_indices[i] << "; must be < " << _fe_problem.subspaceDim(_subspace_name) << "\n";
      mooseError(err.str());
    }
  }
}
Exemple #21
0
TwoSpeciesSource::TwoSpeciesSource(const InputParameters & parameters) :
  // You must call the constructor of the base class first
  Kernel(parameters),
  _Distribution(getFunction("Distribution")),
  _neutronflux_var(coupled("neutron_flux")),
  _neutronflux(coupledValue("neutron_flux")),
  _species_j1(coupledValue("species_j1")),
  _c1(getParam<Real>("c1")),
  _c2(getParam<Real>("c2")),
  _cross1(getMaterialProperty<Real>("Pu239_absorption")),
  _cross2(getMaterialProperty<Real>("Pu239_capture")),//test,calcu should be 4 kernels 
  _expansion_factor(getMaterialProperty<Real>("expansion_factor"))
{}
ElectronsFromIonizationLFA::ElectronsFromIonizationLFA(const InputParameters & parameters) :
    Kernel(parameters),
    
    _diffem(getMaterialProperty<Real>("diffem")),
    _muem(getMaterialProperty<Real>("muem")),
    _iz_coeff_efield_a(getMaterialProperty<Real>("iz_coeff_efield_a")),
    _iz_coeff_efield_b(getMaterialProperty<Real>("iz_coeff_efield_b")),
    _iz_coeff_efield_c(getMaterialProperty<Real>("iz_coeff_efield_c")),

    _grad_potential(coupledGradient("potential")),
    _potential_id(coupled("potential"))
{
}
Exemple #23
0
INSChorinCorrector::INSChorinCorrector(const InputParameters & parameters) :
  Kernel(parameters),

  // Current velocities
  _u_vel_star(coupledValue("u_star")),
  _v_vel_star(_mesh.dimension() >= 2 ? coupledValue("v_star") : _zero),
  _w_vel_star(_mesh.dimension() == 3 ? coupledValue("w_star") : _zero),

  // Pressure gradient
  _grad_p(coupledGradient("p")),

  // Variable numberings
  _u_vel_star_var_number(coupled("u_star")),
  _v_vel_star_var_number(_mesh.dimension() >= 2 ? coupled("v_star") : libMesh::invalid_uint),
  _w_vel_star_var_number(_mesh.dimension() == 3 ? coupled("w_star") : libMesh::invalid_uint),
  _p_var_number(coupled("p")),

  // Required parameters
  _rho(getParam<Real>("rho")),
  _component(getParam<unsigned>("component"))
{
}
FlowProperties::FlowProperties(const InputParameters & parameters)
:Material(parameters),

_molecular_wieght(getParam<std::vector<Real> >("molecular_wieght")),
_comp_heat_capacity(getParam<std::vector<Real> >("comp_heat_capacity")),
_comp_ref_viscosity(getParam<std::vector<Real> >("comp_ref_viscosity")),
_comp_ref_temp(getParam<std::vector<Real> >("comp_ref_temp")),
_comp_Sutherland_const(getParam<std::vector<Real> >("comp_Sutherland_const")),
_flow_rate(getParam<Real>("flow_rate")),
_column_length(getParam<Real>("column_length")),

_velocity(declareProperty<Real>("velocity")),
_gas_density(declareProperty<Real>("gas_density")),
_gas_viscosity(declareProperty<Real>("gas_viscosity")),
_gas_heat_capacity(declareProperty<Real>("gas_heat_capacity")),
_gas_molecular_wieght(declareProperty<Real>("gas_molecular_wieght")),
_inner_dia(getMaterialProperty<Real>("inner_dia")),
_porosity(getMaterialProperty<Real>("porosity")),
_pellet_density(getMaterialProperty<Real>("pellet_density")),
_pellet_heat_capacity(getMaterialProperty<Real>("pellet_heat_capacity")),

_heat_retardation(declareProperty<Real>("heat_retardation")),
_molecular_diffusion(declareProperty<std::vector<Real> >("molecular_diffusion")),
_dispersion(declareProperty<std::vector<Real> >("dispersion")),
_retardation(declareProperty<std::vector<Real> >("retardation")),
_temperature(coupledValue("temperature")),
_total_pressure(coupledValue("total_pressure"))

{
	unsigned int n = coupledComponents("coupled_gases");
	_index.resize(n);
	_gas_conc.resize(n);
	_solid_conc.resize(n);
	_solid_perturb.resize(n);
	
	for (unsigned int i = 0; i<_gas_conc.size(); ++i)
	{
		_index[i] = coupled("coupled_gases",i); //may only be useful for compute Jacobian Off Diagonal (see ~/projects/truck/moose/modules/chemical_reactions/ .../ CoupledConvectionReactionSub.C)
		_gas_conc[i] = &coupledValue("coupled_gases",i);
		_solid_conc[i] = &coupledValue("coupled_adsorption",i);
		_solid_perturb[i] = &coupledValue("coupled_perturbation",i);
	}
	
	/*
	 Note: When using _gas_conc[i], it must be appropriately dereferenced as follows...
	 (*_gas_conc[i])[_qp] = concentration of species i at node _qp
   
   Opposite for materials
   _molecular_diffusion[_qp][i] = Dm[_qp][i]
	 */
}
Exemple #25
0
KKSCHBulk::KKSCHBulk(const InputParameters & parameters) :
    CHBulk(parameters),
    // number of coupled variables (ca, args_a[])
    _nvar(_coupled_moose_vars.size()),
    _ca_var(coupled("ca")),
    _ca_name(getVar("ca", 0)->name()),
    _cb_var(coupled("cb")),
    _cb_name(getVar("cb", 0)->name()),
    _prop_h(getMaterialProperty<Real>("h_name")),
    _second_derivative_Fa(getMaterialPropertyDerivative<Real>("fa_name", _ca_name, _ca_name)),
    _second_derivative_Fb(getMaterialPropertyDerivative<Real>("fb_name", _cb_name, _cb_name))
{
  // reserve space for derivatives
  _second_derivatives.resize(_nvar);
  _third_derivatives.resize(_nvar);
  _third_derivatives_ca.resize(_nvar);
  _grad_args.resize(_nvar);

  // Iterate over all coupled variables
  for (unsigned int i = 0; i < _nvar; ++i)
  {
    MooseVariable *cvar = this->_coupled_moose_vars[i];

    // get the second derivative material property (TODO:warn)
    _second_derivatives[i] = &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name());

    // get the third derivative material properties
    _third_derivatives[i].resize(_nvar);
    for (unsigned int j = 0; j < _nvar; ++j)
      _third_derivatives[i][j] = &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name(), _coupled_moose_vars[j]->name());

    // third derivative for the on-diagonal jacobian
    _third_derivatives_ca[i] = &getMaterialPropertyDerivative<Real>("fa_name", _ca_name, cvar->name(), _ca_name);

    // get the gradient
    _grad_args[i] = &(cvar->gradSln());
  }
}
ExampleShapeSideIntegratedBC::ExampleShapeSideIntegratedBC(const InputParameters & parameters)
  : NonlocalIntegratedBC(parameters),
    _num_shp(getUserObject<NumShapeSideUserObject>("num_user_object")),
    _num_shp_integral(_num_shp.getIntegral()),
    _num_shp_jacobian(_num_shp.getJacobian()),
    _denom_shp(getUserObject<DenomShapeSideUserObject>("denom_user_object")),
    _denom_shp_integral(_denom_shp.getIntegral()),
    _denom_shp_jacobian(_denom_shp.getJacobian()),
    _var_dofs(_var.dofIndices()),
    _v_var(coupled("v")),
    _v_dofs(getVar("v", 0)->dofIndices()),
    _Vb(getParam<Real>("Vb"))
{
}
CoupledKernelGradTest::CoupledKernelGradTest(const InputParameters & parameters)
  : KernelGrad(parameters), _var2(coupledValue("var2")), _var2_num(coupled("var2"))
{
  std::vector<Real> a(getParam<std::vector<Real>>("vel"));
  if (a.size() != 2)
  {
    mooseError("ERROR: CoupledKernelGradTest only implemented for 2D, vel is not size 2");
  }
  _beta = RealVectorValue(a[0], a[1]);

  // Test coupling error
  if (getParam<bool>("test_coupling_error"))
    coupledGradient("var_undeclared");
}
PorousFlow2PhasePS::PorousFlow2PhasePS(const InputParameters & parameters) :
    PorousFlowVariableBase(parameters),

    _phase0_porepressure_nodal(coupledNodalValue("phase0_porepressure")),
    _phase0_porepressure_qp(coupledValue("phase0_porepressure")),
    _phase0_gradp_qp(coupledGradient("phase0_porepressure")),
    _phase0_porepressure_varnum(coupled("phase0_porepressure")),
    _pvar(_dictator.isPorousFlowVariable(_phase0_porepressure_varnum) ? _dictator.porousFlowVariableNum(_phase0_porepressure_varnum) : 0),

    _phase1_saturation_nodal(coupledNodalValue("phase1_saturation")),
    _phase1_saturation_qp(coupledValue("phase1_saturation")),
    _phase1_grads_qp(coupledGradient("phase1_saturation")),
    _phase1_saturation_varnum(coupled("phase1_saturation")),
    _svar(_dictator.isPorousFlowVariable(_phase1_saturation_varnum) ? _dictator.porousFlowVariableNum(_phase1_saturation_varnum) : 0),

    _tvar(_dictator.isPorousFlowVariable(_temperature_varnum) ? _dictator.porousFlowVariableNum(_temperature_varnum) : 0),

    _pc(getParam<Real>("pc"))

{
  if (_dictator.numPhases() != 2)
    mooseError("The Dictator proclaims that the number of phases is " << _dictator.numPhases() << " whereas PorousFlow2PhasePS can only be used for 2-phase simulation.  Be aware that the Dictator has noted your mistake.");
}
PorousFlowDesorpedMassTimeDerivative::PorousFlowDesorpedMassTimeDerivative(
    const InputParameters & parameters)
  : TimeKernel(parameters),
    _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
    _conc_var_number(coupled("conc_var")),
    _conc(coupledValue("conc_var")),
    _conc_old(coupledValueOld("conc_var")),
    _porosity(getMaterialProperty<Real>("PorousFlow_porosity_qp")),
    _porosity_old(getMaterialPropertyOld<Real>("PorousFlow_porosity_qp")),
    _dporosity_dvar(getMaterialProperty<std::vector<Real>>("dPorousFlow_porosity_qp_dvar")),
    _dporosity_dgradvar(
        getMaterialProperty<std::vector<RealGradient>>("dPorousFlow_porosity_qp_dgradvar"))
{
}
Exemple #30
0
DCIonBC::DCIonBC(const InputParameters & parameters) :
  IntegratedBC(parameters),

  _mu(getMaterialProperty<Real>("mu"+_var.name())),
  _sgn(getMaterialProperty<Real>("sgn"+_var.name())),
  // _vthermal_ip(getMaterialProperty<Real>("vthermal_ip")),
  _a(0.0),
  _r_units(1. / getParam<Real>("position_units")),

  // coupled variables

  _grad_potential(coupledGradient("potential")),
  _potential_id(coupled("potential"))
{}