From dc9f9ab4c1983e4a07ea0786220349b140fb77e9 Mon Sep 17 00:00:00 2001 From: Samuel Lopez <85613111+Samuelopez-ansys@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:16:23 +0100 Subject: [PATCH] Update Transient Field plot in Maxwell 2D Transient (#815) * Exception for Maxwell 2D Transient * UnitTest updated for the method --- _unittest/test_12_PostProcessing.py | 13 +++++++++++++ examples/02-Maxwell/Maxwell2D_Transient.py | 2 +- pyaedt/modules/PostProcessor.py | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/_unittest/test_12_PostProcessing.py b/_unittest/test_12_PostProcessing.py index 17cee06e2f4..6b1ba1982af 100644 --- a/_unittest/test_12_PostProcessing.py +++ b/_unittest/test_12_PostProcessing.py @@ -211,6 +211,19 @@ def test_15_export_plot(self): ) assert os.path.exists(obj.image_file) + @pytest.mark.skipif(is_ironpython, reason="Not running in ironpython") + def test_16_create_field_plot(self): + cutlist = ["Global:XY"] + plot = self.aedtapp.post._create_fieldplot( + objlist=cutlist, + quantityName="Mag_E", + setup_name=self.aedtapp.nominal_adaptive, + intrinsincList={"Freq": "5GHz", "Phase": "0deg"}, + objtype="Surface", + listtype="CutPlane", + ) + assert plot + def test_51_get_efields(self): if is_ironpython: diff --git a/examples/02-Maxwell/Maxwell2D_Transient.py b/examples/02-Maxwell/Maxwell2D_Transient.py index 91ae5f12b44..986f2104c08 100644 --- a/examples/02-Maxwell/Maxwell2D_Transient.py +++ b/examples/02-Maxwell/Maxwell2D_Transient.py @@ -112,7 +112,7 @@ cutlist = ["Global:XY"] face_lists = rect1.faces face_lists += rect2.faces -timesteps = [str(i * 1e-3) + "s" for i in range(21)] +timesteps = [str(i * 2e-4) + "s" for i in range(11)] id_list = [f.id for f in face_lists] animatedGif = maxwell_2d.post.animate_fields_from_aedtplt_2( "Mag_B", diff --git a/pyaedt/modules/PostProcessor.py b/pyaedt/modules/PostProcessor.py index b30da8187a2..03c316b0d22 100644 --- a/pyaedt/modules/PostProcessor.py +++ b/pyaedt/modules/PostProcessor.py @@ -2316,6 +2316,8 @@ def _create_fieldplot(self, objlist, quantityName, setup_name, intrinsincList, o plot.objtype = objtype plot.listtype = listtype plt = plot.create() + if "Maxwell" in self._app.design_type and self.post_solution_type == "Transient": + self.ofieldsreporter.SetPlotsViewSolutionContext([plot_name], setup_name, "Time:" + intrinsincList["Time"]) if plt: self.field_plots[plot_name] = plot return plot