diff --git a/kernel/include/Coefficients/AxiCylindricalCoefficient.hpp b/kernel/include/Coefficients/AxiCylindricalCoefficient.hpp
new file mode 100644
index 00000000..9c19afc2
--- /dev/null
+++ b/kernel/include/Coefficients/AxiCylindricalCoefficient.hpp
@@ -0,0 +1,43 @@
+/**
+ * @file AxiCylindricalCoefficient.hpp
+ * @author Clément Introïni (clement.introini@cea.fr)
+ * @brief Built a MFEM Coefficient for AxiCylindricalCoefficient
+ * @version 0.1
+ * @date 2026-06-16
+ *
+ * @copyright CEA (C) 2026
+ *
+ * This file is part of SLOTH.
+ *
+ * SLOTH is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SLOTH is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see .
+ *
+ */
+#pragma once
+#include
+#include
+#include
+#include
+
+#include "Coefficients/Coefficients.hpp"
+#include "mfem.hpp" // NOLINT [no include the directory when naming mfem include file]
+
+class AxiCylindricalCoefficient : public mfem::Coefficient {
+ private:
+ mutable mfem::Vector transip;
+
+ public:
+ AxiCylindricalCoefficient();
+
+ mfem::real_t Eval(mfem::ElementTransformation& T, const mfem::IntegrationPoint& ip) override;
+};
\ No newline at end of file
diff --git a/kernel/include/Coefficients/Coefficients.hpp b/kernel/include/Coefficients/Coefficients.hpp
index f311ace2..eb1a70a2 100644
--- a/kernel/include/Coefficients/Coefficients.hpp
+++ b/kernel/include/Coefficients/Coefficients.hpp
@@ -62,8 +62,9 @@ class Coefficients {
void add(Coefficient coef);
std::vector getCoefficients() const;
- size_t size() noexcept;
- Coefficient operator[](size_t i);
+ size_t size() const noexcept;
+ Coefficient& operator[](size_t i);
+ const Coefficient& operator[](size_t i) const;
std::vector get_types() const;
diff --git a/kernel/include/Coefficients/ListCoefficients.hpp b/kernel/include/Coefficients/ListCoefficients.hpp
index 1e67edd3..774d06fb 100644
--- a/kernel/include/Coefficients/ListCoefficients.hpp
+++ b/kernel/include/Coefficients/ListCoefficients.hpp
@@ -25,6 +25,7 @@
*/
#pragma once
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Coefficients/CommonCoefficients.hpp"
#include "Coefficients/ProductFunctionCoefficients.hpp"
#include "Coefficients/SumFunctionCoefficients.hpp"
diff --git a/kernel/include/Coefficients/SlothBaseCoefficient.hpp b/kernel/include/Coefficients/SlothBaseCoefficient.hpp
index 58c74029..2d06a7e8 100644
--- a/kernel/include/Coefficients/SlothBaseCoefficient.hpp
+++ b/kernel/include/Coefficients/SlothBaseCoefficient.hpp
@@ -117,5 +117,5 @@ class SlothBaseCoefficient {
void set_time(double time);
void set_bdr_index_coef(std::vector ids);
- std::vector get_bdr_index_coef();
+ std::vector get_bdr_index_coef() const;
};
diff --git a/kernel/include/Integrators/AllenCahnNLFormIntegrator.hpp b/kernel/include/Integrators/AllenCahnNLFormIntegrator.hpp
index 087b5894..d97dc869 100644
--- a/kernel/include/Integrators/AllenCahnNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/AllenCahnNLFormIntegrator.hpp
@@ -72,7 +72,7 @@ class AllenCahnNLFormIntegrator : public SlothNLFormIntegrator {
public:
void init() override;
- AllenCahnNLFormIntegrator(const std::vector& u_old,
+ AllenCahnNLFormIntegrator(Geometry geometry, const std::vector& u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/AllenCahnNLFormIntegrator.tpp b/kernel/include/Integrators/AllenCahnNLFormIntegrator.tpp
index 546f219a..ee9286d3 100644
--- a/kernel/include/Integrators/AllenCahnNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/AllenCahnNLFormIntegrator.tpp
@@ -33,6 +33,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Coefficients/SlothBaseCoefficient.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "MAToolsProfiling/MATimersAPI.hxx"
@@ -60,10 +61,10 @@
*/
template
AllenCahnNLFormIntegrator::AllenCahnNLFormIntegrator(
- const std::vector& u_old,
+ Geometry geometry, const std::vector& u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : SlothNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : SlothNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->integrator_name_ = "AllenCahn";
this->check_variables_consistency();
@@ -167,15 +168,21 @@ void AllenCahnNLFormIntegrator::AssembleElementVector(
std::span(vaux_gf_at_ip));
const double lamb = this->compute_coefficient(lambda[blk], std::span(u_values),
std::span(vaux_gf_at_ip));
- gradU *= coef_mobi * lamb * ip.weight * Tr.Weight();
- ;
+
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
+ gradU *= coef_mobi * lamb * weight_coef;
+
gradPsi.AddMult(gradU, *elvect[blk]);
// Given u, compute (w'(u), psi), psi is shape function
double ww = coef_mobi * this->compute_gradient_energy_coefficient(
double_well_energy[blk], blk, std::span(u_values),
std::span(vaux_gf_at_ip));
- ww *= ip.weight * Tr.Weight();
+ ww *= weight_coef;
add(*elvect[blk], ww, Psi, *elvect[blk]);
}
}
@@ -246,7 +253,12 @@ void AllenCahnNLFormIntegrator::AssembleElementGrad(
const double lamb = this->compute_coefficient(lambda[blk], std::span(u_values),
std::span(vaux_gf_at_ip));
- const double mob_lamb = coef_mobi * lamb * ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
+ const double mob_lamb = coef_mobi * lamb * weight_coef;
AddMult_a_AAt(mob_lamb, gradPsi, *elmats(blk, blk));
// Compute w'(u)*(du,psi), psi is shape function ( // w''(u))
@@ -254,7 +266,7 @@ void AllenCahnNLFormIntegrator::AssembleElementGrad(
coef_mobi * this->compute_hessian_coefficient(double_well_energy[blk], blk, blk,
std::span(u_values),
std::span(vaux_gf_at_ip));
- fun_val *= ip.weight * Tr.Weight();
+ fun_val *= weight_coef;
AddMult_a_VVt(fun_val, Psi, *elmats(blk, blk)); // w'(u)*(du, psi)
}
@@ -286,7 +298,12 @@ void AllenCahnNLFormIntegrator::AssembleElementGrad(
coef_mobi * this->compute_hessian_coefficient(double_well_energy[jblk], blk, jblk,
std::span(u_values),
std::span(vaux_gf_at_ip));
- fun_val *= ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
+ fun_val *= weight_coef;
AddMult_a_VVt(fun_val, Psi, *elmats(blk, jblk));
}
}
@@ -316,7 +333,13 @@ void AllenCahnNLFormIntegrator::AssembleElementGrad(
coef_mobi * this->compute_hessian_coefficient(double_well_energy[jblk], blk, jblk,
std::span(u_values),
std::span(vaux_gf_at_ip));
- fun_val *= ip.weight * Tr.Weight();
+
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
+ fun_val *= weight_coef;
AddMult_a_VVt(fun_val, Psi, *elmats(blk, jblk));
}
}
diff --git a/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.hpp b/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.hpp
index 36f4e480..5015ed7a 100644
--- a/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.hpp
@@ -65,7 +65,7 @@ class BlockAllenCahnNLFormIntegrator : public SlothNLFormIntegrator {
public:
void init() override;
- BlockAllenCahnNLFormIntegrator(const std::vector& u_old,
+ BlockAllenCahnNLFormIntegrator(Geometry geometry, const std::vector& u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.tpp b/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.tpp
index 9d7b913c..d7464ca8 100644
--- a/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/BlockAllenCahnNLFormIntegrator.tpp
@@ -32,6 +32,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Coefficients/SlothBaseCoefficient.hpp"
#include "Integrators/SlothGridFunction.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
@@ -59,10 +60,10 @@
*/
template
BlockAllenCahnNLFormIntegrator::BlockAllenCahnNLFormIntegrator(
- const std::vector& u_old,
+ Geometry geometry, const std::vector& u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : SlothNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : SlothNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->check_variables_consistency();
}
@@ -163,18 +164,23 @@ void BlockAllenCahnNLFormIntegrator::AssembleElementVector(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
- const double xx = ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
el[blk]->CalcPhysDShape(Tr, gradPsi);
gradPsi.MultTranspose(*elfun[blk], gradU);
- gradU *= xx * this->compute_coefficient(lambda[blk], std::span(u_values),
- std::span(vaux_gf_at_ip));
+ gradU *=
+ weight_coef * this->compute_coefficient(lambda[blk], std::span(u_values),
+ std::span(vaux_gf_at_ip));
gradPsi.AddMult(gradU, *elvect[blk]);
const double ww =
- xx * (eta + this->compute_gradient_energy_coefficient(
- double_well_energy[blk], blk, std::span(u_values),
- std::span(vaux_gf_at_ip)));
+ weight_coef * (eta + this->compute_gradient_energy_coefficient(
+ double_well_energy[blk], blk, std::span(u_values),
+ std::span(vaux_gf_at_ip)));
add(*elvect[blk], ww, Psi, *elvect[blk]);
}
@@ -212,10 +218,15 @@ void BlockAllenCahnNLFormIntegrator::AssembleElementVector(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
const double coef_mob =
this->compute_coefficient(mobility[blk], std::span(u_values),
std::span(vaux_gf_at_ip)) *
- ip.weight * Tr.Weight();
+ weight_coef;
const double ww = -coef_mob * eta;
@@ -281,18 +292,22 @@ void BlockAllenCahnNLFormIntegrator::AssembleElementGrad(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
- const double xx = ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
el[blk]->CalcPhysDShape(Tr, gradPsi);
const double coef_lambda = this->compute_coefficient(
lambda[blk], std::span(u_values), std::span(vaux_gf_at_ip));
- AddMult_a_AAt(xx * coef_lambda, gradPsi, *elmats(blk, blk));
+ AddMult_a_AAt(weight_coef * coef_lambda, gradPsi, *elmats(blk, blk));
double fun_val =
- xx * this->compute_hessian_coefficient(double_well_energy[blk], blk, blk,
- std::span(u_values),
- std::span(vaux_gf_at_ip));
+ weight_coef * this->compute_hessian_coefficient(double_well_energy[blk], blk, blk,
+ std::span(u_values),
+ std::span(vaux_gf_at_ip));
AddMult_a_VVt(fun_val, Psi, *elmats(blk, blk));
}
}
@@ -318,8 +333,11 @@ void BlockAllenCahnNLFormIntegrator::AssembleElementGrad(
el[blk]->CalcShape(ip, Psi);
Tr.SetIntPoint(&ip);
- double ww = ip.weight * Tr.Weight();
- AddMult_a_VVt(ww, Psi, *elmats(blk, off_blk));
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+ AddMult_a_VVt(weight_coef, Psi, *elmats(blk, off_blk));
}
}
// Block 1 0 dR(eta)dphi=d(M eta )/dphi
@@ -368,10 +386,16 @@ void BlockAllenCahnNLFormIntegrator::AssembleElementGrad(
u_values[off_blk] = (*elfun[off_blk]) * Psi;
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
+
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
const double coef_mob =
-this->compute_coefficient(mobility[blk], std::span(u_values),
std::span(vaux_gf_at_ip)) *
- ip.weight * Tr.Weight();
+ weight_coef;
AddMult_a_VVt(coef_mob, Psi, *elmats(blk, blk));
}
diff --git a/kernel/include/Integrators/CahnHilliardNLFormIntegrator.hpp b/kernel/include/Integrators/CahnHilliardNLFormIntegrator.hpp
index b069a0b4..1265d7a3 100644
--- a/kernel/include/Integrators/CahnHilliardNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/CahnHilliardNLFormIntegrator.hpp
@@ -66,7 +66,7 @@ class CahnHilliardNLFormIntegrator : public SlothNLFormIntegrator {
public:
void init() override;
- CahnHilliardNLFormIntegrator(const std::vector& u_old,
+ CahnHilliardNLFormIntegrator(Geometry geometry, const std::vector& u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/CahnHilliardNLFormIntegrator.tpp b/kernel/include/Integrators/CahnHilliardNLFormIntegrator.tpp
index e19b0b57..85bab459 100644
--- a/kernel/include/Integrators/CahnHilliardNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/CahnHilliardNLFormIntegrator.tpp
@@ -31,6 +31,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Coefficients/SlothBaseCoefficient.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "MAToolsProfiling/MATimersAPI.hxx"
@@ -57,10 +58,10 @@
*/
template
CahnHilliardNLFormIntegrator::CahnHilliardNLFormIntegrator(
- const std::vector& u_old,
+ Geometry geometry, const std::vector& u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : SlothNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : SlothNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->integrator_name_ = "CahnHilliard";
this->check_variables_consistency();
}
@@ -194,19 +195,23 @@ void CahnHilliardNLFormIntegrator::AssembleElementVector(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
- const double xx = ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
el[blk]->CalcPhysDShape(Tr, gradPsi);
gradPsi.MultTranspose(*elfun[blk], gradU);
- gradU *= -xx * this->compute_coefficient(lambda[blk], std::span(u_values),
- std::span(vaux_gf_at_ip));
+ gradU *=
+ -weight_coef * this->compute_coefficient(lambda[blk], std::span(u_values),
+ std::span(vaux_gf_at_ip));
gradPsi.AddMult(gradU, *elvect[blk]);
// Given u, compute (w'(u), psi), psi is shape function
const double ww =
- xx * (mu - this->compute_gradient_energy_coefficient(
- double_well_energy[blk], blk, std::span(u_values),
- std::span(vaux_gf_at_ip)));
+ weight_coef * (mu - this->compute_gradient_energy_coefficient(
+ double_well_energy[blk], blk, std::span(u_values),
+ std::span(vaux_gf_at_ip)));
add(*elvect[blk], ww, Psi, *elvect[blk]);
}
@@ -243,11 +248,16 @@ void CahnHilliardNLFormIntegrator::AssembleElementVector(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
el[blk]->CalcPhysDShape(Tr, gradPsi);
gradPsi.MultTranspose(*elfun[blk], gradU);
gradU *= this->compute_coefficient(mobility[blk], std::span(u_values),
std::span(vaux_gf_at_ip)) *
- ip.weight * Tr.Weight();
+ weight_coef;
gradPsi.AddMult(gradU, *elvect[blk]);
}
}
@@ -312,19 +322,22 @@ void CahnHilliardNLFormIntegrator::AssembleElementGrad(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
- const double xx = -ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
el[blk]->CalcPhysDShape(Tr, gradPsi);
const double coef_lambda = this->compute_coefficient(
lambda[blk], std::span(u_values), std::span(vaux_gf_at_ip));
- AddMult_a_AAt(xx * coef_lambda, gradPsi, *elmats(blk, blk));
+ AddMult_a_AAt(-weight_coef * coef_lambda, gradPsi, *elmats(blk, blk));
double fun_val =
- xx * this->compute_hessian_coefficient(double_well_energy[blk], blk, blk,
- std::span(u_values),
- std::span(vaux_gf_at_ip));
+ -weight_coef * this->compute_hessian_coefficient(double_well_energy[blk], blk, blk,
+ std::span(u_values),
+ std::span(vaux_gf_at_ip));
AddMult_a_VVt(fun_val, Psi, *elmats(blk, blk));
}
}
@@ -350,8 +363,12 @@ void CahnHilliardNLFormIntegrator::AssembleElementGrad(
el[blk]->CalcShape(ip, Psi);
Tr.SetIntPoint(&ip);
- double ww = ip.weight * Tr.Weight();
- AddMult_a_VVt(ww, Psi, *elmats(blk, off_blk));
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
+ AddMult_a_VVt(weight_coef, Psi, *elmats(blk, off_blk));
}
}
// Block 1 0 dR(mu)dphi=d(div M grad mu)/dphi
@@ -401,10 +418,15 @@ void CahnHilliardNLFormIntegrator::AssembleElementGrad(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
const double coef_mob =
this->compute_coefficient(mobility[blk], std::span(u_values),
std::span(vaux_gf_at_ip)) *
- ip.weight * Tr.Weight();
+ weight_coef;
el[blk]->CalcPhysDShape(Tr, gradPsi);
AddMult_a_AAt(coef_mob, gradPsi, *elmats(blk, blk));
diff --git a/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.hpp b/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.hpp
index 792f4045..0b3065e0 100644
--- a/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.hpp
@@ -72,7 +72,7 @@ class DiffusionFluxNLFormIntegrator : public SlothNLFormIntegrator {
void init() override;
public:
- DiffusionFluxNLFormIntegrator(const std::vector& u_old,
+ DiffusionFluxNLFormIntegrator(Geometry geometry, const std::vector& u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.tpp b/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.tpp
index 83f81919..b21f80a3 100644
--- a/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/DiffusionFluxNLFormIntegrator.tpp
@@ -32,6 +32,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Coefficients/SlothBaseCoefficient.hpp"
#include "Integrators/SlothGridFunction.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
@@ -80,10 +81,10 @@ void DiffusionFluxNLFormIntegrator::get_coefficients() {
*/
template
DiffusionFluxNLFormIntegrator::DiffusionFluxNLFormIntegrator(
- const std::vector& u_old,
+ Geometry geometry, const std::vector& u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : SlothNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : SlothNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->expected_list_.push_back(GlossaryType::Diffusivity);
}
@@ -186,8 +187,11 @@ void DiffusionFluxNLFormIntegrator::AssembleElementVector(
// Diffusion flux (see child classes)
this->add_diffusion_flux(Tr, nElement, ip, dim);
-
- this->Flux_ *= ip.weight * Tr.Weight();
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+ this->Flux_ *= weight_coef;
this->gradPsi.AddMult(this->Flux_, *elvect[blk], 1.0);
}
@@ -248,10 +252,16 @@ void DiffusionFluxNLFormIntegrator::AssembleElementGrad(
}
Tr.SetIntPoint(&ip);
+
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
const double coeff_diffu =
this->compute_coefficient(stab_diffusion[blk], std::span(u_values),
std::span(vaux_gf_at_ip)) *
- ip.weight * Tr.Weight();
+ weight_coef;
el[blk]->CalcPhysDShape(Tr, gradPsi);
AddMult_a_AAt(coeff_diffu, gradPsi, *elmat(blk, blk));
}
diff --git a/kernel/include/Integrators/DiffusionNLFormIntegrator.hpp b/kernel/include/Integrators/DiffusionNLFormIntegrator.hpp
index e84b0e4a..1adbcd3c 100644
--- a/kernel/include/Integrators/DiffusionNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/DiffusionNLFormIntegrator.hpp
@@ -59,7 +59,7 @@ class DiffusionNLFormIntegrator : public SlothNLFormIntegrator {
void init() override;
public:
- DiffusionNLFormIntegrator(const std::vector u_old,
+ DiffusionNLFormIntegrator(Geometry geometry, const std::vector u_old,
const std::vector aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/DiffusionNLFormIntegrator.tpp b/kernel/include/Integrators/DiffusionNLFormIntegrator.tpp
index 4ed7035a..8601ee8e 100644
--- a/kernel/include/Integrators/DiffusionNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/DiffusionNLFormIntegrator.tpp
@@ -32,6 +32,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Coefficients/SlothBaseCoefficient.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "Parameters/Parameter.hpp"
@@ -60,10 +61,10 @@
*/
template
DiffusionNLFormIntegrator::DiffusionNLFormIntegrator(
- const std::vector u_old,
+ Geometry geometry, const std::vector u_old,
const std::vector aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : SlothNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {}
+ : SlothNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {}
/**
* @brief Initialize the diffusion integrator.
@@ -155,7 +156,12 @@ void DiffusionNLFormIntegrator::AssembleElementVector(
gradPsi.MultTranspose(*elfun[blk], gradU);
double diffu = this->compute_coefficient(diffusion[blk], std::span(u_values),
std::span(vaux_gf_at_ip));
- const double coeff_diffu = diffu * ip.weight * Tr.Weight();
+
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+ const double coeff_diffu = diffu * weight_coef;
gradU *= coeff_diffu;
gradPsi.AddMult(gradU, *elvect[blk]);
}
@@ -227,11 +233,17 @@ void DiffusionNLFormIntegrator::AssembleElementGrad(
std::span(vaux_gf_at_ip));
el[blk]->CalcPhysDShape(Tr, gradPsi);
- AddMult_a_AAt(diffu * ip.weight * Tr.Weight(), gradPsi, *elmat(blk, blk));
+
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
+ AddMult_a_AAt(diffu * weight_coef, gradPsi, *elmat(blk, blk));
gradPsi.MultTranspose(*elfun[blk], gradU);
gradPsi.AddMult(gradU, vec);
- AddMult_a_VWt(grad_diffu * ip.weight * Tr.Weight(), Psi, vec, *elmat(blk, blk));
+ AddMult_a_VWt(grad_diffu * weight_coef, Psi, vec, *elmat(blk, blk));
}
}
}
diff --git a/kernel/include/Integrators/FickNLFormIntegrator.hpp b/kernel/include/Integrators/FickNLFormIntegrator.hpp
index 75c78f36..299346e5 100644
--- a/kernel/include/Integrators/FickNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/FickNLFormIntegrator.hpp
@@ -56,7 +56,7 @@ class FickNLFormIntegrator : public DiffusionNLFormIntegrator {
void get_coefficients() override;
public:
- FickNLFormIntegrator(const std::vector u_old,
+ FickNLFormIntegrator(Geometry geometry, const std::vector u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients);
virtual ~FickNLFormIntegrator() = default;
diff --git a/kernel/include/Integrators/FickNLFormIntegrator.tpp b/kernel/include/Integrators/FickNLFormIntegrator.tpp
index 23bcf8b1..f91120de 100644
--- a/kernel/include/Integrators/FickNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/FickNLFormIntegrator.tpp
@@ -30,6 +30,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Integrators/DiffusionNLFormIntegrator.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "Parameters/Parameter.hpp"
@@ -57,12 +58,13 @@
*
*/
template
-FickNLFormIntegrator::FickNLFormIntegrator(const std::vector u_old,
+FickNLFormIntegrator::FickNLFormIntegrator(Geometry geometry,
+ const std::vector u_old,
const std::vector& aux_old,
const Parameters& params,
std::vector auxvars,
const std::vector& coefficients)
- : DiffusionNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : DiffusionNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->integrator_name_ = "Fick";
this->expected_list_.push_back(GlossaryType::Diffusivity);
diff --git a/kernel/include/Integrators/FourierNLFormIntegrator.hpp b/kernel/include/Integrators/FourierNLFormIntegrator.hpp
index c06eb922..17a7ecad 100644
--- a/kernel/include/Integrators/FourierNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/FourierNLFormIntegrator.hpp
@@ -56,7 +56,7 @@ class FourierNLFormIntegrator : public DiffusionNLFormIntegrator {
void get_coefficients() override;
public:
- FourierNLFormIntegrator(const std::vector& u_old,
+ FourierNLFormIntegrator(Geometry geometry, const std::vector& u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/FourierNLFormIntegrator.tpp b/kernel/include/Integrators/FourierNLFormIntegrator.tpp
index 53bf38ce..cf4c386e 100644
--- a/kernel/include/Integrators/FourierNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/FourierNLFormIntegrator.tpp
@@ -30,6 +30,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Integrators/DiffusionNLFormIntegrator.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "Parameters/Parameter.hpp"
@@ -58,10 +59,10 @@
*/
template
FourierNLFormIntegrator::FourierNLFormIntegrator(
- const std::vector& u_old,
+ Geometry geometry, const std::vector& u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : DiffusionNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : DiffusionNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->integrator_name_ = "Fourier";
this->expected_list_.push_back(GlossaryType::Conductivity);
}
diff --git a/kernel/include/Integrators/HeatTimeNLFormIntegrator.hpp b/kernel/include/Integrators/HeatTimeNLFormIntegrator.hpp
index d8d6059b..55eea2c0 100644
--- a/kernel/include/Integrators/HeatTimeNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/HeatTimeNLFormIntegrator.hpp
@@ -48,7 +48,7 @@ class HeatTimeNLFormIntegrator : public TimeNLFormIntegrator {
void get_coefficients() override;
public:
- HeatTimeNLFormIntegrator(const std::vector u_old,
+ HeatTimeNLFormIntegrator(Geometry geometry, const std::vector u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/HeatTimeNLFormIntegrator.tpp b/kernel/include/Integrators/HeatTimeNLFormIntegrator.tpp
index 8c565ffc..c365ca1c 100644
--- a/kernel/include/Integrators/HeatTimeNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/HeatTimeNLFormIntegrator.tpp
@@ -29,6 +29,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "Integrators/TimeNLFormIntegrator.hpp"
#include "MAToolsProfiling/MATimersAPI.hxx"
@@ -55,10 +56,10 @@
*/
template
HeatTimeNLFormIntegrator::HeatTimeNLFormIntegrator(
- const std::vector u_old,
+ Geometry geometry, const std::vector u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : TimeNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : TimeNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->integrator_name_ = "HeatTime";
this->expected_list_.push_back(GlossaryType::Concentration);
diff --git a/kernel/include/Integrators/LatentHeatNLFormIntegrator.hpp b/kernel/include/Integrators/LatentHeatNLFormIntegrator.hpp
index 5abf3995..f3ea1e6f 100644
--- a/kernel/include/Integrators/LatentHeatNLFormIntegrator.hpp
+++ b/kernel/include/Integrators/LatentHeatNLFormIntegrator.hpp
@@ -74,7 +74,7 @@ class LatentHeatNLFormIntegrator : public SlothNLFormIntegrator {
virtual void check_variables_consistency();
public:
- LatentHeatNLFormIntegrator(const std::vector& u_old,
+ LatentHeatNLFormIntegrator(Geometry geometry, const std::vector& u_old,
const std::vector& aux_old,
const Parameters& params, std::vector auxvars,
const std::vector& coefficients);
diff --git a/kernel/include/Integrators/LatentHeatNLFormIntegrator.tpp b/kernel/include/Integrators/LatentHeatNLFormIntegrator.tpp
index 97225f84..a2ee98ab 100644
--- a/kernel/include/Integrators/LatentHeatNLFormIntegrator.tpp
+++ b/kernel/include/Integrators/LatentHeatNLFormIntegrator.tpp
@@ -33,6 +33,7 @@
#include
#include
+#include "Coefficients/AxiCylindricalCoefficient.hpp"
#include "Integrators/SlothNLFormIntegrator.hpp"
#include "MAToolsProfiling/MATimersAPI.hxx"
#include "Parameters/Parameter.hpp"
@@ -58,10 +59,10 @@
*/
template
LatentHeatNLFormIntegrator::LatentHeatNLFormIntegrator(
- const std::vector& u_old,
+ Geometry geometry, const std::vector& u_old,
const std::vector& aux_old, const Parameters& params,
std::vector auxvars, const std::vector& coefficients)
- : SlothNLFormIntegrator(u_old, aux_old, params, auxvars, coefficients) {
+ : SlothNLFormIntegrator(geometry, u_old, aux_old, params, auxvars, coefficients) {
this->integrator_name_ = "LatentHeat";
this->latent_time_step_ = this->params_.template get_param_value("latent_time_step");
this->check_variables_consistency();
@@ -144,7 +145,7 @@ void LatentHeatNLFormIntegrator::AssembleElementVector(
const mfem::Array& elvect) {
int num_blocks = el.Size();
std::vector u_values(2 * num_blocks);
- std::vector vaux_gf_at_ip(this->vaux_gf_.size());
+ std::vector vaux_gf_at_ip(2 * this->nb_vaux_);
for (int blk = 0; blk < num_blocks; ++blk) {
// Catch_Time_Section("LatentHeatNLFormIntegrator:AssembleElementVector");
int nd = el[blk]->GetDof();
@@ -164,9 +165,9 @@ void LatentHeatNLFormIntegrator::AssembleElementVector(
el[blk]->CalcShape(ip, Psi); //
Tr.SetIntPoint(&ip);
- for (size_t k = 0; k < this->vaux_gf_.size(); ++k) {
+ for (size_t k = 0; k < this->nb_vaux_; ++k) {
vaux_gf_at_ip[k] = this->vaux_gf_[k].GetValue(Tr, ip);
- vaux_gf_at_ip[k + num_blocks] = this->vaux_old_gf_[k].GetValue(Tr, ip);
+ vaux_gf_at_ip[k + this->nb_vaux_] = this->vaux_old_gf_[k].GetValue(Tr, ip);
}
// Get values
for (int off_blk = 0; off_blk < num_blocks; ++off_blk) {
@@ -174,10 +175,15 @@ void LatentHeatNLFormIntegrator::AssembleElementVector(
u_values[off_blk + num_blocks] = this->u_old_[off_blk].GetValue(Tr, ip);
}
+ double weight_coef = ip.weight * Tr.Weight();
+ if (this->isAxisymmetric()) {
+ weight_coef *= AxiCylindricalCoefficient().Eval(Tr, ip);
+ }
+
const double latent_heat =
this->get_latent_heat_at_ip(blk, std::span(u_values),
std::span(vaux_gf_at_ip)) *
- ip.weight * Tr.Weight();
+ weight_coef;
add(*elvect[blk], latent_heat, Psi, *elvect[blk]);
}
}
@@ -259,8 +265,9 @@ template
double LatentHeatNLFormIntegrator::get_latent_heat_at_ip(
[[maybe_unused]] unsigned int blk, [[maybe_unused]] const std::span& values,
[[maybe_unused]] const std::span& aux_values) {
- std::span local_auxvalues(aux_values.begin(), aux_values.begin() + this->nb_blk_);
- std::span local_auxvalues_n(aux_values.begin() + this->nb_blk_, aux_values.end());
+ std::span local_auxvalues(aux_values.begin(), aux_values.begin() + this->nb_vaux_);
+ std::span