Skip to content
Permalink
Browse files

Merge pull request #13450 from elementx54/parsedMaterialhelper_initQp…

…_13449

Add "Qp" init and compute to ParsedMaterialHelper
  • Loading branch information...
permcody committed May 21, 2019
2 parents eaa2f43 + a0412c5 commit 115f43f1228197f65089364a89c204208c91348e
@@ -29,7 +29,8 @@ class DerivativeParsedMaterialHelper : public ParsedMaterialHelper
VariableNameMappingMode map_mode = USE_PARAM_NAMES);

protected:
virtual void computeProperties();
virtual void initQpStatefulProperties();
virtual void computeQpProperties();

virtual void functionsPostParse();
void assembleDerivatives();
@@ -48,7 +48,8 @@ class ParsedMaterialHelper : public FunctionMaterialBase, public FunctionParserU
const std::vector<Real> & tol_values);

protected:
virtual void computeProperties();
virtual void initQpStatefulProperties();
virtual void computeQpProperties();

// tasks to perform after parsing the primary function
virtual void functionsPostParse();
@@ -205,35 +205,41 @@ DerivativeParsedMaterialHelper::assembleDerivatives()
_func_params.resize(_nargs + _mat_prop_descriptors.size());
}

// TODO: computeQpProperties()
void
DerivativeParsedMaterialHelper::computeProperties()
DerivativeParsedMaterialHelper::initQpStatefulProperties()
{
for (_qp = 0; _qp < _qrule->n_points(); _qp++)
if (_prop_F)
(*_prop_F)[_qp] = 0.0;

for (auto & D : _derivatives)
(*D.first)[_qp] = 0.0;
}

void
DerivativeParsedMaterialHelper::computeQpProperties()
{
// fill the parameter vector, apply tolerances
for (unsigned int i = 0; i < _nargs; ++i)
{
// fill the parameter vector, apply tolerances
for (unsigned int i = 0; i < _nargs; ++i)
if (_tol[i] < 0.0)
_func_params[i] = (*_args[i])[_qp];
else
{
if (_tol[i] < 0.0)
_func_params[i] = (*_args[i])[_qp];
else
{
Real a = (*_args[i])[_qp];
_func_params[i] = a < _tol[i] ? _tol[i] : (a > 1.0 - _tol[i] ? 1.0 - _tol[i] : a);
}
Real a = (*_args[i])[_qp];
_func_params[i] = a < _tol[i] ? _tol[i] : (a > 1.0 - _tol[i] ? 1.0 - _tol[i] : a);
}
}

// insert material property values
auto nmat_props = _mat_prop_descriptors.size();
for (MooseIndex(_mat_prop_descriptors) i = 0; i < nmat_props; ++i)
_func_params[i + _nargs] = _mat_prop_descriptors[i].value()[_qp];
// insert material property values
auto nmat_props = _mat_prop_descriptors.size();
for (MooseIndex(_mat_prop_descriptors) i = 0; i < nmat_props; ++i)
_func_params[i + _nargs] = _mat_prop_descriptors[i].value()[_qp];

// set function value
if (_prop_F)
(*_prop_F)[_qp] = evaluate(_func_F);
// set function value
if (_prop_F)
(*_prop_F)[_qp] = evaluate(_func_F);

// set derivatives
for (auto & D : _derivatives)
(*D.first)[_qp] = evaluate(D.second);
}
// set derivatives
for (auto & D : _derivatives)
(*D.first)[_qp] = evaluate(D.second);
}
@@ -175,33 +175,35 @@ ParsedMaterialHelper::functionsOptimize()
}

void
ParsedMaterialHelper::computeProperties()
ParsedMaterialHelper::initQpStatefulProperties()
{
if (_prop_F)
(*_prop_F)[_qp] = 0.0;
}

void
ParsedMaterialHelper::computeQpProperties()
{
Real a;

for (_qp = 0; _qp < _qrule->n_points(); _qp++)
// fill the parameter vector, apply tolerances
for (unsigned int i = 0; i < _nargs; ++i)
{
// fill the parameter vector, apply tolerances
for (unsigned int i = 0; i < _nargs; ++i)
if (_tol[i] < 0.0)
_func_params[i] = (*_args[i])[_qp];
else
{
if (_tol[i] < 0.0)
_func_params[i] = (*_args[i])[_qp];
else
{
a = (*_args[i])[_qp];
_func_params[i] = a < _tol[i] ? _tol[i] : (a > 1.0 - _tol[i] ? 1.0 - _tol[i] : a);
}
a = (*_args[i])[_qp];
_func_params[i] = a < _tol[i] ? _tol[i] : (a > 1.0 - _tol[i] ? 1.0 - _tol[i] : a);
}
}

// insert material property values
auto nmat_props = _mat_prop_descriptors.size();
for (MooseIndex(_mat_prop_descriptors) i = 0; i < nmat_props; ++i)
_func_params[i + _nargs] = _mat_prop_descriptors[i].value()[_qp];

// TODO: computeQpProperties()
// insert material property values
auto nmat_props = _mat_prop_descriptors.size();
for (MooseIndex(_mat_prop_descriptors) i = 0; i < nmat_props; ++i)
_func_params[i + _nargs] = _mat_prop_descriptors[i].value()[_qp];

// set function value
if (_prop_F)
(*_prop_F)[_qp] = evaluate(_func_F);
}
// set function value
if (_prop_F)
(*_prop_F)[_qp] = evaluate(_func_F);
}

0 comments on commit 115f43f

Please sign in to comment.
You can’t perform that action at this time.