Skip to content

Commit

Permalink
Modernize laser welding 3d input
Browse files Browse the repository at this point in the history
  • Loading branch information
lindsayad authored and oanaoana committed Oct 19, 2023
1 parent 356faaf commit 970f970
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 383 deletions.
24 changes: 15 additions & 9 deletions modules/navier_stokes/include/bcs/DisplaceBoundaryBC.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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

#pragma once

Expand All @@ -21,6 +21,12 @@ class DisplaceBoundaryBC : public ADNodalBC
protected:
virtual ADReal computeQpResidual() override;

const ADReal & _velocity;
/// The velocity vector at the node
const ADRealVectorValue & _velocity;

/// The previous timestep value of the displacement
const Real & _u_old;

/// What component of velocity/displacement this object is acting on
const unsigned short _component;
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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

#pragma once

Expand All @@ -21,5 +21,6 @@ class VaporRecoilPressureMomentumFluxBC : public ADVectorIntegratedBC
protected:
virtual ADReal computeQpResidual() override;

/// The recoil pressure
const ADMaterialProperty<Real> & _rc_pressure;
};
27 changes: 15 additions & 12 deletions modules/navier_stokes/src/bcs/DisplaceBoundaryBC.C
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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"

registerMooseObject("MalamuteApp", DisplaceBoundaryBC);
registerMooseObject("NavierStokesApp", DisplaceBoundaryBC);

InputParameters
DisplaceBoundaryBC::validParams()
{
InputParameters params = ADNodalBC::validParams();
params.addClassDescription("For displacing a boundary");
params.addRequiredCoupledVar("velocity", "The velocity at which to displace");
params.addRequiredParam<unsigned short>(
"component", "What component of velocity/displacement this object is acting on.");
return params;
}

DisplaceBoundaryBC::DisplaceBoundaryBC(const InputParameters & parameters)
: ADNodalBC(parameters),
_velocity(adCoupledNodalValue<Real>("velocity")),
_u_old(_var.nodalValueOld())
_velocity(adCoupledNodalValue<RealVectorValue>("velocity")),
_u_old(_var.nodalValueOld()),
_component(getParam<unsigned short>("component"))
{
}

ADReal
DisplaceBoundaryBC::computeQpResidual()
{
return _u - (_u_old + this->_dt * _velocity);
return _u - (_u_old + this->_dt * _velocity(_component));
}
23 changes: 10 additions & 13 deletions modules/navier_stokes/src/bcs/VaporRecoilPressureMomentumFluxBC.C
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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"

registerMooseObject("MalamuteApp", VaporRecoilPressureMomentumFluxBC);
registerMooseObject("NavierStokesApp", VaporRecoilPressureMomentumFluxBC);

InputParameters
VaporRecoilPressureMomentumFluxBC::validParams()
Expand All @@ -30,8 +30,5 @@ VaporRecoilPressureMomentumFluxBC::VaporRecoilPressureMomentumFluxBC(
ADReal
VaporRecoilPressureMomentumFluxBC::computeQpResidual()
{
return _test[_i][_qp] *
ADRealVectorValue(
std::abs(_normals[_qp](0)), std::abs(_normals[_qp](1)), std::abs(_normals[_qp](2))) *
_rc_pressure[_qp];
return _test[_i][_qp] * _normals[_qp] * _rc_pressure[_qp];
}
12 changes: 7 additions & 5 deletions modules/navier_stokes/src/materials/INSADMaterial.C
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,10 @@ INSADMaterial::subdomainSetup()
// safe for dependencies
_boussinesq_alpha = &_material_data.getProperty<Real, true>(
_object_tracker->get<MaterialPropertyName>("alpha", _current_subdomain_id), 0, *this);
_temperature =
&_subproblem
.getStandardVariable(
_tid, _object_tracker->get<std::string>("temperature", _current_subdomain_id))
.adSln();
auto & temp_var = _subproblem.getStandardVariable(
_tid, _object_tracker->get<std::string>("temperature", _current_subdomain_id));
addMooseVariableDependency(&temp_var);
_temperature = &temp_var.adSln();
_ref_temp = &_material_data.getProperty<Real, false>(
_object_tracker->get<MaterialPropertyName>("ref_temp", _current_subdomain_id), 0, *this);
}
Expand All @@ -114,6 +113,7 @@ INSADMaterial::subdomainSetup()
{
auto & disp_x = _subproblem.getStandardVariable(
_tid, _object_tracker->get<VariableName>("disp_x", _current_subdomain_id));
addMooseVariableDependency(&disp_x);
_disp_x_dot = &disp_x.adUDot();
_disp_x_sys_num = disp_x.sys().number();
_disp_x_num =
Expand All @@ -125,6 +125,7 @@ INSADMaterial::subdomainSetup()
{
auto & disp_y = _subproblem.getStandardVariable(
_tid, _object_tracker->get<VariableName>("disp_y", _current_subdomain_id));
addMooseVariableDependency(&disp_y);
_disp_y_dot = &disp_y.adUDot();
_disp_y_sys_num = disp_y.sys().number();
_disp_y_num =
Expand All @@ -143,6 +144,7 @@ INSADMaterial::subdomainSetup()
{
auto & disp_z = _subproblem.getStandardVariable(
_tid, _object_tracker->get<VariableName>("disp_z", _current_subdomain_id));
addMooseVariableDependency(&disp_z);
_disp_z_dot = &disp_z.adUDot();
_disp_z_sys_num = disp_z.sys().number();
_disp_z_num =
Expand Down
16 changes: 8 additions & 8 deletions modules/navier_stokes/test/include/bcs/CrazyKCPlantFits.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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

#pragma once

Expand Down
18 changes: 8 additions & 10 deletions modules/navier_stokes/test/include/bcs/CrazyKCPlantFitsBoundary.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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

#pragma once

Expand Down Expand Up @@ -47,8 +47,6 @@ class CrazyKCPlantFitsBoundary : public ADMaterial
ADMaterialProperty<Real> & _surface_tension;
ADMaterialProperty<RealVectorValue> & _grad_surface_tension;
const MooseArray<ADPoint> & _ad_normals;
const MooseArray<ADReal> & _ad_curvatures;
ADMaterialProperty<RealVectorValue> & _surface_term_curvature;
ADMaterialProperty<RealVectorValue> & _surface_term_gradient1;
ADMaterialProperty<RealVectorValue> & _surface_term_gradient2;

Expand Down
18 changes: 9 additions & 9 deletions modules/navier_stokes/test/src/bcs/CrazyKCPlantFits.C
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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 "CrazyKCPlantFits.h"

registerMooseObject("MalamuteApp", CrazyKCPlantFits);
registerMooseObject("NavierStokesTestApp", CrazyKCPlantFits);

InputParameters
CrazyKCPlantFits::validParams()
Expand Down
22 changes: 9 additions & 13 deletions modules/navier_stokes/test/src/bcs/CrazyKCPlantFitsBoundary.C
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/****************************************************************************/
/* DO NOT MODIFY THIS HEADER */
/* */
/* MALAMUTE: MOOSE Application Library for Advanced Manufacturing UTilitiEs */
/* */
/* Copyright 2021 - 2023, Battelle Energy Alliance, LLC */
/* ALL RIGHTS RESERVED */
/****************************************************************************/
//* 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 "CrazyKCPlantFitsBoundary.h"
#include "Assembly.h"

registerMooseObject("MalamuteApp", CrazyKCPlantFitsBoundary);
registerMooseObject("NavierStokesTestApp", CrazyKCPlantFitsBoundary);

InputParameters
CrazyKCPlantFitsBoundary::validParams()
Expand Down Expand Up @@ -82,8 +82,6 @@ CrazyKCPlantFitsBoundary::CrazyKCPlantFitsBoundary(const InputParameters & param
_grad_surface_tension(declareADProperty<RealVectorValue>(
getParam<MaterialPropertyName>("grad_surface_tension_name"))),
_ad_normals(_assembly.adNormals()),
_ad_curvatures(_assembly.adCurvatures()),
_surface_term_curvature(declareADProperty<RealVectorValue>("surface_term_curvature")),
_surface_term_gradient1(declareADProperty<RealVectorValue>("surface_term_gradient1")),
_surface_term_gradient2(declareADProperty<RealVectorValue>("surface_term_gradient2")),
_length_units_per_meter(1. / std::pow(10, getParam<int>("length_unit_exponent"))),
Expand Down Expand Up @@ -117,8 +115,6 @@ CrazyKCPlantFitsBoundary::computeQpProperties()
_grad_surface_tension[_qp] = _alpha * _mass_units_per_kilogram /
(_time_units_per_second * _time_units_per_second) /
_temperature_units_per_kelvin * _grad_temperature[_qp];
_surface_term_curvature[_qp] =
-2. * _ad_curvatures[_qp] * _surface_tension[_qp] * _ad_normals[_qp];
_surface_term_gradient1[_qp] = -_grad_surface_tension[_qp];
_surface_term_gradient2[_qp] = _ad_normals[_qp] * (_ad_normals[_qp] * _grad_surface_tension[_qp]);
}
Loading

0 comments on commit 970f970

Please sign in to comment.