https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ADDistributedLoadShell.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
11#include "Assembly.h"
12#include "Function.h"
13#include "MooseError.h"
14#include "FEProblemBase.h"
15#include "MooseMesh.h"
16
19
20template <bool is_ad>
23{
26 "Applies a distributed load (specified in units of force per area) on the shell plane in a "
27 "given direction (e.g. self_weight, wind load) or normal to the shell plan (e.g. pressure "
28 "loads)");
29 params.addRequiredCoupledVar("displacements",
30 "The string of displacements suitable for the problem statement");
31 params.addParam<bool>(
32 "project_load_to_normal", false, "Whether to apply the distributed load normal to the shell");
33 params.addRequiredParam<FunctionName>(
34 "function",
35 "The function that describes the distributed load specified in units of force per area ");
36 return params;
37}
38
39template <bool is_ad>
41 : GenericKernel<is_ad>(parameters),
42 _ndisp(this->coupledComponents("displacements")),
43 _component(libMesh::invalid_uint),
44 _function(&this->getFunction("function")),
45 _project_load_to_normal(parameters.isParamSetByUser("project_load_to_normal")
46 ? this->template getParam<bool>("project_load_to_normal")
47 : false),
48 _nodes(4)
49{
50 if (_ndisp != 3)
51 mooseError("ADDistributedLoadShell: parameter 'displacements' needs to have exactly three "
52 "components.");
53
54 for (unsigned int i = 0; i < _ndisp; ++i)
55 {
56 _disp_var.push_back(this->coupled("displacements", i));
57 if (_var.number() == _disp_var[i])
58 {
59 _component = i;
60 }
61 }
63 mooseError("Problem with displacements in " + _name);
64}
65
66template <bool is_ad>
69{
70 for (unsigned int i = 0; i < 4; ++i)
71 _nodes[i] = _current_elem->node_ptr(i);
72
73 _v1 = (*_nodes[1] - *_nodes[0]);
74 _v2 = (*_nodes[2] - *_nodes[0]);
75
76 _normal = _v1.cross(_v2);
77 _normal /= _normal.norm();
78
79 if (_project_load_to_normal)
80 return computeFactor() * (_normal(_component) * _test[_i][_qp]);
81 else
82 return computeFactor() * (_test[_i][_qp]);
83}
84
85template <bool is_ad>
88{
89 return _function->value(_t, _q_point[_qp]);
90}
91
Moose::GenericType< Real, is_ad > GenericReal
ADDistributedLoadShell applies a distributed load on the shell element in a given direction defined b...
static InputParameters validParams()
std::vector< unsigned int > _disp_var
Variable numbers of coupled displacement variables.
virtual GenericReal< is_ad > computeQpResidual() override
ADDistributedLoadShellTempl(const InputParameters &parameters)
GenericReal< is_ad > computeFactor() const
unsigned int _component
displacement component to apply the pressure to the shell
const unsigned int _ndisp
Number of displacement variables.
virtual unsigned int coupled(const std::string &var_name, unsigned int comp=0) const
static InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
MooseVariable & _var
void mooseError(Args &&... args) const
const std::string & _name
unsigned int number() const
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
const unsigned int invalid_uint
registerMooseObject("SolidMechanicsApp", ADDistributedLoadShell)