Skip to content

Commit

Permalink
fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
greole committed Feb 12, 2025
1 parent 2bc5c24 commit 5c4f66f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ class DivOperator : public dsl::OperatorMixin<VolumeField<ValueType>>
source += tmpsource;
}

void div(Field<scalar>& divPhi)
void div(Field<ValueType>& divPhi)
{
divOperatorStrategy_->div(divPhi, faceFlux_, this->getField());
}

void div(VolumeField<scalar>& divPhi)
void div(VolumeField<ValueType>& divPhi)
{
divOperatorStrategy_->div(divPhi, faceFlux_, this->getField());
}
Expand Down
11 changes: 9 additions & 2 deletions test/finiteVolume/cellCentred/operator/divOperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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<fvcc::SurfaceBoundary<NeoFOAM::scalar>>(mesh);

fvcc::SurfaceField<NeoFOAM::scalar> faceFlux(exec, "sf", mesh, surfaceBCs);
Expand All @@ -35,6 +37,8 @@ TEMPLATE_TEST_CASE("DivOperator", "[template]", NeoFOAM::scalar, NeoFOAM::Vector
fvcc::VolumeField<TestType> phi(exec, "sf", mesh, volumeBCs);
NeoFOAM::fill(phi.internalField(), NeoFOAM::one<TestType>::value);

auto result = NeoFOAM::Field<TestType>(exec, phi.size());

SECTION("Construct from Token" + execName)
{
NeoFOAM::Input input = NeoFOAM::TokenList({std::string("Gauss"), std::string("linear")});
Expand All @@ -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);
}
}

}

0 comments on commit 5c4f66f

Please sign in to comment.