Skip to content

Commit

Permalink
[1D] Save phase name and source file in YAML output
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Oct 17, 2021
1 parent 6bf4523 commit fa008db
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/test/test_onedim.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def test_save_restore_remove_species_yaml(self):
p = 2 * ct.one_atm
Tin = 400

filename = self.test_work_path / "onedim-add-species.yaml"
filename = self.test_work_path / "onedim-remove-species.yaml"
# In Python >= 3.8, this can be replaced by the missing_ok argument
if filename.is_file():
filename.unlink()
Expand Down
4 changes: 4 additions & 0 deletions src/oneD/Boundary1D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,10 @@ AnyMap ReactingSurf1D::serialize(const double* soln) const
cov[m_sphase->speciesName(k)] = soln[k];
}
state["coverages"] = std::move(cov);

state["phase"]["name"] = m_sphase->name();
AnyValue source =m_sphase->input().getMetadata("filename");
state["phase"]["source"] = source.empty() ? "<unknown>" : source.asString();
return state;
}

Expand Down
4 changes: 4 additions & 0 deletions src/oneD/StFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,10 @@ AnyMap StFlow::serialize(const double* soln) const
}
}

state["phase"]["name"] = m_thermo->name();
AnyValue source = m_thermo->input().getMetadata("filename");
state["phase"]["source"] = source.empty() ? "<unknown>" : source.asString();

state["radiation-enabled"] = m_do_radiation;
if (m_do_radiation) {
state["radiative-heat-loss"] = m_qdotRadiation;
Expand Down

0 comments on commit fa008db

Please sign in to comment.