multiValveEnginePistonMotion.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-2026 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 
27 #include "multiValveEngine.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34 namespace solidBodyMotionFunctions
35 {
38  (
42  );
43 }
44 }
45 
46 
47 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
48 
51 (
52  const word& name,
53  const dictionary& SBMFCoeffs,
54  const Time& runTime
55 )
56 :
57  solidBodyMotionFunction(name, SBMFCoeffs, runTime),
58  fluidRegionName_()
59 {
60  read(SBMFCoeffs);
61 }
62 
63 
64 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
65 
68 {}
69 
70 
71 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
72 
75 transformation() const
76 {
77  const fvMesh& fluidMesh = time_.lookupObject<fvMesh>(fluidRegionName_);
78 
79  const fvMeshMover& fluidMover = fluidMesh.mover();
80 
81  if (!isA<fvMeshMovers::multiValveEngine>(fluidMover))
82  {
84  << "The " << typeName << " motion function requires the motion"
85  << " solver for the associated fluid region (i.e., "
86  << fluidRegionName_ << ") to be of type "
88  << exit(FatalError);
89  }
90 
91  const fvMeshMovers::multiValveEngine& fluidEngineMover =
92  refCast<const fvMeshMovers::multiValveEngine>(fluidMover);
93 
94  return
96  (
97  fluidEngineMover.piston.position()
98  *fluidEngineMover.piston.axis
99  );
100 }
101 
102 
104 (
105  const dictionary& SBMFCoeffs
106 )
107 {
108  solidBodyMotionFunction::read(SBMFCoeffs);
109 
110  fluidRegionName_ = SBMFCoeffs.lookup<word>("fluidRegion");
111 
112  return true;
113 }
114 
115 
116 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:53
scalar position(const scalar theta) const
Return the piston position for the given CA theta.
Definition: piston.C:126
A mesh mover using explicit node translation based on scaled distance functions per moving object....
const pistonObject & piston
Piston object.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:98
const fvMeshMover & mover() const
Return the mover function class.
Definition: fvMesh.C:1125
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
Septernion class used to perform translations and rotations in 3D space.
Definition: septernion.H:66
Base class for defining solid-body motions.
virtual bool read(const dictionary &dict)=0
Update properties from given dictionary.
Motion function for solid regions representing a piston. Looks up the multiValveEngine mover from the...
virtual septernion transformation() const
Return the solid-body motion transformation septernion.
multiValveEnginePistonMotion(const word &name, const dictionary &SBMFCoeffs, const Time &runTime)
Construct from components.
virtual bool read(const dictionary &SBMFCoeffs)
Update properties from given dictionary.
Template function which returns the un-mangled name of a given type. Useful for types which do not ha...
A class for handling words, derived from string.
Definition: word.H:63
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
addToRunTimeSelectionTable(solidBodyMotionFunction, multiValveEnginePistonMotion, dictionary)
defineTypeNameAndDebug(multiValveEnginePistonMotion, 0)
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError