Skip to content
Permalink
Browse files

dynamicMotionSolverFvMesh, motionSolver: added support to write the m…

…otion state when the mesh is written
  • Loading branch information...
Henry Weller
Henry Weller committed Apr 24, 2019
1 parent f3fb9b3 commit 51d4c0d974be63b8c0fc42d02acbc2573b14b8f2
@@ -74,4 +74,17 @@ bool Foam::dynamicMotionSolverFvMesh::update()
}


bool Foam::dynamicMotionSolverFvMesh::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp,
const bool valid
) const
{
motionPtr_->write();
return fvMesh::writeObject(fmt, ver, cmp, valid);
}


// ************************************************************************* //
@@ -94,6 +94,18 @@ public:

//- Update the mesh for both mesh motion and topology change
virtual bool update();


// Write

//- Write the underlying polyMesh and other data
virtual bool writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp,
const bool valid
) const;
};


@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -244,7 +244,6 @@ public:
IOstream::compressionType cmp,
const bool valid
) const;

};


@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -71,8 +71,6 @@ Description
#define extrudePatchMesh_H

#include "extrudeModel.H"
#include "autoPtr.H"

#include "fvMesh.H"
#include "Time.H"

@@ -92,9 +90,6 @@ class extrudePatchMesh
:
public fvMesh
{

private:

// Private data

//- Enumeration of patch IDs
@@ -153,4 +153,10 @@ void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm)
{}


bool Foam::motionSolver::write() const
{
return true;
}


// ************************************************************************* //
@@ -148,6 +148,9 @@ public:

//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&) = 0;

//- Optionally write motion state information for restart
virtual bool write() const;
};


@@ -336,4 +336,26 @@ void Foam::rigidBodyMeshMotion::solve()
}


bool Foam::rigidBodyMeshMotion::write() const
{
IOdictionary dict
(
IOobject
(
"rigidBodyMotionState",
mesh().time().timeName(),
"uniform",
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);

state().write(dict);

return dict.regIOobject::write() && displacementMotionSolver::write();
}


// ************************************************************************* //
@@ -161,6 +161,9 @@ public:

//- Solve for motion
virtual void solve();

//- Write motion state information for restart
virtual bool write() const;
};


@@ -292,4 +292,26 @@ void Foam::rigidBodyMeshMotionSolver::updateMesh(const mapPolyMesh& mpm)
}


bool Foam::rigidBodyMeshMotionSolver::write() const
{
IOdictionary dict
(
IOobject
(
"rigidBodyMotionState",
mesh().time().timeName(),
"uniform",
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);

state().write(dict);

return dict.regIOobject::write() && motionSolver::write();
}


// ************************************************************************* //
@@ -157,6 +157,9 @@ public:

//- Update local data for topology changes
virtual void updateMesh(const mapPolyMesh&);

//- Write motion state information for restart
virtual bool write() const;
};


@@ -259,4 +259,31 @@ void Foam::sixDoFRigidBodyMotionSolver::solve()
}


bool Foam::sixDoFRigidBodyMotionSolver::writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp,
const bool valid
) const
{
IOdictionary dict
(
IOobject
(
"sixDoFRigidBodyMotionState",
mesh().time().timeName(),
"uniform",
mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);

motion_.state().write(dict);
return dict.regIOobject::write() && displacementMotionSolver::write();
}


// ************************************************************************* //
@@ -132,6 +132,15 @@ public:

//- Solve for motion
virtual void solve();

//- Write state using given format, version and compression
virtual bool writeObject
(
IOstream::streamFormat fmt,
IOstream::versionNumber ver,
IOstream::compressionType cmp,
const bool valid
) const;
};


0 comments on commit 51d4c0d

Please sign in to comment.
You can’t perform that action at this time.