diff --git a/src/OpenFOAM/include/createMesh.H b/src/OpenFOAM/include/createMesh.H index aab5576405dda4439578f2a9883ecc5f0e4850ed..06d07591b24c2e6c023f0eb25a6144f0c0e8f279 100644 --- a/src/OpenFOAM/include/createMesh.H +++ b/src/OpenFOAM/include/createMesh.H @@ -16,6 +16,7 @@ if (args.found("dry-run") || args.found("dry-run-write")) if (args.found("dry-run-write")) { // Using saWriteNow triggers function objects execute(), write() + meshPtr->setInstance(runTime.constant()); runTime.stopAt(Foam::Time::saWriteNow); } else diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.C b/src/OpenFOAM/meshes/polyMesh/polyMesh.C index 6db8ff11fa0a37ec1cfb393b9786fe84a7112555..7324d8e4806e5af0d53318effa4401487428a950 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -374,8 +374,8 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), - IOobject::AUTO_WRITE + IOobject::NO_READ, + io.writeOpt() ), std::move(points) ), @@ -387,8 +387,8 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), - IOobject::AUTO_WRITE + IOobject::NO_READ, + io.writeOpt() ), std::move(faces) ), @@ -400,8 +400,8 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), - IOobject::AUTO_WRITE + IOobject::NO_READ, + io.writeOpt() ), std::move(owner) ), @@ -413,8 +413,8 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), - IOobject::AUTO_WRITE + IOobject::NO_READ, + io.writeOpt() ), std::move(neighbour) ), @@ -427,8 +427,8 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), - IOobject::AUTO_WRITE + IOobject::NO_READ, + io.writeOpt() ), *this, polyPatchList() @@ -447,7 +447,7 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), + IOobject::NO_READ, IOobject::NO_WRITE ), *this, @@ -461,7 +461,7 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), + IOobject::NO_READ, IOobject::NO_WRITE ), *this, @@ -475,7 +475,7 @@ Foam::polyMesh::polyMesh instance(), meshSubDir, *this, - io.readOpt(), + IOobject::NO_READ, IOobject::NO_WRITE ), *this, @@ -526,7 +526,7 @@ Foam::polyMesh::polyMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), std::move(points) ), @@ -539,7 +539,7 @@ Foam::polyMesh::polyMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), std::move(faces) ), @@ -552,7 +552,7 @@ Foam::polyMesh::polyMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), 0 ), @@ -565,7 +565,7 @@ Foam::polyMesh::polyMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), 0 ), @@ -579,7 +579,7 @@ Foam::polyMesh::polyMesh meshSubDir, *this, IOobject::NO_READ, - IOobject::AUTO_WRITE + io.writeOpt() ), *this, 0 diff --git a/src/OpenFOAM/meshes/polyMesh/polyMesh.H b/src/OpenFOAM/meshes/polyMesh/polyMesh.H index b442bfeb6627de4ffb945c9b5c3d3b4074a3089e..fbb24c527e15fe1290b55605c286aaeecc942b58 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMesh.H +++ b/src/OpenFOAM/meshes/polyMesh/polyMesh.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2018-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -399,7 +399,11 @@ public: const fileName& facesInstance() const; //- Set the instance for mesh files - void setInstance(const fileName&); + void setInstance + ( + const fileName& instance, + const IOobject::writeOption wOpt = IOobject::AUTO_WRITE + ); // Access diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C index 9724bea7246f468edf215b195a6fa48aec21c859..3ee27f95376dac0cd14faaa70f3fd253515a9791 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshIO.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -29,40 +29,44 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::polyMesh::setInstance(const fileName& inst) +void Foam::polyMesh::setInstance +( + const fileName& inst, + const IOobject::writeOption wOpt +) { if (debug) { InfoInFunction << "Resetting file instance to " << inst << endl; } - points_.writeOpt() = IOobject::AUTO_WRITE; + points_.writeOpt() = wOpt; points_.instance() = inst; - faces_.writeOpt() = IOobject::AUTO_WRITE; + faces_.writeOpt() = wOpt; faces_.instance() = inst; - owner_.writeOpt() = IOobject::AUTO_WRITE; + owner_.writeOpt() = wOpt; owner_.instance() = inst; - neighbour_.writeOpt() = IOobject::AUTO_WRITE; + neighbour_.writeOpt() = wOpt; neighbour_.instance() = inst; - boundary_.writeOpt() = IOobject::AUTO_WRITE; + boundary_.writeOpt() = wOpt; boundary_.instance() = inst; - pointZones_.writeOpt() = IOobject::AUTO_WRITE; + pointZones_.writeOpt() = wOpt; pointZones_.instance() = inst; - faceZones_.writeOpt() = IOobject::AUTO_WRITE; + faceZones_.writeOpt() = wOpt; faceZones_.instance() = inst; - cellZones_.writeOpt() = IOobject::AUTO_WRITE; + cellZones_.writeOpt() = wOpt; cellZones_.instance() = inst; if (tetBasePtIsPtr_.valid()) { - tetBasePtIsPtr_->writeOpt() = IOobject::AUTO_WRITE; + tetBasePtIsPtr_->writeOpt() = wOpt; tetBasePtIsPtr_->instance() = inst; } } diff --git a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C index eb008b47c573f51a91d28339000245388c20dcdd..cd973868f2672bc068019858b828e4c0df863d51 100644 --- a/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C +++ b/src/finiteVolume/fvMesh/singleCellFvMesh/singleCellFvMesh.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -379,6 +379,10 @@ void Foam::singleCellFvMesh::agglomerateMesh ); } } + + // Make sure we don't start dumping mesh every timestep (since + // resetPrimitives sets AUTO_WRITE) + setInstance(time().constant(), IOobject::NO_WRITE); }