You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following issues have been identified in the context of Maxwell transient analysis using PyAEDT:
Time Variable Associated with Field Plots
In addition to the time variable used in Maxwell Transient Analysis, field plots contain their own time variable.
Currently, this field plot time variable cannot be directly modified through PyAEDT.
Conflict with Script Variables
It is possible to modify the field plot time variable using script variables.
However, in such cases, the variables managed internally by PyAEDT are not updated, resulting in inconsistencies between the internal state and the time variable of the field plots.
Time Variables Distributed Across Plots
Each plot has its own individual time variable, which complicates the post-process workflow for transient analysis and makes it difficult to manage efficiently.
Requests and Proposals
Enhancement of PyAEDT Functions
We request the addition of functions or options in PyAEDT to directly modify the time variables used for post-processing.
This improvement would resolve inconsistencies between internal states and external operations, enabling more efficient analysis and post-processing.
Unified Management Policy for Plots
To address the issue of time variables being distributed across plots, we propose the introduction of a shared time variable that can be modified collectively.
The following is a sample code snippet that demonstrates the current method of modifying plot times using script functions. However, the internal time variable in PyAEDT is not updated:
# -*- coding: utf-8 -*-
import os
import csv
from pyaedt import Maxwell3d
from pyaedt import constants
# Specify the path to the AEDT project
aedt_file_path = r"C:\work2\demo\pyaedt_training\test_Project1mm_24R2.aedt"
print("aedt_file_is_successfully_read")
# Open the project using PyAEDT's Maxwell3D
m3d = Maxwell3d(projectname=aedt_file_path, specified_version="2024.2", non_graphical=False)
# Do Transient analysis
m3d.analyze(setup='Setup1')
# Set up for post processing
sol = m3d.post.reports_by_category.fields(setup=m3d.nominal_sweep)
data = sol.get_solution_data()
time_steps = data.intrinsics["Time"] # these are each time step of your transient analysis
print("time_step list is {}".format(time_steps))
print("read time steps")
# For each time step create a field plot (in this case a field plot surface)
# And export it as an image (here is exported as a jpg but you can export it as an aedtplt file too).
try:
# Make field plot
p1 = m3d.post.create_fieldplot_volume(
assignment=["Box11"],
quantity="J_Vector",
setup='Transient',
plot_name="my_plot1",
intrinsics= {'Time':'0.0s'},
field_type='Fields'
)
for time_step in time_steps:
# Set time
t = constants.unit_converter(
time_step,
unit_system="Time",
input_units=data.units_sweeps["Time"],
output_units="s",
)
print("Success to convert unit")
# change fields display
m3d.post.ofieldsreporter.SetPlotsViewSolutionContext(["my_plot1"],
"Setup1 : Transient",
"Time={}s".format(t))
print("Time is {}".format(t))
print("Create Fields Plot!")
# Construct the file name with the time step (ns) in it
file_name = "plot_{}ns_test.png".format(t)
print("file name is {} set".format(t))
# Export image
p1.export_image(
full_path=file_name,
selections=["Box11"]
)
print("{}ns png file is made".format(t))
# Save the AEDT project and release PyAEDT session
except Exception as e:
# Print error message if something goes wrong
print(f"An error occurred: {e}")
finally:
# Always save the project and release the desktop session even if an error occurs
m3d.save_project()
m3d.release_desktop()
The text was updated successfully, but these errors were encountered:
ShinsukeOkayasu
changed the title
Can not change Maxwell transient analysis time from pyaedt function
Can not change Maxwell transient field plot time from pyaedt function
Dec 27, 2024
The following issues have been identified in the context of Maxwell transient analysis using PyAEDT:
Time Variable Associated with Field Plots
Conflict with Script Variables
Time Variables Distributed Across Plots
Requests and Proposals
Enhancement of PyAEDT Functions
Unified Management Policy for Plots
The following is a sample code snippet that demonstrates the current method of modifying plot times using script functions. However, the internal time variable in PyAEDT is not updated:
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
Change fields display
m3d.post.ofieldsreporter.SetPlotsViewSolutionContext(["my_plot1"],
"Setup1 : Transient",
"Time={}s".format(t))
ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー
-Whole sample script-
The text was updated successfully, but these errors were encountered: