Skip to content

Commit

Permalink
Add laser-welding module
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad authored and cticenhour committed Jan 15, 2019
1 parent dde8652 commit e8f0079
Show file tree
Hide file tree
Showing 16 changed files with 629 additions and 0 deletions.
35 changes: 35 additions & 0 deletions include/bcs/DisplaceBoundaryBC.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
class DisplaceBoundaryBC;

declareADValidParams(DisplaceBoundaryBC);

template <ComputeStage compute_stage>
class DisplaceBoundaryBC : public ADNodalBC<compute_stage>
{
public:
DisplaceBoundaryBC(const InputParameters & parameters);

protected:
virtual typename Moose::RealType<compute_stage>::type computeQpResidual() override;

usingNodalBCMembers;

const typename Moose::RealType<compute_stage>::type & _velocity;
const Real & _u_old;
};

#endif /* DISPLACEBOUNDARYBC_H */
39 changes: 39 additions & 0 deletions include/bcs/GaussianWeldEnergyFluxBC.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage>
class GaussianWeldEnergyFluxBC;

declareADValidParams(GaussianWeldEnergyFluxBC);

template <ComputeStage compute_stage>
class GaussianWeldEnergyFluxBC : public ADIntegratedBC<compute_stage>
{
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 */
40 changes: 40 additions & 0 deletions include/bcs/PenaltyDisplaceBoundaryBC.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
class PenaltyDisplaceBoundaryBC;

declareADValidParams(PenaltyDisplaceBoundaryBC);

template <ComputeStage compute_stage>
class PenaltyDisplaceBoundaryBC : public ADIntegratedBC<compute_stage>
{
public:
PenaltyDisplaceBoundaryBC(const InputParameters & parameters);

protected:
virtual typename Moose::RealType<compute_stage>::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 */
36 changes: 36 additions & 0 deletions include/bcs/RadiationEnergyFluxBC.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
class RadiationEnergyFluxBC;

declareADValidParams(RadiationEnergyFluxBC);

template <ComputeStage compute_stage>
class RadiationEnergyFluxBC : public ADIntegratedBC<compute_stage>
{
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 */
37 changes: 37 additions & 0 deletions include/bcs/SurfaceTensionBC.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
class SurfaceTensionBC;

declareADValidParams(SurfaceTensionBC);

template <ComputeStage compute_stage>
class SurfaceTensionBC : public ADIntegratedBC<compute_stage>
{
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 */
35 changes: 35 additions & 0 deletions include/bcs/VaporRecoilPressureMomentumFluxBC.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
class VaporRecoilPressureMomentumFluxBC;

declareADValidParams(VaporRecoilPressureMomentumFluxBC);

template <ComputeStage compute_stage>
class VaporRecoilPressureMomentumFluxBC : public ADIntegratedBC<compute_stage>
{
public:
VaporRecoilPressureMomentumFluxBC(const InputParameters & parameters);

protected:
virtual ADResidual computeQpResidual() override;

usingIntegratedBCMembers;

const unsigned _component;
const ADMaterialProperty(Real) & _rc_pressure;
};

#endif /* VAPORRECOILPRESSUREMOMENTUMFLUXBC_H */
35 changes: 35 additions & 0 deletions include/kernels/ADStressDivergence.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
class ADStressDivergence;

declareADValidParams(ADStressDivergence);

template <ComputeStage compute_stage>
class ADStressDivergence : public ADKernel<compute_stage>
{
public:
ADStressDivergence(const InputParameters & parameters);

protected:
virtual ADResidual computeQpResidual();

ADMaterialProperty(RealVectorValue) const * _stress;

usingKernelMembers;
};

#endif // ADSTRESSDIVERGENCE_H
41 changes: 41 additions & 0 deletions include/materials/PseudoSolidStress.h
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage>
class PseudoSolidStress;

declareADValidParams(PseudoSolidStress);

/**
* A material that couples a material property
*/
template <ComputeStage compute_stage>
class PseudoSolidStress : public ADMaterial<compute_stage>
{
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
32 changes: 32 additions & 0 deletions src/bcs/DisplaceBoundaryBC.C
Original file line number Diff line number Diff line change
@@ -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 <ComputeStage compute_stage>
DisplaceBoundaryBC<compute_stage>::DisplaceBoundaryBC(const InputParameters & parameters)
: ADNodalBC<compute_stage>(parameters),
_velocity(adCoupledNodalValue("velocity")),
_u_old(_var.nodalValueOld())
{
}

template <ComputeStage compute_stage>
typename Moose::RealType<compute_stage>::type
DisplaceBoundaryBC<compute_stage>::computeQpResidual()
{
return _u - (_u_old + this->_dt * _velocity);
}
50 changes: 50 additions & 0 deletions src/bcs/GaussianWeldEnergyFluxBC.C
Original file line number Diff line number Diff line change
@@ -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<Real>("reff",
"The effective radius describing the radial distribution of the "
"beam energy. This should be non-dimensional.");
params.addRequiredParam<Real>("F0", "The average heat flux of the laser");
params.addRequiredParam<Real>("R", "The beam radius");
params.addParam<FunctionName>("x_beam_coord", 0, "The x coordinate of the center of the beam");
params.addParam<FunctionName>("y_beam_coord", 0, "The y coordinate of the center of the beam");
params.addParam<FunctionName>("z_beam_coord",
0,
"The z coordinate of the center of the beam"););

template <ComputeStage compute_stage>
GaussianWeldEnergyFluxBC<compute_stage>::GaussianWeldEnergyFluxBC(const InputParameters & params)
: ADIntegratedBC<compute_stage>(params),
_reff(adGetParam<Real>("reff")),
_F0(adGetParam<Real>("F0")),
_R(adGetParam<Real>("R")),
_x_beam_coord(getFunction("x_beam_coord")),
_y_beam_coord(getFunction("y_beam_coord")),
_z_beam_coord(getFunction("z_beam_coord"))
{
}

template <ComputeStage compute_stage>
ADResidual
GaussianWeldEnergyFluxBC<compute_stage>::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));
}
Loading

0 comments on commit e8f0079

Please sign in to comment.