https://mooseframework.inl.gov
Loading...
Searching...
No Matches
PressureJumpModel.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
9#include "PressureJumpModel.h"
10
11#include "FaceInfo.h"
12#include "MooseMesh.h"
13
16{
17 auto params = GeneralUserObject::validParams();
19 params.addRequiredParam<std::vector<BoundaryName>>(
20 "boundary", "The boundaries on which this pressure jump model applies.");
21
22 // Pressure jump models are called directly by PorousRhieChowMassFlux.
23 ExecFlagEnum & exec_enum = params.set<ExecFlagEnum>("execute_on", true);
25 exec_enum = {EXEC_NONE};
26 params.suppressParameter<ExecFlagEnum>("execute_on");
27
28 return params;
29}
30
32 : GeneralUserObject(params),
34 _moose_mesh(UserObject::_subproblem.mesh())
35{
36 const auto ids = _moose_mesh.getBoundaryIDs(getParam<std::vector<BoundaryName>>("boundary"));
37 _boundary_ids.insert(ids.begin(), ids.end());
38}
39
40bool
42{
43 bool applies = false;
44 for (const auto boundary_id : fi.boundaryIDs())
45 if (_boundary_ids.count(boundary_id))
46 {
47 // Per-boundary model data would be ambiguous on a face carrying more than one of this
48 // model's boundaries.
49 mooseAssert(!applies,
50 "Pressure-jump face " + std::to_string(fi.id()) +
51 " lies on more than one boundary of this model.");
52 applies = true;
53 }
54
55 return applies;
56}
57
58bool
60{
61 if (!fi.neighborPtr())
62 return true;
63
64 bool elem_has_boundary = false;
65 bool neighbor_has_boundary = false;
66
67 for (const auto boundary_id : _moose_mesh.getBoundaryIDs(fi.elemPtr(), fi.elemSideID()))
68 if (_boundary_ids.count(boundary_id))
69 {
70 elem_has_boundary = true;
71 break;
72 }
73
74 for (const auto boundary_id : _moose_mesh.getBoundaryIDs(fi.neighborPtr(), fi.neighborSideID()))
75 if (_boundary_ids.count(boundary_id))
76 {
77 neighbor_has_boundary = true;
78 break;
79 }
80
81 if (elem_has_boundary != neighbor_has_boundary)
82 return elem_has_boundary;
83
84 return fi.elem().subdomain_id() <= fi.neighbor().subdomain_id();
85}
const ExecFlagType EXEC_NONE
void addAvailableFlags(const ExecFlagType &flag, Args... flags)
unsigned int neighborSideID() const
const std::set< BoundaryID > & boundaryIDs() const
const Elem & elem() const
const Elem * neighborPtr() const
unsigned int elemSideID() const
dof_id_type id() const
const Elem * elemPtr() const
const Elem & neighbor() const
static InputParameters validParams()
const T & getParam(const std::string &name) const
std::vector< BoundaryID > getBoundaryIDs(const Elem *const elem, const unsigned short int side) const
static InputParameters validParams()
std::unordered_set< BoundaryID > _boundary_ids
Boundary IDs on which this pressure-jump model applies.
MooseMesh & _moose_mesh
Mesh used to resolve boundary names and determine pressure-jump orientation.
static InputParameters validParams()
Return the input parameters shared by pressure-jump models.
bool elemIsOwner(const FaceInfo &fi) const
Return whether the FaceInfo element is the oriented owner of the pressure jump.
PressureJumpModel(const InputParameters &params)
Construct a pressure-jump model for the configured boundaries.
bool appliesTo(const FaceInfo &fi) const
Return whether this model applies to a face.
MeshBase & mesh