diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C index 472449ff74..fbf6d58560 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistribute.C @@ -1691,8 +1691,8 @@ Foam::autoPtr Foam::fvMeshDistribute::receiveMesh domainMesh.addFvPatches(patches, false); //*** Set the old-time volumes if present - // domainMesh.setV0().field() = V0; - // domainMesh.setV00().field() = V00; + // domainMesh.V0Ref().field() = V0; + // domainMesh.V00Ref().field() = V00; // Construct zones List pZonePtrs(pointZoneNames.size()); diff --git a/src/finiteVolume/fvMesh/fvMesh.H b/src/finiteVolume/fvMesh/fvMesh.H index 5e3fa2ceb9..4beb987db7 100644 --- a/src/finiteVolume/fvMesh/fvMesh.H +++ b/src/finiteVolume/fvMesh/fvMesh.H @@ -308,13 +308,19 @@ public: //- Return old-time cell volumes const DimensionedField& V0() const; + //- Access old-time cell volumes + DimensionedField& V0Ref(); + //- Return old-old-time cell volumes const DimensionedField& V00() const; + //- Access old-old-time cell volumes + DimensionedField& V00Ref(); + //- Return sub-cycle cell volumes tmp> Vsc() const; - //- Return sub-cycl old-time cell volumes + //- Return sub-cycle old-time cell volumes tmp> Vsc0() const; //- Return cell face area vectors @@ -323,9 +329,6 @@ public: //- Return cell face area magnitudes const surfaceScalarField& magSf() const; - //- Return cell face motion fluxes - const surfaceScalarField& phi() const; - //- Return cell centres as volVectorField const volVectorField& C() const; @@ -335,6 +338,12 @@ public: //- Return face deltas as surfaceVectorField tmp delta() const; + //- Return cell face motion fluxes + const surfaceScalarField& phi() const; + + //- Access cell face motion fluxes + surfaceScalarField& phiRef(); + //- Return a labelType of valid component indicators // 1 : valid (solved) // -1 : invalid (not solved) @@ -390,12 +399,6 @@ public: // these fvPatches. void removeFvBoundary(); - //- Return cell face motion fluxes - surfaceScalarField& setPhi(); - - //- Return old-time cell volumes - DimensionedField& setV0(); - // Write diff --git a/src/finiteVolume/fvMesh/fvMeshGeometry.C b/src/finiteVolume/fvMesh/fvMeshGeometry.C index 1769ccfcab..144239c0af 100644 --- a/src/finiteVolume/fvMesh/fvMeshGeometry.C +++ b/src/finiteVolume/fvMesh/fvMeshGeometry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -226,7 +226,7 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V0() const } -Foam::volScalarField::Internal& Foam::fvMesh::setV0() +Foam::volScalarField::Internal& Foam::fvMesh::V0Ref() { if (!V0Ptr_) { @@ -267,6 +267,17 @@ const Foam::volScalarField::Internal& Foam::fvMesh::V00() const } +Foam::volScalarField::Internal& Foam::fvMesh::V00Ref() +{ + if (!V00Ptr_) + { + V00(); + } + + return *V00Ptr_; +} + + Foam::tmp Foam::fvMesh::Vsc() const { @@ -429,7 +440,7 @@ const Foam::surfaceScalarField& Foam::fvMesh::phi() const } -Foam::surfaceScalarField& Foam::fvMesh::setPhi() +Foam::surfaceScalarField& Foam::fvMesh::phiRef() { if (!phiPtr_) {