Esempio n. 1
0
RealVectorValue
RichardsSUPGstandard::dtauSUPG_dgradp(RealVectorValue vel, RealTensorValue dvel_dgradp, Real traceperm, RealVectorValue b, RealVectorValue db2_dgradp) const
{
  Real norm_vel = std::pow(vel*vel, 0.5);
  if (norm_vel == 0)
    return RealVectorValue();
  RealVectorValue norm_vel_dgradp(dvel_dgradp*vel/norm_vel);

  Real norm_b = std::pow(b*b, 0.5);
  if (norm_b == 0)
    return RealVectorValue();
  RealVectorValue norm_b_dgradp = db2_dgradp/2/norm_b;

  Real h = 2*norm_vel/norm_b; // h is a measure of the element length in the "a" direction
  RealVectorValue h_dgradp(2*norm_vel_dgradp/norm_b - 2*norm_vel*norm_b_dgradp/norm_b/norm_b);

  Real alpha = 0.5*norm_vel*h/traceperm/_p_SUPG;  // this is the Peclet number
  RealVectorValue alpha_dgradp = 0.5*(norm_vel_dgradp*h + norm_vel*h_dgradp)/traceperm/_p_SUPG;

  Real xi_tilde = RichardsSUPGstandard::cosh_relation(alpha);
  Real xi_tilde_prime = RichardsSUPGstandard::cosh_relation_prime(alpha);
  RealVectorValue xi_tilde_dgradp = xi_tilde_prime*alpha_dgradp;

  RealVectorValue tau_dgradp = xi_tilde_dgradp/norm_b - xi_tilde*norm_b_dgradp/norm_b/norm_b;

  return tau_dgradp;
}
Esempio n. 2
0
InputParameters validParams<SolutionUserObject>()
{
  // Get the input parameters from the parent class
  InputParameters params = validParams<GeneralUserObject>();

  // Add required parameters
  params.addRequiredParam<MeshFileName>("mesh", "The name of the mesh file (must be xda or exodusII file).");
  params.addParam<std::vector<std::string> >("system_variables", std::vector<std::string>(),
                                             "The name of the nodal and elemental variables from the file you want to use for values");

  // When using XDA files the following must be defined
  params.addParam<FileName>("es", "<not supplied>", "The name of the file holding the equation system info in xda format (xda only).");
  params.addParam<std::string>("system", "nl0", "The name of the system to pull values out of (xda only).");

  // When using ExodusII a specific time is extracted
  params.addParam<int>("timestep", -1, "Index of the single timestep used (exodusII only).  If not supplied, time interpolation will occur.");

  // Add ability to perform coordinate transformation: scale, factor
  params.addDeprecatedParam<std::vector<Real> >("coord_scale", "This name has been deprecated.",  "Please use scale instead");
  params.addDeprecatedParam<std::vector<Real> >("coord_factor", "This name has been deprecated.",  "Please use translation instead");
  params.addParam<std::vector<Real> >("scale", std::vector<Real>(LIBMESH_DIM,1), "Scale factor for points in the simulation");
  params.addParam<std::vector<Real> >("scale_multiplier", std::vector<Real>(LIBMESH_DIM,1), "Scale multiplying factor for points in the simulation");
  params.addParam<std::vector<Real> >("translation", std::vector<Real>(LIBMESH_DIM,0), "Translation factors for x,y,z coordinates of the simulation");
  params.addParam<RealVectorValue>("rotation0_vector", RealVectorValue(0, 0, 1), "Vector about which to rotate points of the simulation.");
  params.addParam<Real>("rotation0_angle", 0.0, "Anticlockwise rotation angle (in degrees) to use for rotation about rotation0_vector.");
  params.addParam<RealVectorValue>("rotation1_vector", RealVectorValue(0, 0, 1), "Vector about which to rotate points of the simulation.");
  params.addParam<Real>("rotation1_angle", 0.0, "Anticlockwise rotation angle (in degrees) to use for rotation about rotation1_vector.");

  // following lines build the default_transformation_order
  MultiMooseEnum default_transformation_order("rotation0 translation scale rotation1 scale_multiplier", "translation scale");
  params.addParam<MultiMooseEnum>("transformation_order", default_transformation_order, "The order to perform the operations in.  Define R0 to be the rotation matrix encoded by rotation0_vector and rotation0_angle.  Similarly for R1.  Denote the scale by s, the scale_multiplier by m, and the translation by t.  Then, given a point x in the simulation, if transformation_order = 'rotation0 scale_multiplier translation scale rotation1' then form p = R1*(R0*x*m - t)/s.  Then the values provided by the SolutionUserObject at point x in the simulation are the variable values at point p in the mesh.");
  // Return the parameters
  return params;
}
Esempio n. 3
0
Real INSChorinPredictor::computeQpResidual()
{
  // Vector object for test function
  RealVectorValue test;
  test(_component) = _test[_i][_qp];

  // Tensor object for test function gradient
  RealTensorValue grad_test;
  for (unsigned k=0; k<3; ++k)
    grad_test(_component, k) = _grad_test[_i][_qp](k);

  // Decide what velocity vector, gradient to use:
  RealVectorValue U;
  RealTensorValue grad_U;

  switch (_predictor_enum)
  {
  case OLD:
  {
    U = RealVectorValue(_u_vel_old[_qp], _v_vel_old[_qp], _w_vel_old[_qp]);
    grad_U = RealTensorValue(_grad_u_vel_old[_qp], _grad_v_vel_old[_qp], _grad_w_vel_old[_qp]);
    break;
  }
  case NEW:
  {
    U = RealVectorValue(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);
    grad_U = RealTensorValue(_grad_u_vel[_qp], _grad_v_vel[_qp], _grad_w_vel[_qp]);
    break;
  }
  case STAR:
  {
    // Note: Donea and Huerta's book says you are supposed to use "star" velocity to make Chorin implicit, not U^{n+1}.
    U = RealVectorValue(_u_vel_star[_qp], _v_vel_star[_qp], _w_vel_star[_qp]);
    grad_U = RealTensorValue(_grad_u_vel_star[_qp], _grad_v_vel_star[_qp], _grad_w_vel_star[_qp]);
    break;
  }
  default:
    mooseError("Unrecognized Chorin predictor type requested.");
  }


  //
  // Compute the different parts
  //

  // Note: _u is the component'th entry of "u_star" in Chorin's method.
  RealVectorValue U_old(_u_vel_old[_qp], _v_vel_old[_qp], _w_vel_old[_qp]);
  Real symmetric_part = (_u[_qp] - U_old(_component)) * _test[_i][_qp];

  // Convective part.  Remember to multiply by _dt!
  Real convective_part = _dt * (grad_U * U) * test;

  // Viscous part - we are using the Laplacian form here for simplicity.
  // Remember to multiply by _dt!
  Real viscous_part = _dt * (_mu/_rho) * grad_U.contract(grad_test);

  return symmetric_part + convective_part + viscous_part;
}
Esempio n. 4
0
void addMaterialTensorParams(InputParameters& params)
{
  MooseEnum quantities("VonMises=1, PlasticStrainMag, Hydrostatic, Hoop, Radial, Axial, MaxPrincipal, MedPrincipal, MinPrincipal, FirstInvariant, SecondInvariant, ThirdInvariant, TriAxiality, VolumetricStrain");

  params.addRequiredParam<std::string>("tensor", "The material tensor name.");
  params.addParam<int>("index", -1, "The index into the tensor, from 0 to 5 (xx, yy, zz, xy, yz, zx).");
  params.addParam<MooseEnum>("quantity", quantities, "A scalar quantity to compute: " + quantities.getRawNames());

  params.addParam<RealVectorValue>("point1", RealVectorValue(0, 0, 0), "Point one for defining an axis");
  params.addParam<RealVectorValue>("point2", RealVectorValue(0, 1, 0), "Point two for defining an axis");
}
InputParameters validParams<MaterialTensorCalculator>()
{
  InputParameters params = emptyInputParameters();
  MooseEnum quantities("VonMises=1 PlasticStrainMag Hydrostatic Direction Hoop Radial Axial MaxPrincipal MedPrincipal MinPrincipal FirstInvariant SecondInvariant ThirdInvariant TriAxiality VolumetricStrain");

  params.addParam<int>("index", -1, "The index into the tensor, from 0 to 5 (xx, yy, zz, xy, yz, zx).");
  params.addParam<MooseEnum>("quantity", quantities, "A scalar quantity to compute: " + quantities.getRawNames());

  params.addParam<RealVectorValue>("point1", RealVectorValue(0, 0, 0), "Start point for axis used to calculate some material tensor quantities");
  params.addParam<RealVectorValue>("point2", RealVectorValue(0, 1, 0), "End point for axis used to calculate some material tensor quantities");
  params.addParam<RealVectorValue>("direction", RealVectorValue(1, 0, 0), "Direction vector");
  return params;
}
Esempio n. 6
0
void
GolemMaterialBase::computeGravity()
{
  if (_has_gravity)
  {
    if (_mesh.dimension() == 3)
      _gravity = RealVectorValue(0., 0., -_g);
    else if (_mesh.dimension() == 2)
      _gravity = RealVectorValue(0., -_g, 0.);
    else if (_mesh.dimension() == 1)
      _gravity = RealVectorValue(-_g, 0., 0.);
  }
  else
    _gravity = RealVectorValue(0., 0., 0.);
}
Esempio n. 7
0
InputParameters validParams<MaterialTensorOnLine>()
{
  InputParameters params = validParams<ElementUserObject>();
  params += validParams<MaterialTensorCalculator>();

  params.addRequiredParam<std::string>("tensor", "The material tensor name.");
  params.addParam<RealVectorValue>("line_point1", RealVectorValue(0, 0, 0), "Start point of line along which material data is output");
  params.addParam<RealVectorValue>("line_point2", RealVectorValue(0, 1, 0), "End point of line along which material data is output");
  params.addCoupledVar("element_line_id","Element line ID: if not zero, output stress at integration points");
  params.addRequiredParam<std::string>("filename","Output file name");
  params.addParam<int>("line_id",1,"ID of the line of elements to output stresses on");
  params.set<MooseEnum>("execute_on") = "timestep";

  return params;
}
Esempio n. 8
0
RealVectorValue RichardsSUPGnone::velSUPG(RealTensorValue /*perm*/,
                                          RealVectorValue /*gradp*/,
                                          Real /*density*/,
                                          RealVectorValue /*gravity*/) const
{
  return RealVectorValue();
}
Real
NSEnergyInviscidSpecifiedDensityAndVelocityBC::computeQpResidual()
{
  return qpResidualHelper(_specified_density,
                          RealVectorValue(_specified_u, _specified_v, _specified_w),
                          _pressure[_qp]);
}
Esempio n. 10
0
RealVectorValue RichardsSUPGnone::dtauSUPG_dgradp(RealVectorValue /*vel*/,
                                                  RealTensorValue /*dvel_dgradp*/,
                                                  Real /*traceperm*/,
                                                  RealVectorValue /*b*/,
                                                  RealVectorValue /*db2_dgradp*/) const
{
  return RealVectorValue();
}
Esempio n. 11
0
// following is d(bb*bb)/d(gradp)
RealVectorValue RichardsSUPGnone::dbb2_dgradp(RealVectorValue /*vel*/,
                                              RealTensorValue /*dvel_dgradp*/,
                                              RealVectorValue /*xi_prime*/,
                                              RealVectorValue /*eta_prime*/,
                                              RealVectorValue /*zeta_prime*/) const
{
  return RealVectorValue();
}
Esempio n. 12
0
RealVectorValue
RichardsSUPGnone::bb(RealVectorValue /*vel*/,
                     int /*dimen*/,
                     RealVectorValue /*xi_prime*/,
                     RealVectorValue /*eta_prime*/,
                     RealVectorValue /*zeta_prime*/) const
{
  return RealVectorValue();
}
Esempio n. 13
0
RealVectorValue
PenetrationLocator::penetrationNormal(dof_id_type node_id)
{
  std::map<dof_id_type, PenetrationInfo *>::const_iterator found_it = _penetration_info.find(node_id);

  if (found_it != _penetration_info.end())
    return found_it->second->_normal;
  else
    return RealVectorValue(0, 0, 0);
}
Esempio n. 14
0
InputParameters
validParams<LevelSetOlssonBubble>()
{
  InputParameters params = validParams<Function>();
  params.addClassDescription("Implementation of 'bubble' ranging from 0 to 1.");
  params.addParam<RealVectorValue>(
      "center", RealVectorValue(0.5, 0.5, 0), "The center of the bubble.");
  params.addParam<Real>("radius", 0.15, "The radius of the bubble.");
  params.addParam<Real>("epsilon", 0.01, "The interface thickness.");
  return params;
}
Esempio n. 15
0
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");
}
InputParameters validParams<Axisymmetric2D3DSolutionFunction>()
{
  // Get the Function input parameters
  InputParameters params = validParams<Function>();

  // Add parameters specific to this object
  params.addRequiredParam<UserObjectName>("solution", "The SolutionUserObject to extract data from.");
  params.addParam<std::vector<std::string> >("from_variables", "The names of the variables in the file that are to be extracted, in x, y order if they are vector components");

  params.addParam<Real>("scale_factor", 1.0, "Scale factor (a) to be applied to the solution (x): ax+b, where b is the 'add_factor'");
  params.addParam<Real>("add_factor", 0.0, "Add this value (b) to the solution (x): ax+b, where a is the 'scale_factor'");

  params.addParam<RealVectorValue>("2d_axis_point1", RealVectorValue(0,0,0), "Start point for axis of symmetry for the 2d model");
  params.addParam<RealVectorValue>("2d_axis_point2", RealVectorValue(0,1,0), "End point for axis of symmetry for the 2d model");
  params.addParam<RealVectorValue>("3d_axis_point1", RealVectorValue(0,0,0), "Start point for axis of symmetry for the 3d model");
  params.addParam<RealVectorValue>("3d_axis_point2", RealVectorValue(0,1,0), "End point for axis of symmetry for the 3d model");

  params.addParam<unsigned int>("component","Component of the variable to be computed if it is a vector");

  params.addClassDescription("Function for reading a 2D axisymmetric solution from file and mapping it to a 3D Cartesian model");

  return params;
}
Esempio n. 17
0
InputParameters
validParams<PorousFlowActionBase>()
{
  InputParameters params = validParams<Action>();
  params.addParam<std::string>(
      "dictator_name",
      "dictator",
      "The name of the dictator user object that is created by this Action");
  params.addClassDescription("Adds the PorousFlowDictator UserObject.  This class also contains "
                             "many utility functions for adding other pieces of an input file, "
                             "which may be used by derived classes.");
  params.addParam<RealVectorValue>("gravity",
                                   RealVectorValue(0.0, 0.0, -10.0),
                                   "Gravitational acceleration vector downwards (m/s^2)");
  params.addCoupledVar("temperature",
                       293.0,
                       "For isothermal simulations, this is the temperature "
                       "at which fluid properties (and stress-free strains) "
                       "are evaluated at.  Otherwise, this is the name of "
                       "the temperature variable.  Units = Kelvin");
  params.addCoupledVar("mass_fraction_vars",
                       "List of variables that represent the mass fractions.  Format is 'f_ph0^c0 "
                       "f_ph0^c1 f_ph0^c2 ... f_ph0^c(N-1) f_ph1^c0 f_ph1^c1 fph1^c2 ... "
                       "fph1^c(N-1) ... fphP^c0 f_phP^c1 fphP^c2 ... fphP^c(N-1)' where "
                       "N=num_components and P=num_phases, and it is assumed that "
                       "f_ph^cN=1-sum(f_ph^c,{c,0,N-1}) so that f_ph^cN need not be given.  If no "
                       "variables are provided then num_phases=1=num_components.");
  params.addParam<unsigned int>("number_aqueous_equilibrium",
                                0,
                                "The number of secondary species in the aqueous-equilibrium "
                                "reaction system.  (Leave as zero if the simulation does not "
                                "involve chemistry)");
  params.addParam<unsigned int>("number_aqueous_kinetic",
                                0,
                                "The number of secondary species in the aqueous-kinetic reaction "
                                "system involved in precipitation and dissolution.  (Leave as zero "
                                "if the simulation does not involve chemistry)");
  params.addParam<std::vector<NonlinearVariableName>>(
      "displacements",
      "The name of the displacement variables (relevant only for "
      "mechanically-coupled simulations)");
  params.addParam<std::string>("thermal_eigenstrain_name",
                               "thermal_eigenstrain",
                               "The eigenstrain_name used in the "
                               "ComputeThermalExpansionEigenstrain.  Only needed for "
                               "thermally-coupled simulations with thermal expansion.");
  params.addParam<bool>(
      "use_displaced_mesh", false, "Use displaced mesh computations in mechanical kernels");
  return params;
}
Esempio n. 18
0
InputParameters validParams<PeacemanBorehole>()
{
    InputParameters params = validParams<DiracKernel>();
    params.addRequiredParam<FunctionName>("character", "If zero then borehole does nothing.  If positive the borehole acts as a sink (production well) for porepressure > borehole pressure, and does nothing otherwise.  If negative the borehole acts as a source (injection well) for porepressure < borehole pressure, and does nothing otherwise.  The flow rate to/from the borehole is multiplied by |character|, so usually character = +/- 1, but you can specify other quantities to provide an overall scaling to the flow if you like.");
    params.addRequiredParam<Real>("bottom_pressure", "Pressure at the bottom of the borehole");
    params.addRequiredParam<RealVectorValue>("unit_weight", "(fluid_density*gravitational_acceleration) as a vector pointing downwards.  Note that the borehole pressure at a given z position is bottom_pressure + unit_weight*(p - p_bottom), where p=(x,y,z) and p_bottom=(x,y,z) of the bottom point of the borehole.  If you don't want bottomhole pressure to vary in the borehole just set unit_weight=0.  Typical value is = (0,0,-1E4)");
    params.addRequiredParam<std::string>("point_file", "The file containing the borehole radii and coordinates of the point sinks that approximate the borehole.  Each line in the file must contain a space-separated radius and coordinate.  Ie r x y z.  The last point in the file is defined as the borehole bottom, where the borehole pressure is bottom_pressure.  If your file contains just one point, you must also specify the borehole_length and borehole_direction.  Note that you will get segementation faults if your points do not lie within your mesh!");
    params.addRequiredParam<UserObjectName>("SumQuantityUO", "User Object of type=RichardsSumQuantity in which to place the total outflow from the borehole for each time step.");
    params.addParam<Real>("re_constant", 0.28, "The dimensionless constant used in evaluating the borehole effective radius.  This depends on the meshing scheme.  Peacemann finite-difference calculations give 0.28, while for rectangular finite elements the result is closer to 0.1594.  (See  Eqn(4.13) of Z Chen, Y Zhang, Well flow models for various numerical methods, Int J Num Analysis and Modeling, 3 (2008) 375-388.)");
    params.addParam<Real>("well_constant", -1.0, "Usually this is calculated internally from the element geometry, the local borehole direction and segment length, and the permeability.  However, if this parameter is given as a positive number then this number is used instead of the internal calculation.  This speeds up computation marginally.  re_constant becomes irrelevant");
    params.addRangeCheckedParam<Real>("borehole_length", 0.0, "borehole_length>=0", "Borehole length.  Note this is only used if there is only one point in the point_file.");
    params.addParam<RealVectorValue>("borehole_direction", RealVectorValue(0, 0, 1), "Borehole direction.  Note this is only used if there is only one point in the point_file.");
    params.addClassDescription("Approximates a borehole in the mesh using the Peaceman approach, ie using a number of point sinks with given radii whose positions are read from a file");
    return params;
}
Esempio n. 19
0
void
RotationTensor::update(Axis axis, Real angle)
{
  zero();

  RealVectorValue a;
  a(axis) = 1.0;

  const Real s = std::sin(angle * libMesh::pi / 180.0);
  const Real c = std::cos(angle * libMesh::pi / 180.0);

  // assemble row wise
  _coords[0] = a * RealVectorValue(1.0, -c, -c);
  _coords[1] = a * RealVectorValue(0.0, 0.0, s);
  _coords[2] = a * RealVectorValue(0.0, -s, 0.0);

  _coords[3] = a * RealVectorValue(0.0, 0.0, -s);
  _coords[4] = a * RealVectorValue(-c, 1.0, -c);
  _coords[5] = a * RealVectorValue(s, 0.0, 0.0);

  _coords[6] = a * RealVectorValue(0.0, s, 0.0);
  _coords[7] = a * RealVectorValue(-s, 0.0, 0.0);
  _coords[8] = a * RealVectorValue(-c, -c, 1.0);
}
Esempio n. 20
0
Real
LinearVectorPoisson::computeQpResidual()
{
  const Real x = _q_point[_qp](0);
  const Real y = _q_point[_qp](1);

  const Real fx =
      -(_x_sln.value(_t, Point(x, y - _eps, 0)) + _x_sln.value(_t, Point(x, y + _eps, 0)) +
        _x_sln.value(_t, Point(x - _eps, y, 0)) + _x_sln.value(_t, Point(x + _eps, y, 0)) -
        4. * _x_sln.value(_t, Point(x, y, 0))) /
      _eps / _eps;

  const Real fy =
      -(_y_sln.value(_t, Point(x, y - _eps, 0)) + _y_sln.value(_t, Point(x, y + _eps, 0)) +
        _y_sln.value(_t, Point(x - _eps, y, 0)) + _y_sln.value(_t, Point(x + _eps, y, 0)) -
        4. * _y_sln.value(_t, Point(x, y, 0))) /
      _eps / _eps;

  return -RealVectorValue(fx, fy, 0) * _test[_i][_qp];
}
RankFourTensor
GrainTrackerElasticity::newGrain(unsigned int new_grain_id)
{
  EulerAngles angles;

  if (new_grain_id < _euler.getGrainNum())
    angles = _euler.getEulerAngles(new_grain_id);
  else
  {
    if (_random_rotations)
      angles.random();
    else
      mooseError("GrainTrackerElasticity has run out of grain rotation data.");
  }

  RankFourTensor C_ijkl = _C_ijkl;
  C_ijkl.rotate(RotationTensor(RealVectorValue(angles)));

  return C_ijkl;
}
Esempio n. 22
0
Real
INSSplitMomentum::computeQpOffDiagJacobian(unsigned jvar)
{
  if ((jvar == _u_vel_var_number) || (jvar == _v_vel_var_number) || (jvar == _w_vel_var_number))
  {
    // Derivative of viscous stress tensor
    RealTensorValue dtau;

    // Initialize to invalid value, then determine correct value.
    unsigned vel_index = 99;

    // Set index and build dtau for that index
    if (jvar == _u_vel_var_number)
    {
      vel_index = 0;
      dtau(0, 0) = 2. * _grad_phi[_j][_qp](0);
      dtau(0, 1) = _grad_phi[_j][_qp](1);
      dtau(0, 2) = _grad_phi[_j][_qp](2);
      dtau(1, 0) = _grad_phi[_j][_qp](1);
      dtau(2, 0) = _grad_phi[_j][_qp](2);
    }
    else if (jvar == _v_vel_var_number)
    {
      vel_index = 1;
      /*                                 */ dtau(0, 1) = _grad_phi[_j][_qp](0);
      dtau(1, 0) = _grad_phi[_j][_qp](0);
      dtau(1, 1) = 2. * _grad_phi[_j][_qp](1);
      dtau(1, 2) = _grad_phi[_j][_qp](2);
      /*                                 */ dtau(2, 1) = _grad_phi[_j][_qp](2);
    }
    else if (jvar == _w_vel_var_number)
    {
      vel_index = 2;
      /*                                                                     */ dtau(0, 2) =
          _grad_phi[_j][_qp](0);
      /*                                                                     */ dtau(1, 2) =
          _grad_phi[_j][_qp](1);
      dtau(2, 0) = _grad_phi[_j][_qp](0);
      dtau(2, 1) = _grad_phi[_j][_qp](1);
      dtau(2, 2) = 2. * _grad_phi[_j][_qp](2);
    }

    // Vector object for test function
    RealVectorValue test;
    test(_component) = _test[_i][_qp];

    // Vector object for U
    RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);

    // Tensor object for test function gradient
    RealTensorValue grad_test;
    for (unsigned k = 0; k < 3; ++k)
      grad_test(_component, k) = _grad_test[_i][_qp](k);

    // Compute the convective part
    RealVectorValue convective_jac = _phi[_j][_qp] * RealVectorValue(_grad_u_vel[_qp](vel_index),
                                                                     _grad_v_vel[_qp](vel_index),
                                                                     _grad_w_vel[_qp](vel_index));

    // Extra contribution in vel_index component
    convective_jac(vel_index) += U * _grad_phi[_j][_qp];
    Real convective_part = convective_jac * test;

    // Compute the viscous part
    Real viscous_part = (_mu[_qp] / _rho[_qp]) * dtau.contract(grad_test);

    // Return the result
    return convective_part + viscous_part;
  }

  else
    return 0;
}
Esempio n. 23
0
RealVectorValue
Function::vectorValue(Real /*t*/, const Point & /*p*/)
{
  return RealVectorValue(0, 0, 0);
}
Esempio n. 24
0
Biharmonic::JR::JR(EquationSystems& eqSys,
		   const std::string& name,
		   const unsigned int number) :
  TransientNonlinearImplicitSystem(eqSys,name,number),
  _biharmonic(dynamic_cast<Biharmonic&>(eqSys))
{
  // Check that we can actually compute second derivatives
#ifndef LIBMESH_ENABLE_SECOND_DERIVATIVES
  ERROR("Must have second derivatives enabled");
#endif

#ifdef LIBMESH_ENABLE_PERIODIC
  // Add periodicity to the mesh
  DofMap& dof_map = get_dof_map();
  PeriodicBoundary xbdry(RealVectorValue(1.0, 0.0, 0.0));
#if LIBMESH_DIM > 1
  PeriodicBoundary ybdry(RealVectorValue(0.0, 1.0, 0.0));
#endif
#if LIBMESH_DIM > 2
  PeriodicBoundary zbdry(RealVectorValue(0.0, 0.0, 1.0));
#endif

  switch(_biharmonic._dim)
    {
    case 1:
      xbdry.myboundary = 0;
      xbdry.pairedboundary = 1;
      dof_map.add_periodic_boundary(xbdry);
      break;
#if LIBMESH_DIM > 1
    case 2:
      xbdry.myboundary = 3;
      xbdry.pairedboundary = 1;
      dof_map.add_periodic_boundary(xbdry);
      ybdry.myboundary = 0;
      ybdry.pairedboundary = 2;
      dof_map.add_periodic_boundary(ybdry);
      break;
#endif
#if LIBMESH_DIM > 2
    case 3:
      xbdry.myboundary = 4;
      xbdry.pairedboundary = 2;
      dof_map.add_periodic_boundary(xbdry);
      ybdry.myboundary = 1;
      ybdry.pairedboundary = 3;
      dof_map.add_periodic_boundary(ybdry);
      zbdry.myboundary = 0;
      zbdry.pairedboundary = 5;
      dof_map.add_periodic_boundary(zbdry);
      break;
#endif
    default:
      libmesh_error();
    }
#endif // LIBMESH_ENABLE_PERIODIC

  // Adaptivity stuff is commented out for now...
  // #ifndef   LIBMESH_ENABLE_AMR
  //   libmesh_example_assert(false, "--enable-amr");
  // #else
  //   // In case we ever get around to doing mesh refinement.
  //   _biharmonic._meshRefinement = new MeshRefinement(_mesh);
  //
  //   // Tell the MeshRefinement object about the periodic boundaries
  //   // so that it can get heuristics like level-one conformity and unrefined
  //   // island elimination right.
  //   _biharmonic._mesh_refinement->set_periodic_boundaries_ptr(dof_map.get_periodic_boundaries());
  // #endif // LIBMESH_ENABLE_AMR

  // Adds the variable "u" to the system.
  // u will be approximated using Hermite elements
  add_variable("u", THIRD, HERMITE);

  // Give the system an object to compute the initial state.
  attach_init_object(*this);

  // Attache the R & J calculation object
  nonlinear_solver->residual_and_jacobian_object = this;

  // Attach the bounds calculation object
  nonlinear_solver->bounds_object = this;
}
Esempio n. 25
0
Real INSChorinPredictor::computeQpOffDiagJacobian(unsigned jvar)
{
  switch (_predictor_enum)
  {
  case OLD:
  {
    return 0.;
  }

  case NEW:
  {
    if ((jvar == _u_vel_var_number) || (jvar == _v_vel_var_number) || (jvar == _w_vel_var_number))
    {
      // Derivative of grad_U wrt the velocity component
      RealTensorValue dgrad_U;

      // Initialize to invalid value, then determine correct value.
      unsigned vel_index = 99;

      // Map jvar into the indices (0,1,2)
      if (jvar == _u_vel_var_number)
        vel_index = 0;

      else if (jvar == _v_vel_var_number)
        vel_index = 1;

      else if (jvar == _w_vel_var_number)
        vel_index = 2;

      // Fill in the vel_index'th row of dgrad_U with _grad_phi[_j][_qp]
      for (unsigned k=0; k<3; ++k)
        dgrad_U(vel_index,k) = _grad_phi[_j][_qp](k);

      // Vector object for test function
      RealVectorValue test;
      test(_component) = _test[_i][_qp];

      // Vector object for U
      RealVectorValue U(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]);

      // Tensor object for test function gradient
      RealTensorValue grad_test;
      for (unsigned k=0; k<3; ++k)
        grad_test(_component, k) = _grad_test[_i][_qp](k);

      // Compute the convective part
      RealVectorValue convective_jac = _phi[_j][_qp] * RealVectorValue(_grad_u_vel[_qp](vel_index),
                                                                       _grad_v_vel[_qp](vel_index),
                                                                       _grad_w_vel[_qp](vel_index));

      // Extra contribution in vel_index component
      convective_jac(vel_index) += U*_grad_phi[_j][_qp];

      // Be sure to scale by _dt!
      Real convective_part = _dt * (convective_jac * test);

      // Compute the viscous part, be sure to scale by _dt.  Note: the contracted
      // value should be zero unless vel_index and _component match.
      Real viscous_part = _dt * (_mu/_rho) * dgrad_U.contract(grad_test);

      // Return the result
      return convective_part + viscous_part;
    }
    else
      return 0;
  }

  case STAR:
  {
    if (jvar == _u_vel_star_var_number)
    {
      return _dt * _phi[_j][_qp] * _grad_u[_qp](0) * _test[_i][_qp];
    }

    else if (jvar == _v_vel_star_var_number)
    {
      return _dt * _phi[_j][_qp] * _grad_u[_qp](1) * _test[_i][_qp];
    }

    else if (jvar == _w_vel_star_var_number)
    {
      return _dt * _phi[_j][_qp] * _grad_u[_qp](2) * _test[_i][_qp];
    }

    else
      return 0;
  }

  default:
    mooseError("Unrecognized Chorin predictor type requested.");
  }
}
Esempio n. 26
0
Real
NSMachAux::computeValue()
{
  return RealVectorValue(_u_vel[_qp], _v_vel[_qp], _w_vel[_qp]).norm() /
         _fp.c_from_v_e(_specific_volume[_qp], _internal_energy[_qp]);
}
Esempio n. 27
0
RealVectorValue RichardsSUPGnone::dvelSUPG_dp(RealTensorValue /*perm*/,
                                              Real /*density_prime*/,
                                              RealVectorValue /*gravity*/) const
{
  return RealVectorValue();
}
Esempio n. 28
0
void
RotationMatrixTest::rotVecToVecTest()
{
  // rotations of unit vectors to the x, y and z axes
  rotVtoU(RealVectorValue(1, 0, 0), RealVectorValue(1, 0, 0));
  rotVtoU(RealVectorValue(-1, 0, 0), RealVectorValue(1, 0, 0));
  rotVtoU(RealVectorValue(0, 1, 0), RealVectorValue(1, 0, 0));
  rotVtoU(RealVectorValue(0, -1, 0), RealVectorValue(1, 0, 0));
  rotVtoU(RealVectorValue(0, 0, 1), RealVectorValue(1, 0, 0));
  rotVtoU(RealVectorValue(0, 0, -1), RealVectorValue(1, 0, 0));

  rotVtoU(RealVectorValue(1, 0, 0), RealVectorValue(0, 1, 0));
  rotVtoU(RealVectorValue(-1, 0, 0), RealVectorValue(0, 1, 0));
  rotVtoU(RealVectorValue(0, 1, 0), RealVectorValue(0, 1, 0));
  rotVtoU(RealVectorValue(0, -1, 0), RealVectorValue(0, 1, 0));
  rotVtoU(RealVectorValue(0, 0, 1), RealVectorValue(0, 1, 0));
  rotVtoU(RealVectorValue(0, 0, -1), RealVectorValue(0, 1, 0));

  rotVtoU(RealVectorValue(1, 0, 0), RealVectorValue(0, 0, 1));
  rotVtoU(RealVectorValue(-1, 0, 0), RealVectorValue(0, 0, 1));
  rotVtoU(RealVectorValue(0, 1, 0), RealVectorValue(0, 0, 1));
  rotVtoU(RealVectorValue(0, -1, 0), RealVectorValue(0, 0, 1));
  rotVtoU(RealVectorValue(0, 0, 1), RealVectorValue(0, 0, 1));
  rotVtoU(RealVectorValue(0, 0, -1), RealVectorValue(0, 0, 1));

  // more arbitrary vectors
  rotVtoU(RealVectorValue(1, 2, 3), RealVectorValue(3, 2, 1));
  rotVtoU(RealVectorValue(-1, 2, -3), RealVectorValue(3, -2, 1));
  rotVtoU(RealVectorValue(9, 2, -3), RealVectorValue(-900, -2, 1));
  rotVtoU(RealVectorValue(-0.7455566879693396, -0.16322143154726376, -0.19297210504736562), RealVectorValue(-0.7669989857132189, -0.8822797825649573, -0.3274325939199114));
  rotVtoU(RealVectorValue(-0.7669989857132189, -0.8822797825649573, -0.3274325939199114), RealVectorValue(-0.5714138293736171, 0.5178596886944302, -0.1602302709779364));
  rotVtoU(RealVectorValue(-0.6195038399590516, 0.24354357871534127, -0.9637350523439685), RealVectorValue(0.009588924695567158, 0.3461895857140844, -0.7555301721833589));
  rotVtoU(RealVectorValue(0.6418447552756121, 0.9825056348051839, -0.46612920231628086), RealVectorValue(-0.8023314181426899, 0.23569860131733256, 0.24585385679502592));
  rotVtoU(RealVectorValue(0.9115348224777013, -0.1785871095274909, -0.9938009520887727), RealVectorValue(0.7000797283703248, -0.4967869392655946, -0.18288272103373449));
}
Esempio n. 29
0
void FEMParameters::read(GetPot &input)
{
    std::vector<std::string> variable_names;

    GETPOT_INT_INPUT(initial_timestep);
    GETPOT_INT_INPUT(n_timesteps);
    GETPOT_INPUT(transient);
    GETPOT_INT_INPUT(deltat_reductions);
    GETPOT_INPUT(timesolver_core);
    GETPOT_INPUT(end_time);
    GETPOT_INPUT(deltat);
    GETPOT_INPUT(timesolver_theta);
    GETPOT_INPUT(timesolver_maxgrowth);
    GETPOT_INPUT(timesolver_tolerance);
    GETPOT_INPUT(timesolver_upper_tolerance);
    GETPOT_INPUT(steadystate_tolerance);

    GETPOT_REGISTER(timesolver_norm);
    const unsigned int n_timesolver_norm = input.vector_variable_size("timesolver_norm");
    timesolver_norm.resize(n_timesolver_norm, L2);
    for (unsigned int i=0; i != n_timesolver_norm; ++i)
      {
        int current_norm = 0; // L2
        if (timesolver_norm[i] == H1)
          current_norm = 1;
        if (timesolver_norm[i] == H2)
          current_norm = 2;
        current_norm = input("timesolver_norm", current_norm, i);
        if (current_norm == 0)
          timesolver_norm[i] = L2;
        else if (current_norm == 1)
          timesolver_norm[i] = H1;
        else if (current_norm == 2)
          timesolver_norm[i] = H2;
        else
          timesolver_norm[i] = DISCRETE_L2;
      }


    GETPOT_INT_INPUT(dimension);
    GETPOT_INPUT(domaintype);
    GETPOT_INPUT(domainfile);
    GETPOT_INPUT(elementtype);
    GETPOT_INPUT(elementorder);
    GETPOT_INPUT(domain_xmin);
    GETPOT_INPUT(domain_ymin);
    GETPOT_INPUT(domain_zmin);
    GETPOT_INPUT(domain_edge_width);
    GETPOT_INPUT(domain_edge_length);
    GETPOT_INPUT(domain_edge_height);
    GETPOT_INT_INPUT(coarsegridx);
    GETPOT_INT_INPUT(coarsegridy);
    GETPOT_INT_INPUT(coarsegridz);
    GETPOT_INT_INPUT(coarserefinements);
    GETPOT_INT_INPUT(extrarefinements);


    GETPOT_INT_INPUT(nelem_target);
    GETPOT_INPUT(global_tolerance);
    GETPOT_INPUT(refine_fraction);
    GETPOT_INPUT(coarsen_fraction);
    GETPOT_INPUT(coarsen_threshold);
    GETPOT_INT_INPUT(max_adaptivesteps);
    GETPOT_INT_INPUT(initial_adaptivesteps);


    GETPOT_INT_INPUT(write_interval);
    GETPOT_INPUT(output_xda);
    GETPOT_INPUT(output_xdr);
    GETPOT_INPUT(output_gz);
#ifndef LIBMESH_HAVE_GZSTREAM
    output_gz                   = false;
#endif
    GETPOT_INPUT(output_bz2);
#ifndef LIBMESH_HAVE_BZ2
    output_bz2                  = false;
#endif
    GETPOT_INPUT(output_gmv);
    GETPOT_INPUT(write_gmv_error);
#ifndef LIBMESH_HAVE_GMV
    output_gmv                  = false;
    write_gmv_error             = false;
#endif
    GETPOT_INPUT(output_tecplot);
    GETPOT_INPUT(write_tecplot_error);
#ifndef LIBMESH_HAVE_TECPLOT_API
    output_tecplot              = false;
    write_tecplot_error         = false;
#endif


    GETPOT_REGISTER(system_types);
    const unsigned int n_system_types =
      input.vector_variable_size("system_types");
    if (n_system_types)
      {
        system_types.resize(n_system_types, "");
        for (unsigned int i=0; i != n_system_types; ++i)
          {
            system_types[i] = input("system_types", system_types[i], i);
          }
      }


    GETPOT_REGISTER(periodic_boundaries);
    const unsigned int n_periodic_bcs =
      input.vector_variable_size("periodic_boundaries");

    if (n_periodic_bcs)
      {
        if (domaintype != "square" && 
            domaintype != "cylinder" && 
            domaintype != "file" && 
            domaintype != "od2")
          {
            libMesh::out << "Periodic boundaries need rectilinear domains" << std::endl;;
            libmesh_error();
          }
        for (unsigned int i=0; i != n_periodic_bcs; ++i)
          {
            unsigned int myboundary =
              input("periodic_boundaries", -1, i);
            unsigned int pairedboundary = 0;
            RealVectorValue translation_vector;
            if (dimension == 2)
              switch (myboundary)
              {
              case 0:
                pairedboundary = 2;
                translation_vector = RealVectorValue(0., domain_edge_length);
                break;
              case 1:
                pairedboundary = 3;
                translation_vector = RealVectorValue(-domain_edge_width, 0);
                break;
              default:
                libMesh::out << "Unrecognized periodic boundary id " <<
                                myboundary << std::endl;;
                libmesh_error();
              }
            else if (dimension == 3)
              switch (myboundary)
              {
              case 0:
                pairedboundary = 5;
                translation_vector = RealVectorValue(0., 0., domain_edge_height);
                break;
              case 1:
                pairedboundary = 3;
                translation_vector = RealVectorValue(0., domain_edge_length, 0.);
                break;
              case 2:
                pairedboundary = 4;
                translation_vector = RealVectorValue(-domain_edge_width, 0., 0.);
                break;
              default:
                libMesh::out << "Unrecognized periodic boundary id " <<
                                myboundary << std::endl;;
                libmesh_error();
              }
            periodic_boundaries.push_back(PeriodicBoundary(translation_vector));
            periodic_boundaries[i].myboundary = myboundary;
            periodic_boundaries[i].pairedboundary = pairedboundary;
          }
      }

    // Use std::string inputs so GetPot doesn't have to make a bunch
    // of internal C string copies
    std::string zero_string = "zero";
    std::string empty_string = "";

    GETPOT_REGISTER(dirichlet_condition_types);
    GETPOT_REGISTER(dirichlet_condition_values);
    GETPOT_REGISTER(dirichlet_condition_boundaries);
    GETPOT_REGISTER(dirichlet_condition_variables);

    const unsigned int n_dirichlet_conditions=
      input.vector_variable_size("dirichlet_condition_types");

    if (n_dirichlet_conditions !=
        input.vector_variable_size("dirichlet_condition_values"))
      {
        libMesh::out << "Error: " << n_dirichlet_conditions
                     << " Dirichlet condition types does not match "
                     << input.vector_variable_size("dirichlet_condition_values")
                     << " Dirichlet condition values." << std::endl;
        
        libmesh_error();
      }

    if (n_dirichlet_conditions !=
        input.vector_variable_size("dirichlet_condition_boundaries"))
      {
        libMesh::out << "Error: " << n_dirichlet_conditions
                     << " Dirichlet condition types does not match "
                     << input.vector_variable_size("dirichlet_condition_boundaries")
                     << " Dirichlet condition boundaries." << std::endl;
        
        libmesh_error();
      }

    if (n_dirichlet_conditions !=
        input.vector_variable_size("dirichlet_condition_variables"))
      {
        libMesh::out << "Error: " << n_dirichlet_conditions
                     << " Dirichlet condition types does not match "
                     << input.vector_variable_size("dirichlet_condition_variables")
                     << " Dirichlet condition variables sets." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_dirichlet_conditions; ++i)
      {
        const std::string func_type =
          input("dirichlet_condition_types", zero_string, i);

        const std::string func_value =
          input("dirichlet_condition_values", empty_string, i);

        const boundary_id_type func_boundary =
          input("dirichlet_condition_boundaries", boundary_id_type(0), i);

        dirichlet_conditions[func_boundary] =
          (new_function_base(func_type, func_value).release());

        const std::string variable_set =
          input("dirichlet_condition_variables", empty_string, i);

        for (unsigned int i=0; i != variable_set.size(); ++i)
          {
            if (variable_set[i] == '1')
              dirichlet_condition_variables[func_boundary].push_back(i);
            else if (variable_set[i] != '0')
              {
                libMesh::out << "Unable to understand Dirichlet variable set" 
                             << variable_set << std::endl;
                libmesh_error();
              }
          }
      }

    GETPOT_REGISTER(neumann_condition_types);
    GETPOT_REGISTER(neumann_condition_values);
    GETPOT_REGISTER(neumann_condition_boundaries);
    GETPOT_REGISTER(neumann_condition_variables);

    const unsigned int n_neumann_conditions=
      input.vector_variable_size("neumann_condition_types");

    if (n_neumann_conditions !=
        input.vector_variable_size("neumann_condition_values"))
      {
        libMesh::out << "Error: " << n_neumann_conditions
                     << " Neumann condition types does not match "
                     << input.vector_variable_size("neumann_condition_values")
                     << " Neumann condition values." << std::endl;
        
        libmesh_error();
      }

    if (n_neumann_conditions !=
        input.vector_variable_size("neumann_condition_boundaries"))
      {
        libMesh::out << "Error: " << n_neumann_conditions
                     << " Neumann condition types does not match "
                     << input.vector_variable_size("neumann_condition_boundaries")
                     << " Neumann condition boundaries." << std::endl;
        
        libmesh_error();
      }

    if (n_neumann_conditions !=
        input.vector_variable_size("neumann_condition_variables"))
      {
        libMesh::out << "Error: " << n_neumann_conditions
                     << " Neumann condition types does not match "
                     << input.vector_variable_size("neumann_condition_variables")
                     << " Neumann condition variables sets." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_neumann_conditions; ++i)
      {
        const std::string func_type =
          input("neumann_condition_types", zero_string, i);

        const std::string func_value =
          input("neumann_condition_values", empty_string, i);

        const boundary_id_type func_boundary =
          input("neumann_condition_boundaries", boundary_id_type(0), i);

        neumann_conditions[func_boundary] =
          (new_function_base(func_type, func_value).release());

        const std::string variable_set =
          input("neumann_condition_variables", empty_string, i);

        for (unsigned int i=0; i != variable_set.size(); ++i)
          {
            if (variable_set[i] == '1')
              neumann_condition_variables[func_boundary].push_back(i);
            else if (variable_set[i] != '0')
              {
                libMesh::out << "Unable to understand Neumann variable set" 
                             << variable_set << std::endl;
                libmesh_error();
              }
          }
      }

    GETPOT_REGISTER(initial_condition_types);
    GETPOT_REGISTER(initial_condition_values);
    GETPOT_REGISTER(initial_condition_subdomains);

    const unsigned int n_initial_conditions=
      input.vector_variable_size("initial_condition_types");

    if (n_initial_conditions !=
        input.vector_variable_size("initial_condition_values"))
      {
        libMesh::out << "Error: " << n_initial_conditions
                     << " initial condition types does not match "
                     << input.vector_variable_size("initial_condition_values")
                     << " initial condition values." << std::endl;
        
        libmesh_error();
      }

    if (n_initial_conditions !=
        input.vector_variable_size("initial_condition_subdomains"))
      {
        libMesh::out << "Error: " << n_initial_conditions
                     << " initial condition types does not match "
                     << input.vector_variable_size("initial_condition_subdomains")
                     << " initial condition subdomains." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_initial_conditions; ++i)
      {
        const std::string func_type =
          input("initial_condition_types", zero_string, i);

        const std::string func_value =
          input("initial_condition_values", empty_string, i);

        const subdomain_id_type func_subdomain =
          input("initial_condition_subdomains", subdomain_id_type(0), i);

        initial_conditions[func_subdomain] =
          (new_function_base(func_type, func_value).release());
      }

    GETPOT_REGISTER(other_interior_function_types);
    GETPOT_REGISTER(other_interior_function_values);
    GETPOT_REGISTER(other_interior_function_subdomains);
    GETPOT_REGISTER(other_interior_function_ids);

    const unsigned int n_other_interior_functions =
      input.vector_variable_size("other_interior_function_types");

    if (n_other_interior_functions !=
        input.vector_variable_size("other_interior_function_values"))
      {
        libMesh::out << "Error: " << n_other_interior_functions
                     << " other interior function types does not match "
                     << input.vector_variable_size("other_interior_function_values")
                     << " other interior function values." << std::endl;
        
        libmesh_error();
      }

    if (n_other_interior_functions !=
        input.vector_variable_size("other_interior_function_subdomains"))
      {
        libMesh::out << "Error: " << n_other_interior_functions
                     << " other interior function types does not match "
                     << input.vector_variable_size("other_interior_function_subdomains")
                     << " other interior function subdomains." << std::endl;
        
        libmesh_error();
      }

    if (n_other_interior_functions !=
        input.vector_variable_size("other_interior_function_ids"))
      {
        libMesh::out << "Error: " << n_other_interior_functions
                     << " other interior function types does not match "
                     << input.vector_variable_size("other_interior_function_ids")
                     << " other interior function ids." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_other_interior_functions; ++i)
      {
        const std::string func_type =
          input("other_interior_function_types", zero_string, i);

        const std::string func_value =
          input("other_interior_function_values", empty_string, i);

        const subdomain_id_type func_subdomain =
          input("other_interior_condition_subdomains", subdomain_id_type(0), i);

        const int func_id =
          input("other_interior_condition_ids", int(0), i);

        other_interior_functions[func_id][func_subdomain] =
          (new_function_base(func_type, func_value).release());
      }

    GETPOT_REGISTER(other_boundary_function_types);
    GETPOT_REGISTER(other_boundary_function_values);
    GETPOT_REGISTER(other_boundary_function_boundaries);
    GETPOT_REGISTER(other_boundary_function_ids);

    const unsigned int n_other_boundary_functions =
      input.vector_variable_size("other_boundary_function_types");

    if (n_other_boundary_functions !=
        input.vector_variable_size("other_boundary_function_values"))
      {
        libMesh::out << "Error: " << n_other_boundary_functions
                     << " other boundary function types does not match "
                     << input.vector_variable_size("other_boundary_function_values")
                     << " other boundary function values." << std::endl;
        
        libmesh_error();
      }

    if (n_other_boundary_functions !=
        input.vector_variable_size("other_boundary_function_boundaries"))
      {
        libMesh::out << "Error: " << n_other_boundary_functions
                     << " other boundary function types does not match "
                     << input.vector_variable_size("other_boundary_function_boundaries")
                     << " other boundary function boundaries." << std::endl;
        
        libmesh_error();
      }

    if (n_other_boundary_functions !=
        input.vector_variable_size("other_boundary_function_ids"))
      {
        libMesh::out << "Error: " << n_other_boundary_functions
                     << " other boundary function types does not match "
                     << input.vector_variable_size("other_boundary_function_ids")
                     << " other boundary function ids." << std::endl;
        
        libmesh_error();
      }

    for (unsigned int i=0; i != n_other_boundary_functions; ++i)
      {
        const std::string func_type =
          input("other_boundary_function_types", zero_string, i);

        const std::string func_value =
          input("other_boundary_function_values", empty_string, i);

        const boundary_id_type func_boundary =
          input("other_boundary_function_boundaries", boundary_id_type(0), i);

        const int func_id =
          input("other_boundary_function_ids", int(0), i);

        other_boundary_functions[func_id][func_boundary] =
          (new_function_base(func_type, func_value).release());
      }

    GETPOT_INPUT(run_simulation);
    GETPOT_INPUT(run_postprocess);


    GETPOT_REGISTER(fe_family);
    const unsigned int n_fe_family =
      std::max(1u, input.vector_variable_size("fe_family"));
    fe_family.resize(n_fe_family, "LAGRANGE");
    for (unsigned int i=0; i != n_fe_family; ++i)
      fe_family[i]              = input("fe_family", fe_family[i].c_str(), i);
    GETPOT_REGISTER(fe_order);
    const unsigned int n_fe_order =
      input.vector_variable_size("fe_order");
    fe_order.resize(n_fe_order, 1);
    for (unsigned int i=0; i != n_fe_order; ++i)
      fe_order[i]               = input("fe_order", (int)fe_order[i], i);
    GETPOT_INPUT(extra_quadrature_order);


    GETPOT_INPUT(analytic_jacobians);
    GETPOT_INPUT(verify_analytic_jacobians);
    GETPOT_INPUT(numerical_jacobian_h);
    GETPOT_INPUT(print_solution_norms);
    GETPOT_INPUT(print_solutions);
    GETPOT_INPUT(print_residual_norms);
    GETPOT_INPUT(print_residuals);
    GETPOT_INPUT(print_jacobian_norms);
    GETPOT_INPUT(print_jacobians);
    GETPOT_INPUT(print_element_jacobians);


    GETPOT_INPUT(use_petsc_snes);
    GETPOT_INPUT(time_solver_quiet);
    GETPOT_INPUT(solver_quiet);
    GETPOT_INPUT(solver_verbose);
    GETPOT_INPUT(require_residual_reduction);
    GETPOT_INPUT(min_step_length);
    GETPOT_INT_INPUT(max_linear_iterations);
    GETPOT_INT_INPUT(max_nonlinear_iterations);
    GETPOT_INPUT(relative_step_tolerance);
    GETPOT_INPUT(relative_residual_tolerance);
    GETPOT_INPUT(initial_linear_tolerance);
    GETPOT_INPUT(minimum_linear_tolerance);
    GETPOT_INPUT(linear_tolerance_multiplier);


    GETPOT_INT_INPUT(initial_sobolev_order);
    GETPOT_INT_INPUT(initial_extra_quadrature);
    GETPOT_INPUT(indicator_type);
    GETPOT_INT_INPUT(sobolev_order);

    GETPOT_INPUT(system_config_file);

  std::vector<std::string> bad_variables =
    input.unidentified_arguments(variable_names);

  if (libMesh::processor_id() == 0 && !bad_variables.empty())
    {
      std::cerr << "ERROR: Unrecognized variables:" << std::endl;
      for (unsigned int i = 0; i != bad_variables.size(); ++i)
        std::cerr << bad_variables[i] << std::endl;
      std::cerr << "Not found among recognized variables:" << std::endl;
      for (unsigned int i = 0; i != variable_names.size(); ++i)
        std::cerr << variable_names[i] << std::endl;
      libmesh_error();
    }
}
Esempio n. 30
0
Real
VolumetricFlowRate::computeQpIntegral()
{
  return RealVectorValue(_vel_x[_qp], _vel_y[_qp], _vel_z[_qp]) * _normals[_qp];
}