diff --git a/include/bcs/DisplaceBoundaryBC.h b/include/bcs/DisplaceBoundaryBC.h new file mode 100644 index 00000000..4ba0484b --- /dev/null +++ b/include/bcs/DisplaceBoundaryBC.h @@ -0,0 +1,35 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#ifndef DISPLACEBOUNDARYBC_H +#define DISPLACEBOUNDARYBC_H + +#include "ADNodalBC.h" + +template +class DisplaceBoundaryBC; + +declareADValidParams(DisplaceBoundaryBC); + +template +class DisplaceBoundaryBC : public ADNodalBC +{ +public: + DisplaceBoundaryBC(const InputParameters & parameters); + +protected: + virtual typename Moose::RealType::type computeQpResidual() override; + + usingNodalBCMembers; + + const typename Moose::RealType::type & _velocity; + const Real & _u_old; +}; + +#endif /* DISPLACEBOUNDARYBC_H */ diff --git a/include/bcs/GaussianWeldEnergyFluxBC.h b/include/bcs/GaussianWeldEnergyFluxBC.h new file mode 100644 index 00000000..d6c86fe0 --- /dev/null +++ b/include/bcs/GaussianWeldEnergyFluxBC.h @@ -0,0 +1,39 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#ifndef GAUSSIANWELDENERGYFLUXBC_H +#define GAUSSIANWELDENERGYFLUXBC_H + +#include "ADIntegratedBC.h" + +template +class GaussianWeldEnergyFluxBC; + +declareADValidParams(GaussianWeldEnergyFluxBC); + +template +class GaussianWeldEnergyFluxBC : public ADIntegratedBC +{ +public: + GaussianWeldEnergyFluxBC(const InputParameters & params); + +protected: + virtual ADResidual computeQpResidual() override; + + const Real _reff; + const Real _F0; + const Real _R; + Function & _x_beam_coord; + Function & _y_beam_coord; + Function & _z_beam_coord; + + usingIntegratedBCMembers; +}; + +#endif /* GAUSSIANWELDENERGYFLUXBC_H */ diff --git a/include/bcs/PenaltyDisplaceBoundaryBC.h b/include/bcs/PenaltyDisplaceBoundaryBC.h new file mode 100644 index 00000000..6f3eb8b6 --- /dev/null +++ b/include/bcs/PenaltyDisplaceBoundaryBC.h @@ -0,0 +1,40 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#ifndef PENALTYDISPLACEBOUNDARYBC_H +#define PENALTYDISPLACEBOUNDARYBC_H + +#include "ADIntegratedBC.h" + +template +class PenaltyDisplaceBoundaryBC; + +declareADValidParams(PenaltyDisplaceBoundaryBC); + +template +class PenaltyDisplaceBoundaryBC : public ADIntegratedBC +{ +public: + PenaltyDisplaceBoundaryBC(const InputParameters & parameters); + +protected: + virtual typename Moose::RealType::type computeQpResidual() override; + + usingIntegratedBCMembers; + + const ADVariableValue & _vel_x; + const ADVariableValue & _vel_y; + const ADVariableValue & _vel_z; + const ADVariableValue & _disp_x_dot; + const ADVariableValue & _disp_y_dot; + const ADVariableValue & _disp_z_dot; + const Real _penalty; +}; + +#endif /* PENALTYDISPLACEBOUNDARYBC_H */ diff --git a/include/bcs/RadiationEnergyFluxBC.h b/include/bcs/RadiationEnergyFluxBC.h new file mode 100644 index 00000000..e4508dcc --- /dev/null +++ b/include/bcs/RadiationEnergyFluxBC.h @@ -0,0 +1,36 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#ifndef RADIATIONENERGYFLUXBC_H +#define RADIATIONENERGYFLUXBC_H + +#include "ADIntegratedBC.h" + +template +class RadiationEnergyFluxBC; + +declareADValidParams(RadiationEnergyFluxBC); + +template +class RadiationEnergyFluxBC : public ADIntegratedBC +{ +public: + RadiationEnergyFluxBC(const InputParameters & parameters); + +protected: + virtual ADResidual computeQpResidual() override; + + const ADMaterialProperty(Real) & _sb_constant; + const ADMaterialProperty(Real) & _absorptivity; + const Real _ff_temp; + + usingIntegratedBCMembers; +}; + +#endif /* RADIATIONENERGYFLUXBC_H */ diff --git a/include/bcs/SurfaceTensionBC.h b/include/bcs/SurfaceTensionBC.h new file mode 100644 index 00000000..8f414691 --- /dev/null +++ b/include/bcs/SurfaceTensionBC.h @@ -0,0 +1,37 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#ifndef SURFACETENSIONBC_H +#define SURFACETENSIONBC_H + +#include "ADIntegratedBC.h" + +template +class SurfaceTensionBC; + +declareADValidParams(SurfaceTensionBC); + +template +class SurfaceTensionBC : public ADIntegratedBC +{ +public: + SurfaceTensionBC(const InputParameters & parameters); + +protected: + virtual ADResidual computeQpResidual() override; + + usingIntegratedBCMembers; + + const unsigned _component; + const ADMaterialProperty(RealVectorValue) & _surface_term_curvature; + const ADMaterialProperty(RealVectorValue) & _surface_term_gradient1; + const ADMaterialProperty(RealVectorValue) & _surface_term_gradient2; +}; + +#endif /* SURFACETENSIONBC_H */ diff --git a/include/bcs/VaporRecoilPressureMomentumFluxBC.h b/include/bcs/VaporRecoilPressureMomentumFluxBC.h new file mode 100644 index 00000000..d0bd44fb --- /dev/null +++ b/include/bcs/VaporRecoilPressureMomentumFluxBC.h @@ -0,0 +1,35 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#ifndef VAPORRECOILPRESSUREMOMENTUMFLUXBC_H +#define VAPORRECOILPRESSUREMOMENTUMFLUXBC_H + +#include "ADIntegratedBC.h" + +template +class VaporRecoilPressureMomentumFluxBC; + +declareADValidParams(VaporRecoilPressureMomentumFluxBC); + +template +class VaporRecoilPressureMomentumFluxBC : public ADIntegratedBC +{ +public: + VaporRecoilPressureMomentumFluxBC(const InputParameters & parameters); + +protected: + virtual ADResidual computeQpResidual() override; + + usingIntegratedBCMembers; + + const unsigned _component; + const ADMaterialProperty(Real) & _rc_pressure; +}; + +#endif /* VAPORRECOILPRESSUREMOMENTUMFLUXBC_H */ diff --git a/include/kernels/ADStressDivergence.h b/include/kernels/ADStressDivergence.h new file mode 100644 index 00000000..c0481dfb --- /dev/null +++ b/include/kernels/ADStressDivergence.h @@ -0,0 +1,35 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html +#ifndef ADSTRESSDIVERGENCE_H +#define ADSTRESSDIVERGENCE_H + +#include "ADKernel.h" +#include "MaterialProperty.h" + +// Forward Declaration +template +class ADStressDivergence; + +declareADValidParams(ADStressDivergence); + +template +class ADStressDivergence : public ADKernel +{ +public: + ADStressDivergence(const InputParameters & parameters); + +protected: + virtual ADResidual computeQpResidual(); + + ADMaterialProperty(RealVectorValue) const * _stress; + + usingKernelMembers; +}; + +#endif // ADSTRESSDIVERGENCE_H diff --git a/include/materials/PseudoSolidStress.h b/include/materials/PseudoSolidStress.h new file mode 100644 index 00000000..80624f6f --- /dev/null +++ b/include/materials/PseudoSolidStress.h @@ -0,0 +1,41 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html +#ifndef PSEUDOSOLIDSTRESS_H +#define PSEUDOSOLIDSTRESS_H + +#include "ADMaterial.h" + +template +class PseudoSolidStress; + +declareADValidParams(PseudoSolidStress); + +/** + * A material that couples a material property + */ +template +class PseudoSolidStress : public ADMaterial +{ +public: + PseudoSolidStress(const InputParameters & parameters); + +protected: + virtual void computeQpProperties(); + + ADMaterialProperty(RealVectorValue) & _stress_x; + ADMaterialProperty(RealVectorValue) & _stress_y; + ADMaterialProperty(RealVectorValue) & _stress_z; + const ADVariableGradient & _grad_disp_x; + const ADVariableGradient & _grad_disp_y; + const ADVariableGradient & _grad_disp_z; + + usingMaterialMembers; +}; + +#endif // PSEUDOSOLIDSTRESS_H diff --git a/src/bcs/DisplaceBoundaryBC.C b/src/bcs/DisplaceBoundaryBC.C new file mode 100644 index 00000000..3d02ded8 --- /dev/null +++ b/src/bcs/DisplaceBoundaryBC.C @@ -0,0 +1,32 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "DisplaceBoundaryBC.h" + +registerADMooseObject("LaserWeldingApp", DisplaceBoundaryBC); + +defineADValidParams(DisplaceBoundaryBC, + ADNodalBC, + params.addClassDescription("For displacing a boundary"); + params.addRequiredCoupledVar("velocity", "The velocity at which to displace");); + +template +DisplaceBoundaryBC::DisplaceBoundaryBC(const InputParameters & parameters) + : ADNodalBC(parameters), + _velocity(adCoupledNodalValue("velocity")), + _u_old(_var.nodalValueOld()) +{ +} + +template +typename Moose::RealType::type +DisplaceBoundaryBC::computeQpResidual() +{ + return _u - (_u_old + this->_dt * _velocity); +} diff --git a/src/bcs/GaussianWeldEnergyFluxBC.C b/src/bcs/GaussianWeldEnergyFluxBC.C new file mode 100644 index 00000000..66b1b440 --- /dev/null +++ b/src/bcs/GaussianWeldEnergyFluxBC.C @@ -0,0 +1,50 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "GaussianWeldEnergyFluxBC.h" +#include "Function.h" + +registerADMooseObject("LaserWeldingApp", GaussianWeldEnergyFluxBC); + +defineADValidParams( + GaussianWeldEnergyFluxBC, + ADIntegratedBC, + params.addRequiredParam("reff", + "The effective radius describing the radial distribution of the " + "beam energy. This should be non-dimensional."); + params.addRequiredParam("F0", "The average heat flux of the laser"); + params.addRequiredParam("R", "The beam radius"); + params.addParam("x_beam_coord", 0, "The x coordinate of the center of the beam"); + params.addParam("y_beam_coord", 0, "The y coordinate of the center of the beam"); + params.addParam("z_beam_coord", + 0, + "The z coordinate of the center of the beam");); + +template +GaussianWeldEnergyFluxBC::GaussianWeldEnergyFluxBC(const InputParameters & params) + : ADIntegratedBC(params), + _reff(adGetParam("reff")), + _F0(adGetParam("F0")), + _R(adGetParam("R")), + _x_beam_coord(getFunction("x_beam_coord")), + _y_beam_coord(getFunction("y_beam_coord")), + _z_beam_coord(getFunction("z_beam_coord")) +{ +} + +template +ADResidual +GaussianWeldEnergyFluxBC::computeQpResidual() +{ + RealVectorValue beam_coords{_x_beam_coord.value(_t, _q_point[_qp]), + _y_beam_coord.value(_t, _q_point[_qp]), + _z_beam_coord.value(_t, _q_point[_qp])}; + auto r = (_ad_q_points[_qp] - beam_coords).norm(); + return -_test[_i][_qp] * 2. * _reff * _F0 * std::exp(-_reff * r * r / (_R * _R)); +} diff --git a/src/bcs/PenaltyDisplaceBoundaryBC.C b/src/bcs/PenaltyDisplaceBoundaryBC.C new file mode 100644 index 00000000..a66176c7 --- /dev/null +++ b/src/bcs/PenaltyDisplaceBoundaryBC.C @@ -0,0 +1,48 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "PenaltyDisplaceBoundaryBC.h" + +registerADMooseObject("LaserWeldingApp", PenaltyDisplaceBoundaryBC); + +defineADValidParams(PenaltyDisplaceBoundaryBC, + ADIntegratedBC, + params.addClassDescription("For displacing a boundary"); + params.addRequiredCoupledVar("disp_x", "The x displacement"); + params.addRequiredCoupledVar("vel_x", "The x velocity"); + params.addCoupledVar("disp_y", "The y displacement"); + params.addCoupledVar("vel_y", "The y velocity"); + params.addCoupledVar("disp_z", "The z displacement"); + params.addCoupledVar("vel_z", "The z velocity"); + params.addParam("penalty", 1e6, "The penalty coefficient");); + +template +PenaltyDisplaceBoundaryBC::PenaltyDisplaceBoundaryBC( + const InputParameters & parameters) + : ADIntegratedBC(parameters), + _vel_x(adCoupledValue("vel_x")), + _vel_y(this->isCoupled("vel_y") ? adCoupledValue("vel_y") : adZeroValue()), + _vel_z(this->isCoupled("vel_z") ? adCoupledValue("vel_") : adZeroValue()), + _disp_x_dot(adCoupledDot("disp_x")), + _disp_y_dot(this->isCoupled("disp_y") ? adCoupledDot("disp_y") : adZeroValue()), + _disp_z_dot(this->isCoupled("disp_z") ? adCoupledDot("disp_z") : adZeroValue()), + _penalty(adGetParam("penalty")) +{ +} + +template +typename Moose::RealType::type +PenaltyDisplaceBoundaryBC::computeQpResidual() +{ + return _test[_i][_qp] * _penalty * _normals[_qp] * + typename Moose::ValueType>::type( + _vel_x[_qp] - _disp_x_dot[_qp], + _vel_y[_qp] - _disp_y_dot[_qp], + _vel_z[_qp] - _disp_z_dot[_qp]); +} diff --git a/src/bcs/RadiationEnergyFluxBC.C b/src/bcs/RadiationEnergyFluxBC.C new file mode 100644 index 00000000..c8ae26b3 --- /dev/null +++ b/src/bcs/RadiationEnergyFluxBC.C @@ -0,0 +1,43 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "RadiationEnergyFluxBC.h" + +registerADMooseObject("LaserWeldingApp", RadiationEnergyFluxBC); + +defineADValidParams(RadiationEnergyFluxBC, + ADIntegratedBC, + params.addClassDescription("Computes heat flux due to radiation"); + params.addParam("sb_constant", + "sb_constant", + "The stefan-boltzmann constant"); + params.addParam("absorptivity", + "abs", + "The absorptivity of the material"); + params.addRequiredParam("ff_temp", "The far field temperature");); + +template +RadiationEnergyFluxBC::RadiationEnergyFluxBC(const InputParameters & parameters) + : ADIntegratedBC(parameters), + _sb_constant(adGetADMaterialProperty("sb_constant")), + _absorptivity(adGetADMaterialProperty("absorptivity")), + _ff_temp(adGetParam("ff_temp")) +{ +} + +template +ADResidual +RadiationEnergyFluxBC::computeQpResidual() +{ + auto u2 = _u[_qp] * _u[_qp]; + auto u4 = u2 * u2; + auto ff2 = _ff_temp * _ff_temp; + auto ff4 = ff2 * ff2; + return _test[_i][_qp] * _absorptivity[_qp] * _sb_constant[_qp] * (u4 - ff4); +} diff --git a/src/bcs/SurfaceTensionBC.C b/src/bcs/SurfaceTensionBC.C new file mode 100644 index 00000000..10de5afa --- /dev/null +++ b/src/bcs/SurfaceTensionBC.C @@ -0,0 +1,37 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "SurfaceTensionBC.h" +#include "Assembly.h" + +registerADMooseObject("LaserWeldingApp", SurfaceTensionBC); + +defineADValidParams( + SurfaceTensionBC, ADIntegratedBC, params.addClassDescription("Surface tension stresses."); + params.addRequiredParam("component", "The velocity component"); + params.addCoupledVar("temperature", "The temperature for dependence of surface tension");); + +template +SurfaceTensionBC::SurfaceTensionBC(const InputParameters & parameters) + : ADIntegratedBC(parameters), + _component(adGetParam("component")), + _surface_term_curvature(adGetADMaterialProperty("surface_term_curvature")), + _surface_term_gradient1(adGetADMaterialProperty("surface_term_gradient1")), + _surface_term_gradient2(adGetADMaterialProperty("surface_term_gradient2")) +{ +} + +template +ADResidual +SurfaceTensionBC::computeQpResidual() +{ + return _test[_i][_qp] * + (_surface_term_curvature[_qp](_component) + _surface_term_gradient1[_qp](_component) + + _surface_term_gradient2[_qp](_component)); +} diff --git a/src/bcs/VaporRecoilPressureMomentumFluxBC.C b/src/bcs/VaporRecoilPressureMomentumFluxBC.C new file mode 100644 index 00000000..ed0793a9 --- /dev/null +++ b/src/bcs/VaporRecoilPressureMomentumFluxBC.C @@ -0,0 +1,36 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "VaporRecoilPressureMomentumFluxBC.h" + +registerADMooseObject("LaserWeldingApp", VaporRecoilPressureMomentumFluxBC); + +defineADValidParams( + VaporRecoilPressureMomentumFluxBC, + ADIntegratedBC, + params.addClassDescription("Vapor recoil pressure momentum flux"); + params.addRequiredParam("component", "The velocity component"); + params.addParam("rc_pressure_name", "rc_pressure", "The recoil pressure"); + params.addCoupledVar("temperature", "The temperature on which the recoil pressure depends");); + +template +VaporRecoilPressureMomentumFluxBC::VaporRecoilPressureMomentumFluxBC( + const InputParameters & parameters) + : ADIntegratedBC(parameters), + _component(adGetParam("component")), + _rc_pressure(adGetADMaterialProperty("rc_pressure_name")) +{ +} + +template +ADResidual +VaporRecoilPressureMomentumFluxBC::computeQpResidual() +{ + return _test[_i][_qp] * std::abs(_normals[_qp](_component)) * _rc_pressure[_qp]; +} diff --git a/src/kernels/ADStressDivergence.C b/src/kernels/ADStressDivergence.C new file mode 100644 index 00000000..7fd62b23 --- /dev/null +++ b/src/kernels/ADStressDivergence.C @@ -0,0 +1,37 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html +#include "ADStressDivergence.h" + +registerADMooseObject("LaserWeldingApp", ADStressDivergence); + +defineADValidParams(ADStressDivergence, + ADKernel, + params.addRequiredParam("component", "The displacement component");); + +template +ADStressDivergence::ADStressDivergence(const InputParameters & parameters) + : ADKernel(parameters) +{ + const auto component = adGetParam("component"); + if (component == 0) + _stress = &adGetADMaterialProperty("stress_x"); + else if (component == 1) + _stress = &adGetADMaterialProperty("stress_y"); + else if (component == 2) + _stress = &adGetADMaterialProperty("stress_z"); + else + mooseError("component must be either 0, 1, or 2"); +} + +template +ADResidual +ADStressDivergence::computeQpResidual() +{ + return _grad_test[_i][_qp] * (*_stress)[_qp]; +} diff --git a/src/materials/PseudoSolidStress.C b/src/materials/PseudoSolidStress.C new file mode 100644 index 00000000..21c6eeef --- /dev/null +++ b/src/materials/PseudoSolidStress.C @@ -0,0 +1,48 @@ +//* This file is part of the MOOSE framework +//* https://www.mooseframework.org +//* +//* All rights reserved, see COPYRIGHT for full restrictions +//* https://github.com/idaholab/moose/blob/master/COPYRIGHT +//* +//* Licensed under LGPL 2.1, please see LICENSE for details +//* https://www.gnu.org/licenses/lgpl-2.1.html + +#include "PseudoSolidStress.h" + +registerADMooseObject("LaserWeldingApp", PseudoSolidStress); + +defineADValidParams(PseudoSolidStress, + ADMaterial, + params.addRequiredCoupledVar("disp_x", "The x displacement"); + params.addCoupledVar("disp_y", "The y displacement"); + params.addCoupledVar("disp_z", "The z displacement");); + +template +PseudoSolidStress::PseudoSolidStress(const InputParameters & parameters) + : ADMaterial(parameters), + _stress_x(adDeclareADProperty("stress_x")), + _stress_y(adDeclareADProperty("stress_y")), + _stress_z(adDeclareADProperty("stress_z")), + _grad_disp_x(adCoupledGradient("disp_x")), + _grad_disp_y(this->isCoupled("disp_y") ? adCoupledGradient("disp_y") : adZeroGradient()), + _grad_disp_z(this->isCoupled("disp_z") ? adCoupledGradient("disp_z") : adZeroGradient()) +{ +} + +template +void +PseudoSolidStress::computeQpProperties() +{ + typedef typename Moose::template ValueType>::type LocalTensor; + LocalTensor def_gradient(_grad_disp_x[_qp], _grad_disp_y[_qp], _grad_disp_z[_qp]); + const auto E = + 0.5 * (def_gradient + def_gradient.transpose() - def_gradient * def_gradient.transpose()); + TensorValue identity(1., 0, 0, 0, 1., 0, 0, 0, 1.); + const auto S = 2. * E + E.tr() * identity; + _stress_x[_qp] = S.row(0); + _stress_y[_qp] = S.row(1); + _stress_z[_qp] = S.row(2); + // _stress_x[_qp] = def_gradient.row(0); + // _stress_y[_qp] = def_gradient.row(1); + // _stress_z[_qp] = def_gradient.row(2); +}