Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor music box configuration file options #220

Open
K20shores opened this issue Aug 29, 2024 · 5 comments
Open

Refactor music box configuration file options #220

K20shores opened this issue Aug 29, 2024 · 5 comments
Assignees

Comments

@K20shores
Copy link
Collaborator

K20shores commented Aug 29, 2024

          There was a comment/question from Rebecca Buchholz at the Demo yesterday; she was sitting next to me, and you may not have heard it. She asked about using initial_conditions.csv to set the initial species concentrations instead of my_config.json.

Initialization of concentrations involves a large number of floating-point numbers, and I believe that specification would be technically better in tabular form (CSV) instead of JSON. We have a JSON mechanism to include CSV file, rather than inserting many values into the JSON configuration. The CSV file would be better for our users to manage and review.

I know that we are retaining compatibility with the Fortran MusicBox. I recommend that we move forward soon with changes that will increase CSV usage through our product suite.

Originally posted by @carl-drews in #214 (review)

Acceptance criteria

  • All existing configuration files in our examples use the new format
  • The new format is read correctly
  • Species configurations are only read from the initial conditions section
    • the initial conditions section can either be a path to a file
    • or the initial conditions section can be an in-place csv file, specified as a set of lists of lists. This is useful for music box interactive since we wouldn't need to write out csv files
  • Evolving conditions can be read from a file
    • or read directly from the csv, like the initial condition. Again, useful for music box interactive

Ideas

  • Consider supporting configuration files of these formats
{
    "box model options": {
        "grid": "box",
        "chemistry time step [sec]": 1.0,
        "output time step [sec]": 1.0,
        "simulation length [sec]": 3600.0
    },
    "evolving conditions": {
        "filepath": "evolving_conditions.csv"
    },
    "initial conditions": {
        "filepath": "initial_conditions.csv"
    },
   "mechanism confiuration" : {
       "relative file path": "camp_data/config.json"
   }
}

or, inplace conditions

{
    "box model options": {
        "grid": "box",
        "chemistry time step [sec]": 1.0,
        "output time step [sec]": 1.0,
        "simulation length [sec]": 3600.0
    },
    "evolving conditions": {
        data: [
                      ["ENV.pressure [Pa]", "ENV.temperature [K]", "PHOT.O2_1 [s-1]"],
                      [1000, 200, 0.5],
                  ]
    },
    "initial conditions": {
        data: [
                      ["ENV.temperature", "ENV.pressure", "CONC.H2O", "CONC.CH4"],
                      [1000, 200, 0.5, 1e-4],
                  ]
    },
   "mechanism confiuration" : {
       "relative file path": "camp_data/config.json"
   }
}

  • Print a warning when we detect an old configuration. tell them that it's old and provide a new command line option, maybe --update-config or --fix so that when you give music_box -c my_config.json --fix, we overwrite the old one, and maybe copy the origional to my_config.json.old
@K20shores
Copy link
Collaborator Author

K20shores commented Aug 29, 2024

Actually, we might consider storing all of the mechanism information in this file as well. That would remove the need to write any files out. We would then have to update the musica API to take json objects, but that is already a goal we have anyways so that we push all of the parsing down to musica. @mattldawson would this be a good time to do that or do you think it's too soon?

@mattldawson
Copy link
Collaborator

Actually, we might consider storing all of the mechanism information in this file as well. That would remove the need to write any files out. We would then have to update the musica API to take json objects, but that is already a goal we have anyways so that we push all of the parsing down to musica. @mattldawson would this be a good time to do that or do you think it's too soon?

I like that idea. Do we need to make any changes to the open-atmos format for this to work?

@K20shores
Copy link
Collaborator Author

@mattldawson I don't belive so. open-atmos already assume everything is in the same file. All we have to do is strip out whatever information is in the mechanism and pass it along to musica

@carl-drews
Copy link
Collaborator

Doing just CSV vs. JSON in this ticket; leave choice of solver (Rosenbrock and others) to another issue.

@K20shores
Copy link
Collaborator Author

This is also related to #260, but only indirectly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants