Skip to content

Commit

Permalink
FEAT: Add transient support (#4990)
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzovecchietti authored Aug 9, 2024
1 parent 837c27d commit 766e10e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 19 deletions.
Binary file added _unittest/example_models/T98/transient_fs.aedtz
Binary file not shown.
9 changes: 9 additions & 0 deletions _unittest/test_98_Icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
coldplate = "ColdPlateExample_231"
power_budget = "PB_test_231"
native_import = "one_native_component"
transient_fs = "transient_fs"

else:
coldplate = "ColdPlateExample"
Expand Down Expand Up @@ -1801,3 +1802,11 @@ def test_80_global_mesh_region(self):
g_m_r.update()
g_m_r.global_region.object.material_name = "Carbon Monoxide"
assert g_m_r.global_region.object.material_name == "Carbon Monoxide"

def test_81_transient_fs(self, add_app):
app = add_app(application=Icepak, project_name=transient_fs, subfolder=test_subfolder)
fs = app.post.create_field_summary()
for t in ["0s", "1s", "2s", "3s", "4s", "5s"]:
fs.add_calculation("Object", "Surface", "Box1", "Temperature", time=t)
df = fs.get_field_summary_data(pandas_output=True)
assert not df["Mean"].empty
36 changes: 20 additions & 16 deletions pyaedt/modules/AdvancedPostProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1085,13 +1085,7 @@ def _parse_field_summary_content(self, fs, setup_name, design_variation, quantit

@pyaedt_function_handler(faces_list="faces", quantity_name="quantity", design_variation="variation")
def evaluate_faces_quantity(
self,
faces,
quantity,
side="Default",
setup_name=None,
variations=None,
ref_temperature="",
self, faces, quantity, side="Default", setup_name=None, variations=None, ref_temperature="", time="0s"
):
"""Export the field surface output.
Expand All @@ -1111,6 +1105,8 @@ def evaluate_faces_quantity(
Dictionary of parameters defined for the specific setup with values. The default is ``{}``.
ref_temperature: str, optional
Reference temperature to use for heat transfer coefficient computation. The default is ``""``.
time : str
Timestep to get the data from. Default is ``"0s"``.
Returns
-------
Expand All @@ -1131,7 +1127,9 @@ def evaluate_faces_quantity(
facelist_name = generate_unique_name(quantity)
self._app.modeler.create_face_list(faces, facelist_name)
fs = self.create_field_summary()
fs.add_calculation("Object", "Surface", facelist_name, quantity, side=side, ref_temperature=ref_temperature)
fs.add_calculation(
"Object", "Surface", facelist_name, quantity, side=side, ref_temperature=ref_temperature, time=time
)
out = self._parse_field_summary_content(fs, setup_name, variations, quantity)
self._app.oeditor.Delete(["NAME:Selections", "Selections:=", facelist_name])
return out
Expand All @@ -1146,6 +1144,7 @@ def evaluate_boundary_quantity(
setup_name=None,
variations=None,
ref_temperature="",
time="0s",
):
"""Export the field output on a boundary.
Expand All @@ -1169,6 +1168,8 @@ def evaluate_boundary_quantity(
Dictionary of parameters defined for the specific setup with values. The default is ``{}``.
ref_temperature: str, optional
Reference temperature to use for heat transfer coefficient computation. The default is ``""``.
time : str
Timestep to get the data from. Default is ``"0s"``.
Returns
-------
Expand All @@ -1193,18 +1194,13 @@ def evaluate_boundary_quantity(
quantity,
side=side,
ref_temperature=ref_temperature,
time=time,
)
return self._parse_field_summary_content(fs, setup_name, variations, quantity)

@pyaedt_function_handler(monitor_name="monitor", quantity_name="quantity", design_variation="variations")
def evaluate_monitor_quantity(
self,
monitor,
quantity,
side="Default",
setup_name=None,
variations=None,
ref_temperature="",
self, monitor, quantity, side="Default", setup_name=None, variations=None, ref_temperature="", time="0s"
):
"""Export monitor field output.
Expand All @@ -1224,6 +1220,8 @@ def evaluate_monitor_quantity(
Dictionary of parameters defined for the specific setup with values. The default is ``{}``.
ref_temperature: str, optional
Reference temperature to use for heat transfer coefficient computation. The default is ``""``.
time : str
Timestep to get the data from. Default is ``"0s"``.
Returns
-------
Expand Down Expand Up @@ -1251,7 +1249,9 @@ def evaluate_monitor_quantity(
else:
raise AttributeError("Monitor {} is not found in the design.".format(monitor))
fs = self.create_field_summary()
fs.add_calculation("Monitor", field_type, monitor, quantity, side=side, ref_temperature=ref_temperature)
fs.add_calculation(
"Monitor", field_type, monitor, quantity, side=side, ref_temperature=ref_temperature, time=time
)
return self._parse_field_summary_content(fs, setup_name, variations, quantity)

@pyaedt_function_handler(design_variation="variations")
Expand All @@ -1264,6 +1264,7 @@ def evaluate_object_quantity(
setup_name=None,
variations=None,
ref_temperature="",
time="0s",
):
"""Export the field output on or in an object.
Expand All @@ -1285,6 +1286,8 @@ def evaluate_object_quantity(
Dictionary of parameters defined for the specific setup with values. The default is ``{}``.
ref_temperature: str, optional
Reference temperature to use for heat transfer coefficient computation. The default is ``""``.
time : str
Timestep to get the data from. Default is ``"0s"``.
Returns
-------
Expand All @@ -1310,5 +1313,6 @@ def evaluate_object_quantity(
quantity_name,
side=side,
ref_temperature=ref_temperature,
time=time,
)
return self._parse_field_summary_content(fs, setup_name, variations, quantity_name)
20 changes: 17 additions & 3 deletions pyaedt/modules/PostProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5678,6 +5678,7 @@ def add_calculation(
side="Default",
mesh="All",
ref_temperature="AmbientTemp",
time="0s",
):
"""
Add an entry in the field summary calculation requests.
Expand Down Expand Up @@ -5710,6 +5711,8 @@ def add_calculation(
ref_temperature : str, optional
Reference temperature to use in the calculation of the heat transfer
coefficient. The default is ``"AmbientTemp"``.
time : str
Timestep to get the data from. Default is ``"0s"``.
Returns
-------
Expand All @@ -5728,9 +5731,20 @@ def add_calculation(
normal = ",".join(normal)
if isinstance(geometry_name, str):
geometry_name = [geometry_name]
self.calculations.append(
[entity, geometry, ",".join(geometry_name), quantity, normal, side, mesh, ref_temperature, False]
) # TODO : last argument not documented
calc_args = [
entity,
geometry,
",".join(geometry_name),
quantity,
normal,
side,
mesh,
ref_temperature,
False,
] # TODO : last argument not documented
if self._app.solution_type == "Transient":
calc_args = [time] + calc_args
self.calculations.append(calc_args)
return True

@pyaedt_function_handler(IntrinsincDict="intrinsics", setup_name="setup", design_variation="variation")
Expand Down

0 comments on commit 766e10e

Please sign in to comment.