Add mapping for output core_transport to IMAS#2224
Conversation
|
|
||
| # pylint: disable=invalid-name,unused-argument,too-many-positional-arguments | ||
| def core_transport_to_IMAS( | ||
| torax_config: model_config.ToraxConfig, |
There was a problem hiding this comment.
I think again, the config is not used?
| return ids | ||
|
|
||
|
|
||
| def _fill_metadata(ids: ids_toplevel.IDSToplevel): |
There was a problem hiding this comment.
Is it possible to abstract the common parts of this to a function that can be used for multiple IDS?
| _fill_metadata(ids) | ||
| ids.time = times | ||
|
|
||
| model_names = ["combined", "transport_solver", "neoclassical", "anomalous"] |
There was a problem hiding this comment.
can you retrieve these from the .keys() defined above?
| for idx, model_name in enumerate(model_names): | ||
| model_node = ids.model[idx] | ||
| model_node.identifier.name = model_name | ||
| model_node.identifier.index = _IMAS_MODEL_ID_TO_IDENTIFIER_INDEX.get( |
There was a problem hiding this comment.
similar comment if we actually need the index
| model_name, 0 | ||
| ) | ||
|
|
||
| if model_name == "anomalous": |
There was a problem hiding this comment.
discussed to only fill in the turbulent transport models in the anomalous field here
| """Fills metadata in-place for the core_transport IDS.""" | ||
| ids.ids_properties.comment = ( | ||
| "IDS built from TORAX simulation transport coefficients. Grid based on " | ||
| "TORAX cell grid + boundaries." |
There was a problem hiding this comment.
similar comment to core_sources, probably best to output quantities on face grid here (as that's where TORAX transport coefficients are computed)
| ] | ||
| if non_constant_names: | ||
| model_node.code.name = "+".join(non_constant_names) | ||
| elif not model_name == "constant": |
There was a problem hiding this comment.
should this be transport_cfg.model_name?
| from torax._src.output_tools import post_processing | ||
| from torax._src.torax_pydantic import model_config | ||
|
|
||
| _IMAS_MODEL_ID_TO_IDENTIFIER_INDEX = { |
There was a problem hiding this comment.
the values of this mapping are not used, does it need to be a mapping?
|
|
||
| model_node.profiles_1d.resize(len(times)) | ||
|
|
||
| for i in range(len(times)): |
There was a problem hiding this comment.
you can use enumerate here to get i and the t
No description provided.