Skip to content

Commit

Permalink
Do not penalize perimeter
Browse files Browse the repository at this point in the history
  • Loading branch information
cbritopacheco committed Nov 9, 2023
1 parent 0698440 commit cce88cf
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions examples/BoundaryOptimization/BoundaryHeatConductivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static constexpr Geometry::Attribute GammaN = 2;
static constexpr Geometry::Attribute SigmaD = 3;
static constexpr Geometry::Attribute SigmaN = 2;

static constexpr size_t maxIt = 1000;
static constexpr size_t maxIt = 10000;

static constexpr Scalar epsilon = 0.001;
static constexpr Scalar ell = 5;
Expand Down Expand Up @@ -109,7 +109,7 @@ int main(int, char**)
return Integral(u).compute() + ell * Omega.getPerimeter(GammaD);
};

std::ofstream fObj("obj.txt");
std::ofstream fObj("obj4.txt");
size_t i = 0;
size_t prevRegionCount = 0;
while (i < maxIt)
Expand Down Expand Up @@ -220,7 +220,7 @@ int main(int, char**)
conormal.stableNormalize();

Alert::Info() << "Computing shape gradient..." << Alert::Raise;
auto hadamard = 1. / (epsilon * epsilon) * u.getSolution() * p.getSolution() + ell * Div(conormal).traceOf(GammaD);
auto hadamard = 1. / (epsilon * epsilon) * u.getSolution() * p.getSolution() + ell;
TrialFunction theta(dsfes);
TestFunction w(dsfes);
Problem hilbert(theta, w);
Expand All @@ -236,13 +236,10 @@ int main(int, char**)
norm = Frobenius(grad);
grad /= norm.max();

grad.save("grad.gf");
dOmega.save("grad.mesh");

Alert::Info() << "Advecting the distance function." << Alert::Raise;
MMG::Advect(dist, grad).step(dt);

if (i < 70)
if (true)
{
Alert::Info() << "Computing topological sensitivity..." << Alert::Raise;
GridFunction topo(dsfes);
Expand Down Expand Up @@ -304,9 +301,9 @@ int main(int, char**)
}

Alert::Info() << "Saving files..." << Alert::Raise;
Omega.save("Omega.mesh", IO::FileFormat::MEDIT);
dOmega.save("out/dOmega." + std::to_string(i) + ".mesh", IO::FileFormat::MEDIT);
dOmega.save("out/dOmega.mfem." + std::to_string(i) + ".mesh", IO::FileFormat::MFEM);
Omega.save("Omega4.mesh", IO::FileFormat::MEDIT);
dOmega.save("out4/dOmega." + std::to_string(i) + ".mesh", IO::FileFormat::MEDIT);
dOmega.save("out4/dOmega.mfem." + std::to_string(i) + ".mesh", IO::FileFormat::MFEM);

Alert::Success() << "Completed Iteration: " << i << '\n' << Alert::Raise;
i++;
Expand Down

0 comments on commit cce88cf

Please sign in to comment.