From 0b83d39500761c97c7d741becaa7d6f99754295a Mon Sep 17 00:00:00 2001 From: Andrew Heather <> Date: Wed, 30 Nov 2022 10:33:53 +0000 Subject: [PATCH] BUG: removed stickiness of readFields function object in postProcess mode. Fixes #2647 --- .../field/readFields/readFields.C | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/functionObjects/field/readFields/readFields.C b/src/functionObjects/field/readFields/readFields.C index 79a085431a9..bd670217d3a 100644 --- a/src/functionObjects/field/readFields/readFields.C +++ b/src/functionObjects/field/readFields/readFields.C @@ -80,15 +80,28 @@ bool Foam::functionObjects::readFields::execute() for (const word& fieldName : fieldSet_) { // Already loaded? - const auto* ptr = mesh_.cfindObject<regIOobject>(fieldName); + auto* ptr = mesh_.getObjectPtr<regIOobject>(fieldName); if (ptr) { - DebugInfo - << "readFields : " - << ptr->name() << " (" << ptr->type() - << ") already in database" << endl; - continue; + if (functionObject::postProcess) + { + DebugInfo + << "readFields : " + << ptr->name() << " (" << ptr->type() + << ") already in database - removing" << endl; + + ptr->checkOut(); + } + else + { + DebugInfo + << "readFields : " + << ptr->name() << " (" << ptr->type() + << ") already in database" << endl; + + continue; + } } // Load field as necessary -- GitLab