From 2b1cd6fe95299457277b541ebe57a7172443ac77 Mon Sep 17 00:00:00 2001 From: marioalexis Date: Sun, 2 Mar 2025 09:57:55 -0300 Subject: [PATCH] Fem: Fix Elmer magnetodynamic boundary condition keyword --- .../elmer/equations/magnetodynamic_writer.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py index d5c32e7d28..479cdfcfb9 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py +++ b/src/Mod/Fem/femsolver/elmer/equations/magnetodynamic_writer.py @@ -276,16 +276,13 @@ class MgDynwriter: self.write.handled(obj) def _outputMagnetodynamicBndConditions(self, obj, name, equation): - if hasattr(obj, "CurrentDensity_re_1"): - # output only if current density is enabled and needed - if not obj.CurrentDensity_re_1_Disabled: - currentDensity = float(obj.CurrentDensity_re_1.getValueAs("A/m^2")) - self.write.boundary(name, "Current Density 1", round(currentDensity, 6)) + if femutils.is_derived_from(obj, "Fem::ConstraintCurrentDensity") and obj.Mode == "Normal": + currentDensity = float(obj.NormalCurrentDensity_re.getValueAs("A/m^2")) + self.write.boundary(name, "Electric Current Density", round(currentDensity, 6)) # imaginaries are only needed for harmonic equation if equation.IsHarmonic: - if not obj.CurrentDensity_im_1_Disabled: - currentDensity = float(obj.CurrentDensity_im_1.getValueAs("A/m^2")) - self.write.boundary(name, "Current Density Im 1", round(currentDensity, 6)) + currentDensity = float(obj.NormalCurrentDensity_im.getValueAs("A/m^2")) + self.write.boundary(name, "Electric Current Density Im", round(currentDensity, 6)) if femutils.is_derived_from(obj, "Fem::ConstraintElectrostaticPotential"): if obj.EnableAV: