Skip to content

Commit 49b5cd7

Browse files
authored
Log adaptivity metrics at t = 0 (#194)
* Log adaptivity metrics at t = 0 * Add changelog entry
1 parent 7dc37b9 commit 49b5cd7

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## latest
44

5+
- Log adaptivity metrics at t=0 [#194](https://github.com/precice/micro-manager/pull/194)
56
- Use `|` delimiter in CSV files of adaptivity metrics data [#193](https://github.com/precice/micro-manager/pull/193)
67
- Add profiling sections for solving the micro simulations [commit](https://github.com/precice/micro-manager/commit/fa81f6a7e8f494a3e441fee7f70de5271ae8d83b)
78
- Fix bug in load balancing when more than one rank has as many simulations as the balancing bound [#192](https://github.com/precice/micro-manager/pull/192)

micro_manager/micro_manager.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ def solve(self) -> None:
170170
first_iteration = True
171171
first_time_window = True
172172

173+
if self._is_adaptivity_on:
174+
# Log initial adaptivity metrics
175+
self._adaptivity_controller.log_metrics(n)
176+
173177
while self._participant.is_coupling_ongoing():
174178

175179
dt = min(self._participant.get_max_time_step_size(), self._micro_dt)
@@ -281,9 +285,7 @@ def solve(self) -> None:
281285
if sim:
282286
sim.output()
283287

284-
if self._is_adaptivity_on and (
285-
n % self._adaptivity_output_n == 0 or n == 1
286-
):
288+
if self._is_adaptivity_on and (n % self._adaptivity_output_n == 0):
287289
self._adaptivity_controller.log_metrics(n)
288290

289291
if self._memory_usage_output_type and (
@@ -300,10 +302,12 @@ def solve(self) -> None:
300302
# Reset first iteration flag for the next time window
301303
first_iteration = True
302304

305+
# Final memory usage logging at the end of the simulation if not already logged at the end of the last time window
303306
if self._memory_usage_output_type and n % self._memory_usage_output_n != 0:
304307
mem_usage.append(process.memory_info().rss / 1024**2)
305308
mem_usage_n.append(n)
306309

310+
# Final adaptivity metrics logging at the end of the simulation if not already logged at the end of the last time window
307311
if self._is_adaptivity_on and n % self._adaptivity_output_n != 0:
308312
self._adaptivity_controller.log_metrics(n)
309313

0 commit comments

Comments
 (0)