Skip to content

Commit

Permalink
fvc::flux: Templated and generalised to support vector fluxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Weller committed Jan 20, 2023
1 parent b8d1f3b commit 42c35a2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 62 deletions.
1 change: 0 additions & 1 deletion src/finiteVolume/Make/files
Expand Up @@ -440,7 +440,6 @@ laplacianSchemes = finiteVolume/laplacianSchemes
$(laplacianSchemes)/laplacianScheme/laplacianSchemes.C
$(laplacianSchemes)/gaussLaplacianScheme/gaussLaplacianSchemes.C

finiteVolume/fvc/fvcFlux.C
finiteVolume/fvc/fvcMeshPhi.C
finiteVolume/fvc/fvcSmooth/fvcSmooth.C
finiteVolume/fvc/fvcReconstructMag.C
Expand Down
55 changes: 0 additions & 55 deletions src/finiteVolume/finiteVolume/fvc/fvcFlux.C

This file was deleted.

16 changes: 12 additions & 4 deletions src/finiteVolume/finiteVolume/fvc/fvcFlux.H
Expand Up @@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
Expand All @@ -28,7 +28,7 @@ Description
Calculate the face-flux of the given field.
SourceFiles
fvcFlux.C
fvcFluxTemplates.C
\*---------------------------------------------------------------------------*/

Expand All @@ -51,10 +51,18 @@ namespace Foam
namespace fvc
{
//- Return the face-flux field obtained from the given volVectorField
tmp<surfaceScalarField> flux(const volVectorField& vvf);
template<class Type>
tmp<SurfaceField<typename innerProduct<vector, Type>::type>> flux
(
const VolField<Type>& vf
);

//- Return the face-flux field obtained from the given tmp volVectorField
tmp<surfaceScalarField> flux(const tmp<volVectorField>& tvvf);
template<class Type>
tmp<SurfaceField<typename innerProduct<vector, Type>::type>> flux
(
const tmp<VolField<Type>>& tvf
);

template<class Type>
tmp<SurfaceField<Type>> flux
Expand Down
33 changes: 31 additions & 2 deletions src/finiteVolume/finiteVolume/fvc/fvcFluxTemplates.C
Expand Up @@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
Expand All @@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/

#include "fvcFlux.H"
#include "fvMesh.H"
#include "surfaceInterpolate.H"
#include "convectionScheme.H"

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Expand All @@ -39,6 +39,35 @@ namespace fvc

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

template<class Type>
tmp<SurfaceField<typename innerProduct<vector, Type>::type>> flux
(
const VolField<Type>& vf
)
{
return scheme<Type>
(
vf.mesh(),
"flux(" + vf.name() + ')'
)().dotInterpolate(vf.mesh().Sf(), vf);
}


template<class Type>
tmp<SurfaceField<typename innerProduct<vector, Type>::type>> flux
(
const tmp<VolField<Type>>& tvf
)
{
tmp<SurfaceField<typename innerProduct<vector, Type>::type>> Flux
(
fvc::flux(tvf())
);
tvf.clear();
return Flux;
}


template<class Type>
tmp<SurfaceField<Type>>
flux
Expand Down

0 comments on commit 42c35a2

Please sign in to comment.