Repository navigation
Conversation
Adding `sigma`, `epsilon`, or `mu` (or the LLG `mag_Ms_*`, `mag_alpha_*`, `mag_exchange_*`, `mag_anisotropy_*` fields) to `fields_to_plot` segfaults when `algo.em_solver_medium` is not `macroscopic`. The crash happens in `FullDiagnostics::InitializeFieldFunctors`, where `MacroscopicProperties` returns null MultiFab pointers because the material properties were never initialized. `Diagnostics::BaseReadParameters` already has asserts meant to catch this with a clear message. They never fire because they check `m_varnames`, which is still empty at that point. It only gets filled from `m_varnames_fields` later in the same function. The seven checks now look at `m_varnames_fields` instead of `m_varnames`, matching the existing check for `G` just above them. - With `algo.em_solver_medium = vacuum` and `sigma` in `fields_to_plot`: before, a segfault; after, the run stops with `sigma in plotfiles only works with algo.em_solver_medium=macroscopic`. - With `algo.em_solver_medium = macroscopic`: `sigma`, `epsilon`, and `mu` are still written correctly, with and without LLG and when restarting from a checkpoint.
ajnonaka
merged commit Nov 9, 2026
5404b36
into
AMReX-Microelectronics:development
10 of 15 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #113.
Problem
Adding
sigma,epsilon, ormu(or the LLGmag_Ms_*,mag_alpha_*,mag_exchange_*,mag_anisotropy_*fields) tofields_to_plotsegfaults whenalgo.em_solver_mediumis notmacroscopic. The crash happens inFullDiagnostics::InitializeFieldFunctors, whereMacroscopicPropertiesreturns null MultiFab pointers because the material properties were never initialized.Diagnostics::BaseReadParametersalready has asserts meant to catch this with a clear message. They never fire because they checkm_varnames, which is still empty at that point. It only gets filled fromm_varnames_fieldslater in the same function.Fix
The seven checks now look at
m_varnames_fieldsinstead ofm_varnames, matching the existing check forGjust above them.Testing
algo.em_solver_medium = vacuumandsigmainfields_to_plot: before, a segfault; after, the run stops withsigma in plotfiles only works with algo.em_solver_medium=macroscopic.algo.em_solver_medium = macroscopic:sigma,epsilon, andmuare still written correctly, with and without LLG and when restarting from a checkpoint.