diff --git a/src/finiteVolume/cfdTools/general/fvSource/fvTotalSource.C b/src/finiteVolume/cfdTools/general/fvSource/fvTotalSource.C index 82884f368a..d591e423b6 100644 --- a/src/finiteVolume/cfdTools/general/fvSource/fvTotalSource.C +++ b/src/finiteVolume/cfdTools/general/fvSource/fvTotalSource.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -58,10 +58,11 @@ void Foam::fvTotalSource::addSource(fvMatrix& eqn) const eqn.dimensions() = S.dimensions(); // Apply the source + scalarField& eqnSource = eqn.source(); forAll(cells, i) { const scalar f = mesh().V()[cells[i]]/V; - eqn.source()[cells[i]] -= f*S.value(); + eqnSource[cells[i]] -= f*S.value(); } } diff --git a/src/finiteVolume/cfdTools/general/fvSource/fvTotalSourceTemplates.C b/src/finiteVolume/cfdTools/general/fvSource/fvTotalSourceTemplates.C index 317a80d8fd..5e5f2e121f 100644 --- a/src/finiteVolume/cfdTools/general/fvSource/fvTotalSourceTemplates.C +++ b/src/finiteVolume/cfdTools/general/fvSource/fvTotalSourceTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,11 +60,13 @@ void Foam::fvTotalSource::addSupType ); // Apply the source + Field& eqnSource = eqn.source(); + scalarField& eqnDiag = eqn.diag(); forAll(cells, i) { const scalar f = mesh().V()[cells[i]]/V; - eqn.source()[cells[i]] -= f*S.value()*sourceCoeff[i]; - eqn.diag()[cells[i]] += f*S.value()*internalCoeff[i]; + eqnSource[cells[i]] -= f*S.value()*sourceCoeff[i]; + eqnDiag[cells[i]] += f*S.value()*internalCoeff[i]; } } else @@ -76,10 +78,11 @@ void Foam::fvTotalSource::addSupType ); // Apply the source + Field& eqnSource = eqn.source(); forAll(cells, i) { const scalar f = mesh().V()[cells[i]]/V; - eqn.source()[cells[i]] -= f*S.value()*value[i]; + eqnSource[cells[i]] -= f*S.value()*value[i]; } } } diff --git a/src/fvModels/derived/acceleration/acceleration.C b/src/fvModels/derived/acceleration/acceleration.C index 65fac4902a..c4b1876ae2 100644 --- a/src/fvModels/derived/acceleration/acceleration.C +++ b/src/fvModels/derived/acceleration/acceleration.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -77,10 +77,10 @@ void Foam::fv::acceleration::add const labelUList cells = set_.cells(); + vectorField& eqnSource = eqn.source(); forAll(cells, i) { - const label celli = cells[i]; - eqn.source()[celli] -= V[celli]*alphaRho[celli]*a; + eqnSource[cells[i]] -= V[cells[i]]*alphaRho[cells[i]]*a; } } diff --git a/src/fvModels/derived/heatSource/heatSource.C b/src/fvModels/derived/heatSource/heatSource.C index f9cc69acec..7ec2635639 100644 --- a/src/fvModels/derived/heatSource/heatSource.C +++ b/src/fvModels/derived/heatSource/heatSource.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -132,9 +132,10 @@ void Foam::fv::heatSource::addSup const scalar t = mesh().time().userTimeValue(); const scalar q = q_->value(t); + scalarField& eqnSource = eqn.source(); forAll(cells, i) { - eqn.source()[cells[i]] -= mesh().V()[cells[i]]*q; + eqnSource[cells[i]] -= mesh().V()[cells[i]]*q; } }