LagrangianInjection.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2025 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "LagrangianInjection.H"
27 #include "LagrangianMeshLocation.H"
28 #include "timeIOdictionary.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
35 }
36 
37 
38 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
39 
41 (
42  const LagrangianMesh::location location,
43  const point& p
44 ) const
45 {
46  switch (location)
47  {
49  break;
50 
53  << "Did not accurately locate the injection point "
54  << p << " within the mesh" << endl;
55  break;
56 
59  << "Did not find the injection point "
60  << p << " within the mesh"
61  << exit(FatalError);
62  break;
63  }
64 }
65 
66 
68 (
69  const List<LagrangianMesh::location>& locations,
70  const List<point>& points
71 ) const
72 {
73  if (!locations.size()) return;
74 
75  LagrangianMesh::location l = locations[0];
76  point p = points[0];
77 
78  for (label i = 1; i < locations.size(); ++ i)
79  {
80  if (l != LagrangianMeshLocation::furthestOp()(l, locations[i]))
81  {
82  l = locations[i];
83  p = points[i];
84  }
85  }
86 
87  checkLocation(l, p);
88 }
89 
90 
91 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
92 
94 (
95  const word& name,
96  const LagrangianMesh& mesh
97 )
98 :
100 {}
101 
102 
103 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
104 
106 {}
107 
108 
109 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
110 
112 {
113  return false;
114 }
115 
116 
117 // ************************************************************************* //
Base class for Lagrangian injections. Minimal wrapper over LagrangianSource. Implements some utility ...
LagrangianInjection(const word &name, const LagrangianMesh &mesh)
Construct from components.
void checkLocation(const LagrangianMesh::location, const point &) const
Check the location and error or warn as appropriate.
virtual ~LagrangianInjection()
Destructor.
virtual bool addsSupToField(const word &fieldName) const
Return true if the LagrangianModel adds a source term to the.
Class containing Lagrangian geometry and topology.
location
Enumeration for the locations of searched positions.
Base class for Lagrangian models.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: List.H:91
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
const pointField & points
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:258
defineTypeNameAndDebug(combustionModel, 0)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError
volScalarField & p