Commit 34606f54 authored by Andrew Heather's avatar Andrew Heather
Browse files

COMP: Updated createDpDt for moving meshes

parent f51ee9a0
......@@ -49,9 +49,9 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
{
IOdictionary dict(dictHeader);
const word dynamicFvMeshTypeName(dict.lookup("dynamicFvMesh"));
const word modelType(dict.lookup("dynamicFvMesh"));
Info<< "Selecting dynamicFvMesh " << dynamicFvMeshTypeName << endl;
Info<< "Selecting dynamicFvMesh " << modelType << endl;
const_cast<Time&>(io.time()).libs().open
(
......@@ -67,25 +67,22 @@ Foam::autoPtr<Foam::dynamicFvMesh> Foam::dynamicFvMesh::New(const IOobject& io)
<< exit(FatalError);
}
auto cstrIter =
IOobjectConstructorTablePtr_->cfind(dynamicFvMeshTypeName);
auto cstrIter = IOobjectConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalIOErrorInFunction(dict)
<< "Unknown dynamicFvMesh type "
<< dynamicFvMeshTypeName << nl << nl
<< modelType << nl << nl
<< "Valid dynamicFvMesh types are :" << endl
<< IOobjectConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
#define MOVING_MESH
return autoPtr<dynamicFvMesh>(cstrIter()(io));
}
#undef MOVING_MESH
return autoPtr<dynamicFvMesh>(new staticFvMesh(io));
}
......
......@@ -40,15 +40,13 @@ SourceFiles
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#define MOVING_MESH
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class engineMesh Declaration
Class engineMesh Declaration
\*---------------------------------------------------------------------------*/
class engineMesh
......@@ -114,9 +112,13 @@ public:
// Member Functions
// Edit
//- Is mesh dynamic
virtual bool dynamic() const
{
return true;
}
virtual void move() = 0;
virtual void move() = 0;
};
......
#if defined(MOVING_MESH)
IOobject dpdtHeader
(
"dpdt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
if (mesh.dynamic())
{
Info<< "Creating field dpdt for moving meshes\n" << endl;
// Note: set to read if present and auto write to simplify dpdt correction
// by meshPhi
volScalarField dpdt
(
IOobject
(
"dpdt",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::ddt(p)
);
#else
// Note
// - set to READ_IF_PRESENT and AUTO_WRITE to simplify dpdt correction
// by meshPhi
dpdtHeader.readOpt() = IOobject::READ_IF_PRESENT;
dpdtHeader.writeOpt() = IOobject::AUTO_WRITE;
}
else
{
Info<< "Creating field dpdt\n" << endl;
}
volScalarField dpdt
(
IOobject
(
"dpdt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::ddt(p)
);
#endif
volScalarField dpdt(dpdtHeader, fvc::ddt(p));
if (!thermo.dpdt())
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment