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

General JSON reading and using in Functions/matprop/etc #25058

Open
GiudGiud opened this issue Jul 30, 2023 · 1 comment
Open

General JSON reading and using in Functions/matprop/etc #25058

GiudGiud opened this issue Jul 30, 2023 · 1 comment
Labels
C: Framework T: task An enhancement to the software.

Comments

@GiudGiud
Copy link
Contributor

GiudGiud commented Jul 30, 2023

Reason

As discussed in: RemDelaporteMathurin/h-transport-materials#108
we would like to be able to read coefficients from JSON databases. This is in support of T propagation modelling efforts in TMAP8, but is a very general need. We can have users store data in JSON format in a lot of different applications. in fact, there's already been some JSON loading use there: #20851

@simopier @cticenhour for info

Design

@dschwen if you could please advise us here considering your work on #20851

I would suggest following the PropertyFileReader design:

  • Add a JSON reader user object that reads the file and has all the getters desired with some checks on sizes etc
  • HEAVILY rely on nlohmann::json there
  • this enables us to read the file only once and retrieve it from multiple objects
  • a suite of FromJSON objects that can use it. The first and most-needed is a material property, but we could add a functor material too

Impact

Standardised JSON reading from the input file will provide more flexibility to users
Ease of use for others, not just CSV supported
Can help interfacing with other codes as well

@GiudGiud GiudGiud added C: Framework T: task An enhancement to the software. labels Jul 30, 2023
@dschwen
Copy link
Member

dschwen commented Jul 31, 2023

Not sure how much we'd need in addition to nlohmann::json. You might want to read the JSON file only on rank 0 and use MPI to broadcast the JSON tree to other ranks. There isn't any size checking that would be applicable here. If you want something along schema checking then use https://json-schema.org/ with a validator library.

GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 24, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 25, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 25, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 25, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Sep 25, 2023
GiudGiud added a commit to GiudGiud/moose that referenced this issue Oct 13, 2023
Add more explanation to the error message
refs idaholab#25058
tanoret pushed a commit to tanoret/moose that referenced this issue Oct 16, 2023
Add more explanation to the error message
refs idaholab#25058
oanaoana pushed a commit to oanaoana/moose that referenced this issue Oct 19, 2023
oanaoana pushed a commit to oanaoana/moose that referenced this issue Oct 19, 2023
oanaoana pushed a commit to oanaoana/moose that referenced this issue Oct 19, 2023
oanaoana pushed a commit to oanaoana/moose that referenced this issue Oct 19, 2023
lynnmunday pushed a commit to zachmprince/moose that referenced this issue Nov 6, 2023
Add more explanation to the error message
refs idaholab#25058
oanaoana pushed a commit to oanaoana/moose that referenced this issue Nov 7, 2023
oanaoana pushed a commit to oanaoana/moose that referenced this issue Nov 7, 2023
oanaoana pushed a commit to oanaoana/moose that referenced this issue Nov 7, 2023
oanaoana pushed a commit to oanaoana/moose that referenced this issue Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Framework T: task An enhancement to the software.
Projects
None yet
Development

No branches or pull requests

2 participants