mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
twoPhaseMixtureThermo: Fix for collated file operation
twoPhaseMixtureThermo writes the temperatures during construction only for them to be read again immediately after by construction of the individual phases' thermo models. When running with collated file handling this behaviour is not thread safe. This change deactivates threading for the duration of this behaviour. Patch contributed by Mattijs Janssens
This commit is contained in:
@ -26,7 +26,7 @@ License
|
||||
#include "twoPhaseMixtureThermo.H"
|
||||
#include "gradientEnergyFvPatchScalarField.H"
|
||||
#include "mixedEnergyFvPatchScalarField.H"
|
||||
|
||||
#include "collatedFileOperation.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -50,6 +50,12 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
|
||||
thermo1_(nullptr),
|
||||
thermo2_(nullptr)
|
||||
{
|
||||
// Note: we're writing files to be read in immediately afterwards.
|
||||
// Avoid any thread-writing problems.
|
||||
float bufSz =
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize;
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize = 0;
|
||||
|
||||
{
|
||||
volScalarField T1
|
||||
(
|
||||
@ -80,6 +86,10 @@ Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
|
||||
T2.write();
|
||||
}
|
||||
|
||||
fileOperations::collatedFileOperation::maxThreadFileBufferSize =
|
||||
bufSz;
|
||||
|
||||
|
||||
thermo1_ = rhoThermo::New(U.mesh(), phase1Name());
|
||||
thermo2_ = rhoThermo::New(U.mesh(), phase2Name());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user