ENH: improve volRegion handling of moving meshes (#1194)

- implemented as lazy evaluation with an additional update() method.
  This avoids unnecessary changes until the values are actually
  required.

- apply mesh motion changes for momentum, volFieldValue,
  specieReactionRates function objects
This commit is contained in:
Mark Olesen
2019-02-06 10:25:47 +01:00
parent fb561daf7a
commit 8f572a5e71
12 changed files with 162 additions and 53 deletions

View File

@ -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) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -229,12 +229,6 @@ Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldValues::volFieldValue::~volFieldValue()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldValues::volFieldValue::read
@ -251,6 +245,8 @@ bool Foam::functionObjects::fieldValues::volFieldValue::read
bool Foam::functionObjects::fieldValues::volFieldValue::write()
{
volRegion::update(); // Ensure cached values are valid
fieldValue::write();
if (Pstream::master())

View File

@ -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-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -272,7 +272,7 @@ public:
//- Destructor
virtual ~volFieldValue();
virtual ~volFieldValue() = default;
// Public Member Functions

View File

@ -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-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -260,14 +260,12 @@ Foam::functionObjects::fieldValues::volFieldValue::filterField
const Field<Type>& field
) const
{
if (isNull(cellIDs()))
if (volRegion::vrtAll == this->volRegion::regionType())
{
return field;
}
else
{
return tmp<Field<Type>>::New(field, cellIDs());
}
return tmp<Field<Type>>::New(field, cellIDs());
}