diff --git a/etc/caseDicts/functions/mesh/multiValveEngineState b/etc/caseDicts/functions/mesh/multiValveEngineState
new file mode 100644
index 0000000000..39ffd46924
--- /dev/null
+++ b/etc/caseDicts/functions/mesh/multiValveEngineState
@@ -0,0 +1,22 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Version: dev
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+Description
+ Writes the multi-valve engine motion state
+ providing details of the piston and valve position, speed etc.
+
+\*---------------------------------------------------------------------------*/
+
+type multiValveEngineState;
+libs ("libfvMeshMoversMultiValveEngine.so");
+
+writeControl timeStep;
+writeInterval 1;
+
+log true;
+
+// ************************************************************************* //
diff --git a/src/fvMeshMovers/multiValveEngine/Make/files b/src/fvMeshMovers/multiValveEngine/Make/files
index c2ee3246b5..03a30179d9 100644
--- a/src/fvMeshMovers/multiValveEngine/Make/files
+++ b/src/fvMeshMovers/multiValveEngine/Make/files
@@ -5,5 +5,6 @@ valve.C
valveList.C
crankConnectingRodMotion/crankConnectingRodMotion.C
pistonPointEdgeData/pistonPointEdgeData.C
+multiValveEngineState/multiValveEngineState.C
LIB = $(FOAM_LIBBIN)/libfvMeshMoversMultiValveEngine
diff --git a/src/fvMeshMovers/multiValveEngine/multiValveEngine.C b/src/fvMeshMovers/multiValveEngine/multiValveEngine.C
index ebc7a93b00..b73d55bcb6 100644
--- a/src/fvMeshMovers/multiValveEngine/multiValveEngine.C
+++ b/src/fvMeshMovers/multiValveEngine/multiValveEngine.C
@@ -174,27 +174,11 @@ bool Foam::fvMeshMovers::multiValveEngine::update()
// Accumulate point motion from each moving object into newPoints field.
pointField newPoints(mesh().points());
- Info<< "Piston: " << nl;
-
piston_.updatePoints(newPoints);
- Info<< " position from TDC: " << piston_.position() << " m" << nl
- << " displacement: " << piston_.displacement() << " m" << nl
- << " speed = " << piston_.speed() << " m/s" << nl
- << " clearance: " << piston_.clearance() << " m" << endl;
-
forAll(valves_, valvei)
{
- valveObject& valve = valves_[valvei];
-
- Info<< "Valve " << valve.name << nl;
-
- valve.updatePoints(newPoints);
-
- Info<< " lift: " << (valve.isOpen() ? valve.lift() : 0.0) << " m "
- << (valve.isOpen() ? "(open)" : "(closed)") << nl
- << " speed: " << valve.speed() << " m/s" << nl
- << " displacement: " << valve.displacement() << " m" << endl;
+ valves_[valvei].updatePoints(newPoints);
}
// Update the mesh according to the newPoints field.
diff --git a/src/fvMeshMovers/multiValveEngine/multiValveEngineState/multiValveEngineState.C b/src/fvMeshMovers/multiValveEngine/multiValveEngineState/multiValveEngineState.C
new file mode 100644
index 0000000000..5497a3e8a8
--- /dev/null
+++ b/src/fvMeshMovers/multiValveEngine/multiValveEngineState/multiValveEngineState.C
@@ -0,0 +1,179 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+\*---------------------------------------------------------------------------*/
+
+#include "multiValveEngineState.H"
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace functionObjects
+{
+ defineTypeNameAndDebug(multiValveEngineState, 0);
+
+ addToRunTimeSelectionTable
+ (
+ functionObject,
+ multiValveEngineState,
+ dictionary
+ );
+}
+}
+
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+const Foam::fvMeshMovers::multiValveEngine&
+Foam::functionObjects::multiValveEngineState::mve() const
+{
+ return refCast(mesh_.mover());
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::functionObjects::multiValveEngineState::multiValveEngineState
+(
+ const word& name,
+ const Time& runTime,
+ const dictionary& dict
+)
+:
+ fvMeshFunctionObject(name, runTime, dict),
+ logFiles(obr_, name)
+{
+ read(dict);
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+Foam::functionObjects::multiValveEngineState::~multiValveEngineState()
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+bool Foam::functionObjects::multiValveEngineState::read(const dictionary& dict)
+{
+ fvMeshFunctionObject::read(dict);
+
+ resetName(typeName);
+
+ return true;
+}
+
+
+void Foam::functionObjects::multiValveEngineState::writeFileHeader
+(
+ const label i
+)
+{
+ writeHeader(file(), "Engine Motion State");
+ writeCommented(file(), "Time");
+ writeTabbed(file(), "piston from TDC");
+ writeTabbed(file(), "piston speed");
+ writeTabbed(file(), "piston displacement");
+ writeTabbed(file(), "piston clearance");
+
+ const fvMeshMovers::multiValveEngine& mve = this->mve();
+ const fvMeshMovers::multiValveEngine::valveList& valves = mve.valves;
+
+ forAll(valves, valvei)
+ {
+ const fvMeshMovers::multiValveEngine::valveObject& valve =
+ valves[valvei];
+
+ writeTabbed(file(), valve.name + " lift");
+ writeTabbed(file(), valve.name + " speed");
+ writeTabbed(file(), valve.name + " displacement");
+ }
+
+ file() << endl;
+}
+
+
+bool Foam::functionObjects::multiValveEngineState::execute()
+{
+ return true;
+}
+
+
+bool Foam::functionObjects::multiValveEngineState::write()
+{
+ logFiles::write();
+
+ if (Pstream::master())
+ {
+ const fvMeshMovers::multiValveEngine& mve = this->mve();
+
+ const fvMeshMovers::multiValveEngine::pistonObject& piston = mve.piston;
+
+ Log << "Piston: " << nl
+ << " position from TDC: " << piston.position() << " m" << nl
+ << " speed = " << piston.speed() << " m/s" << nl
+ << " displacement: " << piston.displacement() << " m" << nl
+ << " clearance: " << piston.clearance() << " m" << endl;
+
+ writeTime(file());
+ file()
+ << tab
+ << piston.position() << tab
+ << piston.speed() << tab
+ << piston.displacement() << tab
+ << piston.clearance();
+
+
+ const fvMeshMovers::multiValveEngine::valveList& valves = mve.valves;
+
+ forAll(valves, valvei)
+ {
+ const fvMeshMovers::multiValveEngine::valveObject& valve =
+ valves[valvei];
+
+ Log << "Valve " << valve.name << nl
+ << " lift: " << (valve.isOpen() ? valve.lift() : 0)
+ << " m "
+ << (valve.isOpen() ? "(open)" : "(closed)") << nl
+ << " speed: " << valve.speed() << " m/s" << nl
+ << " displacement: " << valve.displacement() << " m" << endl;
+
+ file()
+ << tab
+ << (valve.isOpen() ? valve.lift() : 0) << tab
+ << valve.speed() << tab
+ << valve.displacement();
+ }
+
+ file() << endl;
+ Log << endl;
+ }
+
+ return true;
+}
+
+
+// ************************************************************************* //
diff --git a/src/fvMeshMovers/multiValveEngine/multiValveEngineState/multiValveEngineState.H b/src/fvMeshMovers/multiValveEngine/multiValveEngineState/multiValveEngineState.H
new file mode 100644
index 0000000000..22e26a3b67
--- /dev/null
+++ b/src/fvMeshMovers/multiValveEngine/multiValveEngineState/multiValveEngineState.H
@@ -0,0 +1,151 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Copyright (C) 2024 OpenFOAM Foundation
+ \\/ M anipulation |
+-------------------------------------------------------------------------------
+License
+ This file is part of OpenFOAM.
+
+ OpenFOAM is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with OpenFOAM. If not, see .
+
+Class
+ Foam::functionObjects::multiValveEngineState
+
+Description
+ Writes the multi-valve engine motion state
+
+ providing details of the position and speed of the piston and valves.
+
+Usage
+ \table
+ Property | Description | Required | Default value
+ type | type name: multiValveEngineState | yes |
+ \endtable
+
+ Example of function object specification:
+ \verbatim
+ multiValveEngineState
+ {
+ type multiValveEngineState;
+ libs ("libfvMeshMoversMultiValveEngine.so");
+ }
+ \endverbatim
+
+See also
+ Foam::functionObjects::fvMeshFunctionObject
+ Foam::functionObjects::logFiles
+ Foam::fvMeshMovers::multiValveEngine
+
+SourceFiles
+ multiValveEngineState.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef multiValveEngineState_H
+#define multiValveEngineState_H
+
+#include "fvMeshFunctionObject.H"
+#include "logFiles.H"
+#include "multiValveEngine.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace functionObjects
+{
+
+/*---------------------------------------------------------------------------*\
+ Class multiValveEngineState Declaration
+\*---------------------------------------------------------------------------*/
+
+class multiValveEngineState
+:
+ public fvMeshFunctionObject,
+ public logFiles
+{
+ // Private Member Functions
+
+ const fvMeshMovers::multiValveEngine& mve() const;
+
+
+protected:
+
+ // Protected Member Functions
+
+ //- File header information
+ virtual void writeFileHeader(const label i);
+
+
+public:
+
+ //- Runtime type information
+ TypeName("multiValveEngineState");
+
+
+ // Constructors
+
+ //- Construct from Time and dictionary
+ multiValveEngineState
+ (
+ const word& name,
+ const Time& runTime,
+ const dictionary& dict
+ );
+
+ //- Disallow default bitwise copy construction
+ multiValveEngineState(const multiValveEngineState&) = delete;
+
+
+ //- Destructor
+ virtual ~multiValveEngineState();
+
+
+ // Member Functions
+
+ //- Read the multiValveEngineState data
+ virtual bool read(const dictionary&);
+
+ //- Return the list of fields required
+ virtual wordList fields() const
+ {
+ return wordList::null();
+ }
+
+ //- Execute, currently does nothing
+ virtual bool execute();
+
+ //- Write the multiValveEngineState
+ virtual bool write();
+
+
+ // Member Operators
+
+ //- Disallow default bitwise assignment
+ void operator=(const multiValveEngineState&) = delete;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace functionObjects
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/tutorials/XiFluid/kivaTest/system/functions b/tutorials/XiFluid/kivaTest/system/functions
new file mode 100644
index 0000000000..57e2bb27e5
--- /dev/null
+++ b/tutorials/XiFluid/kivaTest/system/functions
@@ -0,0 +1,19 @@
+/*--------------------------------*- C++ -*----------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration | Website: https://openfoam.org
+ \\ / A nd | Version: dev
+ \\/ M anipulation |
+\*---------------------------------------------------------------------------*/
+FoamFile
+{
+ format ascii;
+ class dictionary;
+ location "system";
+ object functions;
+}
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#includeFunc multiValveEngineState
+
+// ************************************************************************* //
diff --git a/tutorials/fluid/engine2Valve2D/system/functions b/tutorials/fluid/engine2Valve2D/system/functions
index 39a032d936..fe32dad692 100644
--- a/tutorials/fluid/engine2Valve2D/system/functions
+++ b/tutorials/fluid/engine2Valve2D/system/functions
@@ -14,6 +14,7 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+#includeFunc multiValveEngineState
#includeFunc checkMesh(executeControl=adjustableRunTime, executeInterval=5)
// ************************************************************************* //