Skip to content

Commit

Permalink
update operators
Browse files Browse the repository at this point in the history
  • Loading branch information
HenningScheufler committed Jul 17, 2024
1 parent d6fcb17 commit ed7284f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 29 deletions.
2 changes: 1 addition & 1 deletion benchmarks/gradOperator/gradOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "NeoFOAM/core/executor/executor.hpp"
#include "NeoFOAM/fields/field.hpp"
#include "NeoFOAM/mesh/unstructured.hpp"
#include "NeoFOAM/finiteVolume/operators/gaussGreenGrad.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/operators/gaussGreenGrad.hpp"

#include "FoamAdapter/readers/foamMesh.hpp"
#include "FoamAdapter/writers/writers.hpp"
Expand Down
12 changes: 6 additions & 6 deletions benchmarks/scalarAdvection/scalarAdvection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include "NeoFOAM/core/executor/executor.hpp"
#include "NeoFOAM/fields/field.hpp"
#include "NeoFOAM/mesh/unstructured.hpp"
#include "NeoFOAM/finiteVolume/operators/gaussGreenDiv.hpp"
#include "NeoFOAM/finiteVolume/operators/gaussGreenGrad.hpp"
#include "NeoFOAM/finiteVolume/interpolation/surfaceInterpolation.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/operators/gaussGreenDiv.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/operators/gaussGreenGrad.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp"

#define namespaceFoam // Suppress <using namespace Foam;>
#include "fvCFD.H"
Expand Down Expand Up @@ -145,13 +145,13 @@ int main(int argc, char* argv[])
NeoFOAM::fill(neoDivT.internalField(), 0.0);
NeoFOAM::fill(neoDivT.boundaryField().value(), 0.0);

NeoFOAM::GaussGreenDiv(
fvcc::GaussGreenDiv(
exec,
uMesh,
NeoFOAM::SurfaceInterpolation(
fvcc::SurfaceInterpolation(
exec,
uMesh,
NeoFOAM::SurfaceInterpolationFactory::create("upwind", exec, uMesh)
fvcc::SurfaceInterpolationFactory::create("upwind", exec, uMesh)
)
)
.div(neoDivT, neoPhi, neoT);
Expand Down
8 changes: 4 additions & 4 deletions test/test_geometricFields.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#include "NeoFOAM/fields/domainField.hpp"
#include "NeoFOAM/finiteVolume/cellCentred.hpp"

#include "NeoFOAM/finiteVolume/operators/gaussGreenGrad.hpp"
#include "NeoFOAM/finiteVolume/interpolation/linear.hpp"
#include "NeoFOAM/finiteVolume/interpolation/upwind.hpp"
#include "NeoFOAM/finiteVolume/interpolation/surfaceInterpolation.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/operators/gaussGreenGrad.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/linear.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/upwind.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp"

#include "FoamAdapter/readers/foamMesh.hpp"
#include "FoamAdapter/writers/writers.hpp"
Expand Down
24 changes: 10 additions & 14 deletions test/test_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "NeoFOAM/fields/domainField.hpp"
#include "NeoFOAM/finiteVolume/cellCentred.hpp"

#include "NeoFOAM/finiteVolume/operators/gaussGreenGrad.hpp"

#include "NeoFOAM/finiteVolume/interpolation/linear.hpp"
#include "NeoFOAM/finiteVolume/interpolation/upwind.hpp"
#include "NeoFOAM/finiteVolume/interpolation/surfaceInterpolation.hpp"

#include "NeoFOAM/finiteVolume/operators/gaussGreenDiv.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/linear.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/upwind.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/interpolation/surfaceInterpolation.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/operators/gaussGreenGrad.hpp"
#include "NeoFOAM/finiteVolume/cellCentred/operators/gaussGreenDiv.hpp"

#include "FoamAdapter/readers/foamMesh.hpp"
#include "FoamAdapter/writers/writers.hpp"
Expand Down Expand Up @@ -139,9 +137,9 @@ TEST_CASE("Interpolation")

SECTION("linear")
{
auto linearKernel = NeoFOAM::SurfaceInterpolationFactory::create("linear", exec, uMesh);
auto linearKernel = fvcc::SurfaceInterpolationFactory::create("linear", exec, uMesh);

NeoFOAM::SurfaceInterpolation interp(exec, uMesh, std::move(linearKernel));
fvcc::SurfaceInterpolation interp(exec, uMesh, std::move(linearKernel));
interp.interpolate(neoSurfT, neoT);
auto s_neoSurfT = neoSurfT.internalField().copyToHost().span();
std::span<Foam::scalar> surfT_span(surfT.primitiveFieldRef().data(), surfT.size());
Expand Down Expand Up @@ -213,7 +211,7 @@ TEST_CASE("GradOperator")
fvcc::VolumeField<NeoFOAM::Vector> neoGradT = constructFrom(exec, uMesh, ofGradT);
NeoFOAM::fill(neoGradT.internalField(), NeoFOAM::Vector(0.0, 0.0, 0.0));
NeoFOAM::fill(neoGradT.boundaryField().value(), NeoFOAM::Vector(0.0, 0.0, 0.0));
NeoFOAM::gaussGreenGrad(exec, uMesh).grad(neoGradT, neoT);
fvcc::gaussGreenGrad(exec, uMesh).grad(neoGradT, neoT);
Foam::Info << "writing gradT field for exector: " << exec_name << Foam::endl;
write(neoGradT.internalField(), mesh, "gradT_" + exec_name);

Expand Down Expand Up @@ -307,12 +305,10 @@ TEST_CASE("DivOperator")
fvcc::VolumeField<NeoFOAM::scalar> neoDivT = constructFrom(exec, uMesh, ofDivT);
NeoFOAM::fill(neoDivT.internalField(), 0.0);
NeoFOAM::fill(neoDivT.boundaryField().value(), 0.0);
NeoFOAM::GaussGreenDiv(
fvcc::GaussGreenDiv(
exec,
uMesh,
NeoFOAM::SurfaceInterpolation(
exec, uMesh, std::make_unique<NeoFOAM::Linear>(exec, uMesh)
)
fvcc::SurfaceInterpolation(exec, uMesh, std::make_unique<fvcc::Linear>(exec, uMesh))
)
.div(neoDivT, neoPhi, neoT);
Foam::Info << "writing divT field for exector: " << exec_name << Foam::endl;
Expand Down
6 changes: 3 additions & 3 deletions test/test_unstructuredMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ TEST_CASE("fvccGeometryScheme")
SECTION("BasicFvccGeometryScheme" + exec_name)
{
// update on construction
NeoFOAM::FvccGeometryScheme scheme(
exec, uMesh, std::make_unique<NeoFOAM::BasicFvccGeometryScheme>(uMesh)
NeoFOAM::GeometryScheme scheme(
exec, uMesh, std::make_unique<NeoFOAM::BasicGeometryScheme>(uMesh)
);
scheme.update(); // make sure it uptodate
auto foam_weights = mesh.weights();
Expand All @@ -392,7 +392,7 @@ TEST_CASE("fvccGeometryScheme")
SECTION("DefaultBasicFvccGeometryScheme" + exec_name)
{
// update on construction
NeoFOAM::FvccGeometryScheme scheme(uMesh);
NeoFOAM::GeometryScheme scheme(uMesh);
scheme.update(); // make sure it uptodate
auto foam_weights = mesh.weights();

Expand Down

0 comments on commit ed7284f

Please sign in to comment.