diff --git a/include/NeoFOAM/finiteVolume/cellCentred/operators/divOperator.hpp b/include/NeoFOAM/finiteVolume/cellCentred/operators/divOperator.hpp index 1c8418370..f88f53a34 100644 --- a/include/NeoFOAM/finiteVolume/cellCentred/operators/divOperator.hpp +++ b/include/NeoFOAM/finiteVolume/cellCentred/operators/divOperator.hpp @@ -125,12 +125,12 @@ class DivOperator : public dsl::OperatorMixin> source += tmpsource; } - void div(Field& divPhi) + void div(Field& divPhi) { divOperatorStrategy_->div(divPhi, faceFlux_, this->getField()); } - void div(VolumeField& divPhi) + void div(VolumeField& divPhi) { divOperatorStrategy_->div(divPhi, faceFlux_, this->getField()); } diff --git a/test/finiteVolume/cellCentred/operator/divOperator.cpp b/test/finiteVolume/cellCentred/operator/divOperator.cpp index f7bd776f8..a2ea7505c 100644 --- a/test/finiteVolume/cellCentred/operator/divOperator.cpp +++ b/test/finiteVolume/cellCentred/operator/divOperator.cpp @@ -14,6 +14,8 @@ namespace fvcc = NeoFOAM::finiteVolume::cellCentred; using Operator = NeoFOAM::dsl::Operator; +namespace NeoFOAM +{ TEMPLATE_TEST_CASE("DivOperator", "[template]", NeoFOAM::scalar, NeoFOAM::Vector) { @@ -25,7 +27,7 @@ TEMPLATE_TEST_CASE("DivOperator", "[template]", NeoFOAM::scalar, NeoFOAM::Vector std::string execName = std::visit([](auto e) { return e.name(); }, exec); // TODO take 1d mesh - NeoFOAM::UnstructuredMesh mesh = NeoFOAM::createSingleCellMesh(exec); + auto mesh = create1DUniformMesh(exec, 10); auto surfaceBCs = fvcc::createCalculatedBCs>(mesh); fvcc::SurfaceField faceFlux(exec, "sf", mesh, surfaceBCs); @@ -35,6 +37,8 @@ TEMPLATE_TEST_CASE("DivOperator", "[template]", NeoFOAM::scalar, NeoFOAM::Vector fvcc::VolumeField phi(exec, "sf", mesh, volumeBCs); NeoFOAM::fill(phi.internalField(), NeoFOAM::one::value); + auto result = NeoFOAM::Field(exec, phi.size()); + SECTION("Construct from Token" + execName) { NeoFOAM::Input input = NeoFOAM::TokenList({std::string("Gauss"), std::string("linear")}); @@ -47,6 +51,9 @@ TEMPLATE_TEST_CASE("DivOperator", "[template]", NeoFOAM::scalar, NeoFOAM::Vector {{std::string("DivOperator"), std::string("Gauss")}, {std::string("surfaceInterpolation"), std::string("linear")}} ); - fvcc::DivOperator(Operator::Type::Explicit, faceFlux, phi, input); + auto op = fvcc::DivOperator(Operator::Type::Explicit, faceFlux, phi, input); + op.div(result); } } + +}