Commit 35b13bc2 authored by Antoine Jacquey's avatar Antoine Jacquey

Added new BC and Action to hold stress.

parent 7e93a5b6
/******************************************************************************/
/* LYNX, a MOOSE-based application */
/* */
/* Copyright (C) 2017 by Antoine B. Jacquey and Mauro Cacace */
/* GFZ Potsdam, German Research Centre for Geosciences */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/> */
/******************************************************************************/
#ifndef LYNXHOLDSTRESSACTION_H
#define LYNXHOLDSTRESSACTION_H
#include "Action.h"
class LynxHoldStressAction;
template <>
InputParameters validParams<LynxHoldStressAction>();
class LynxHoldStressAction : public Action
{
public:
LynxHoldStressAction(const InputParameters & params);
virtual void act() override;
protected:
std::vector<std::vector<AuxVariableName>> _save_in_vars;
std::vector<bool> _has_save_in_vars;
};
#endif // LYNXHOLDSTRESSACTION_H
/******************************************************************************/
/* LYNX, a MOOSE-based application */
/* */
/* Copyright (C) 2017 by Antoine B. Jacquey and Mauro Cacace */
/* GFZ Potsdam, German Research Centre for Geosciences */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/> */
/******************************************************************************/
#ifndef LYNXHOLDSTRESSBC_H
#define LYNXHOLDSTRESSBC_H
#include "IntegratedBC.h"
class LynxHoldStressBC;
class Function;
template <>
InputParameters validParams<LynxHoldStressBC>();
class LynxHoldStressBC : public IntegratedBC
{
public:
LynxHoldStressBC(const InputParameters & parameters);
protected:
virtual Real computeQpResidual();
bool _coupled_pf;
const VariableValue & _pf;
const int _component;
const Real _bulk_modulus;
const Real _shear_modulus;
const MaterialProperty<RankTwoTensor> & _elastic_strain_old;
const MaterialProperty<Real> & _biot_coeff;
};
#endif // LYNXHOLDSTRESSBC_H
/******************************************************************************/
/* LYNX, a MOOSE-based application */
/* */
/* Copyright (C) 2017 by Antoine B. Jacquey and Mauro Cacace */
/* GFZ Potsdam, German Research Centre for Geosciences */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/> */
/******************************************************************************/
#include "LynxHoldStressAction.h"
#include "Factory.h"
#include "FEProblem.h"
#include "Conversion.h"
registerMooseAction("LynxApp", LynxHoldStressAction, "add_bc");
template <>
InputParameters
validParams<LynxHoldStressAction>()
{
InputParameters params = validParams<Action>();
params.addClassDescription("Set up hold stress boundary conditions.");
params.addRequiredParam<std::vector<BoundaryName>>(
"boundary", "The list of boundary IDs from the mesh where the pressure will be applied.");
params.addRequiredParam<std::vector<NonlinearVariableName>>(
"displacements",
"The displacements appropriate for the simulation geometry and coordinate system");
// Elastic moduli parameters
params.addRangeCheckedParam<Real>(
"bulk_modulus", "bulk_modulus >= 0.0", "The drained bulk modulus of the material.");
params.addRangeCheckedParam<Real>(
"shear_modulus", "shear_modulus >= 0.0", "The shear modulus of the material.");
params.addCoupledVar("fluid_pressure", "The fluid pressure variable.");
return params;
}
LynxHoldStressAction::LynxHoldStressAction(const InputParameters & params) : Action(params) {}
void
LynxHoldStressAction::act()
{
const std::string kernel_name = "LynxHoldStressBC";
std::vector<NonlinearVariableName> displacements =
getParam<std::vector<NonlinearVariableName>>("displacements");
// Create pressure BCs
for (unsigned int i = 0; i < displacements.size(); ++i)
{
// Create unique kernel name for each of the components
std::string unique_kernel_name = kernel_name + "_" + _name + "_" + Moose::stringify(i);
InputParameters params = _factory.getValidParams(kernel_name);
params.applyParameters(parameters());
params.set<bool>("use_displaced_mesh") = true;
params.set<unsigned int>("component") = i;
params.set<NonlinearVariableName>("variable") = displacements[i];
_problem->addBoundaryCondition(kernel_name, unique_kernel_name, params);
}
}
......@@ -46,6 +46,9 @@ associateSyntaxInner(Syntax & syntax, ActionFactory & /*action_factory*/)
registerSyntax("EmptyAction", "BCs/LynxPressure");
registerSyntax("LynxPressureAction", "BCs/LynxPressure/*");
registerSyntax("EmptyAction", "BCs/LynxHoldStress");
registerSyntax("LynxHoldStressAction", "BCs/LynxHoldStress/*");
}
void
......
/******************************************************************************/
/* LYNX, a MOOSE-based application */
/* */
/* Copyright (C) 2017 by Antoine B. Jacquey and Mauro Cacace */
/* GFZ Potsdam, German Research Centre for Geosciences */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/> */
/******************************************************************************/
#include "LynxHoldStressBC.h"
#include "Function.h"
registerMooseObject("LynxApp", LynxHoldStressBC);
template <>
InputParameters
validParams<LynxHoldStressBC>()
{
InputParameters params = validParams<IntegratedBC>();
params.addClassDescription("Hold the stress on a given boundary in a given direction.");
params.addCoupledVar("fluid_pressure", "The fluid pressure variable.");
params.addRequiredParam<unsigned int>("component", "The component for the pressure.");
// Elastic moduli parameters
params.addRangeCheckedParam<Real>(
"bulk_modulus", "bulk_modulus >= 0.0", "The drained bulk modulus of the material.");
params.addRangeCheckedParam<Real>(
"shear_modulus", "shear_modulus >= 0.0", "The shear modulus of the material.");
params.set<bool>("use_displaced_mesh") = false;
return params;
}
LynxHoldStressBC::LynxHoldStressBC(const InputParameters & parameters)
: IntegratedBC(parameters),
_coupled_pf(isCoupled("fluid_pressure")),
_pf(_coupled_pf ? coupledValueOld("fluid_pressure") : _zero),
_component(getParam<unsigned int>("component")),
_bulk_modulus(getParam<Real>("bulk_modulus")),
_shear_modulus(getParam<Real>("shear_modulus")),
_elastic_strain_old(getMaterialPropertyOld<RankTwoTensor>("elastic_strain")),
_biot_coeff(getMaterialProperty<Real>("biot_coefficient"))
{
if (_component > 2)
mooseError("Invalid component given for ", name(), ": ", _component, ".\n");
}
Real
LynxHoldStressBC::computeQpResidual()
{
Real vol_strain = _elastic_strain_old[_qp].trace();
RankTwoTensor dev_strain = _elastic_strain_old[_qp].deviatoric();
RankTwoTensor stress = 2.0 * _shear_modulus * dev_strain;
stress.addIa(_bulk_modulus * vol_strain);
Real value = -(stress(_component, _component) - _biot_coeff[_qp] * _pf[_qp]);
return value * (_normals[_qp](_component) * _test[_i][_qp]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment