Skip to content

Commit

Permalink
Add three block test (idaholab#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
cticenhour committed May 13, 2022
1 parent a6ad91f commit 7619658
Show file tree
Hide file tree
Showing 7 changed files with 368 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ class ElectricalContactTestFunc : public Function

protected:

/// Function used to calculate two block test case analytic solution
Real twoBlockFunction(Real t, const Point & p) const;

/// Function used to calculate three block test case analytic solution
Real threeBlockFunction(Real t, const Point & p) const;

/// Electrical conductivity property for graphite
const Real & _electrical_conductivity_graphite;

Expand All @@ -38,4 +44,24 @@ class ElectricalContactTestFunc : public Function
* needs to be enabled (Stainless Steel vs. Graphite)
*/
const MooseEnum & _domain;

/// Boolean to determine if test function is being used in three block test case
const bool & _is_three_block;

/**
* MooseEnum to determine which stainless steel region needs to be enabled in
* the three block analytic solution.
*/
const MooseEnum & _side;

private:
/**
* Enum used in comparisons with _domain. Enum-to-enum comparisons are a bit
* more lightweight, so we should create another enum with the possible choices.
*/
enum DomainEnum
{
STAINLESS_STEEL,
GRAPHITE
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ ElectricalContactTestFunc::validParams()
"Electrical contact conductance at the interface (default is at 300 K with "
"3 kN/m^2 applied pressure).");
MooseEnum domain("stainless_steel graphite");
params.addParam<MooseEnum>("domain", domain, "Material domain / block of interest.");
params.addParam<MooseEnum>(
"domain", domain, "Material domain / block of interest (stainless_steel, graphite).");
params.addParam<bool>("three_block", false, "Is this a three block test case? Default = false.");
MooseEnum side("left right");
params.addParam<MooseEnum>("three_block_side",
side,
"If a three block test case, side / block of interest (left, right).");
return params;
}

Expand All @@ -34,12 +40,27 @@ ElectricalContactTestFunc::ElectricalContactTestFunc(const InputParameters & par
_mean_hardness(getParam<Real>("mean_hardness")),
_mechanical_pressure(getParam<Real>("mechanical_pressure")),
_electrical_contact_conductance(getParam<Real>("contact_conductance")),
_domain(getParam<MooseEnum>("domain"))
_domain(getParam<MooseEnum>("domain")),
_is_three_block(getParam<bool>("three_block")),
_side(getParam<MooseEnum>("three_block_side"))
{
}

Real
ElectricalContactTestFunc::value(Real /*t*/, const Point & p) const
ElectricalContactTestFunc::value(Real t, const Point & p) const
{
if (_is_three_block)
{
return threeBlockFunction(t, p);
}
else
{
return twoBlockFunction(t, p);
}
}

Real
ElectricalContactTestFunc::twoBlockFunction(Real /*t*/, const Point & p) const
{
Real denominator = _electrical_contact_conductance * _electrical_conductivity_stainless_steel +
_electrical_conductivity_graphite * _electrical_conductivity_stainless_steel +
Expand All @@ -55,17 +76,63 @@ ElectricalContactTestFunc::value(Real /*t*/, const Point & p) const

Real stainless_steel_func = stainless_steel_coefficient * p(0) + 1;

/// Enum-to-enum comparisons are a bit more lightweight, so create another
/// enum with the possible choices.
enum DomainEnum
if (_domain == STAINLESS_STEEL)
{
return stainless_steel_func;
}
else if (_domain == GRAPHITE)
{
return graphite_func;
}
else
{
mooseError(_name + ": Error in selecting proper domain in ElectricalContactTestFunc.");
}
}

Real
ElectricalContactTestFunc::threeBlockFunction(Real /*t*/, const Point & p) const
{
Real denominator =
2.0 * _electrical_conductivity_graphite * _electrical_contact_conductance +
2.0 * _electrical_conductivity_graphite * _electrical_conductivity_stainless_steel +
_electrical_conductivity_stainless_steel * _electrical_contact_conductance;

Real graphite_coefficient =
-_electrical_conductivity_stainless_steel * _electrical_contact_conductance / denominator;

Real graphite_constant =
(_electrical_conductivity_graphite * _electrical_contact_conductance +
_electrical_conductivity_graphite * _electrical_conductivity_stainless_steel +
2.0 * _electrical_conductivity_stainless_steel * _electrical_contact_conductance) /
denominator;

Real stainless_steel_coefficient =
-_electrical_conductivity_graphite * _electrical_contact_conductance / denominator;

Real graphite_func = graphite_coefficient * p(0) + graphite_constant;

Real stainless_steel_func_left = stainless_steel_coefficient * p(0) + 1;

Real stainless_steel_func_right = stainless_steel_coefficient * (p(0) - 3);

/**
* Enum used in comparisons with _side. Enum-to-enum comparisons are a bit
* more lightweight, so we should create another enum with the possible choices.
*/
enum SideEnum
{
STAINLESS_STEEL,
GRAPHITE
LEFT,
RIGHT
};

if (_domain == STAINLESS_STEEL)
if (_domain == STAINLESS_STEEL && _side == LEFT)
{
return stainless_steel_func;
return stainless_steel_func_left;
}
else if (_domain == STAINLESS_STEEL && _side == RIGHT)
{
return stainless_steel_func_right;
}
else if (_domain == GRAPHITE)
{
Expand Down
Loading

0 comments on commit 7619658

Please sign in to comment.