idaholab / MontePy

MontePy is the most user friendly Python library (API) to read, edit, and write MCNP input files.
https://www.montepy.org/
MIT License
32 stars 6 forks source link

Introduce concept of Submaterials #535

Open MicahGale opened 2 months ago

MicahGale commented 2 months ago

Speaking to @dodu94 this concept came up.

Sometimes users will create "mixtures" in a material definition. e.g.,

c water and boric acid
m1 
c water
     1001.80c 0.66665
     8016.80c 0.3300
c boric acid
     1001.80c 3e-6
     8016.80c 3e-6
     5010.80c 1e-6

So sometimes it would be helpful to be able to isolate these separate constituents of the material mixture.

The main question is what condition should distinguish a submaterial, @dodu94?

I think you really only have two options:

  1. Create a new submaterial with any "splitting comment"
  2. Create some sort of comment syntax (à la #344). Personally I think this is a risky approach, and I am very hesitant to introduce anything along these lines.
dodu94 commented 2 months ago

The example you are showing is the approach I am taking but I recognize that this cannot be implemented in a general parser such as montepy. I guess the only two valid options are either not supporting sub-materials or going for a special montepy comment syntax

MicahGale commented 2 months ago

I think we just made the sub materials for any comment and named them according to the comment that would work. No customer syntax. If the user wants to use it is there, and they can tweak their comments accordingly. Otherwise it would be just be a normal material.