https://mooseframework.inl.gov
Loading...
Searching...
No Matches
NodalWaveSpeed.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
10#include "NodalWaveSpeed.h"
11
12// MOOSE includes
13#include "MooseVariable.h"
14#include "SystemBase.h"
15
16#include "libmesh/numeric_vector.h"
17#include "libmesh/quadrature.h"
18
20
23{
25 params.set<ExecFlagEnum>("execute_on") = EXEC_LINEAR;
26 params.addClassDescription("Compute the tributary wave speeds for nodes on a surface");
27 return params;
28}
29
32 _phi(_variable->phiFace()),
33 _system(_variable->sys()),
34 _aux_solution(_system.solution()),
35 _wave_speed(getMaterialProperty<Real>("wave_speed"))
36{
37}
38
40
41void
43{
44 const NodalWaveSpeed & na = dynamic_cast<const NodalWaveSpeed &>(fred);
45
46 std::map<const Node *, Real>::const_iterator it = na._node_wave_speeds.begin();
47 const std::map<const Node *, Real>::const_iterator it_end = na._node_wave_speeds.end();
48 for (; it != it_end; ++it)
49 _node_wave_speeds[it->first] += it->second;
50}
51
52void
57
58void
60{
61 std::vector<Real> node_wave_speeds(_phi.size());
62 for (unsigned qp(0); qp < _qrule->n_points(); ++qp)
63 for (unsigned j(0); j < _phi.size(); ++j)
64 node_wave_speeds[j] += (_phi[j][qp] * _wave_speed[qp]);
65
66 for (unsigned j(0); j < _phi.size(); ++j)
67 {
68 const Real wave_speed = node_wave_speeds[j];
69 if (wave_speed != 0)
70 _node_wave_speeds[_current_elem->node_ptr(j)] = wave_speed;
71 }
72}
73
74void
76{
77 const std::map<const Node *, Real>::iterator it_end = _node_wave_speeds.end();
78 for (std::map<const Node *, Real>::iterator it = _node_wave_speeds.begin(); it != it_end; ++it)
79 {
80 const Node * const node = it->first;
81 dof_id_type dof = node->dof_number(_system.number(), _variable->number(), 0);
82 _aux_solution.set(dof, it->second);
83 }
85}
const ExecFlagType EXEC_LINEAR
registerMooseObject("ContactApp", NodalWaveSpeed)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
unsigned int number() const
MooseVariableFE< Real > * _variable
virtual ~NodalWaveSpeed()
static InputParameters validParams()
NumericVector< Number > & _aux_solution
virtual void threadJoin(const UserObject &uo)
const MaterialProperty< Real > & _wave_speed
virtual void initialize()
virtual void execute()
virtual void finalize()
const VariablePhiValue & _phi
std::map< const Node *, Real > _node_wave_speeds
NodalWaveSpeed(const InputParameters &parameters)
SystemBase & _system
static InputParameters validParams()
const QBase *const & _qrule
const Elem *const & _current_elem
unsigned int number() const
virtual void set(const numeric_index_type i, const T value)=0
virtual void close()=0