Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
  • Sign in
O
openmc
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 70
    • Issues 70
    • List
    • Boards
    • Labels
    • Milestones
  • Merge Requests 9
    • Merge Requests 9
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Shikhar Kumar
  • openmc
  • Merge Requests
  • !773

Open
Opened Dec 19, 2016 by Shikhar Kumar@shikhark
  • Report abuse
Report abuse

Material.add_material(...) method

  • Overview 28
  • Commits 8
  • Changes 2

Created by: samuelshaner

This short PR adds an add_material(...) method to the Material object in the Python API. This method is useful when trying to homogenize multiple materials by atom percent (e.g. for the C5G7 benchmark or water/structural materials in BEAVRS) or weight percent (e.g. for the TREAT fuel/graphite blocks). The add_material(...) is structured such that it expands a given material into its constituent nuclides and adds the nuclides to the base material.

While this method is handy, there are some caveats that haven't been addressed in this PR. Since the temperature is set by material or cell, a material can only be added to another material if they have the same temperature. Also, since s(a,b) are set on a material basis, there is the possibility of a material having multiple s(a,b) for the same nuclide. I'm not sure how OpenMC treats these cases, but it doesn't appear that an error is given.

Two materials can be homogenized as follows:

fuel = openmc.Material()
fuel.set_density('g/cm3', 10.0)
fuel.add_element('U', 1.0, enrichment=2.5)
fuel.add_element('O', 2.0)

clad = openmc.Material()
clad.set_density('g/cm3', 6.55)
clad.add_element('Zr', 1.0)

fuel_clad = openmc.Material()
fuel_clad.add_material(fuel, 0.9, 'ao')
fuel_clad.add_material(clad, 0.1, 'ao')

This PR builds on PR #771

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "github/fork/samuelshaner/add-material" "origin/github/fork/samuelshaner/add-material"

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "origin/develop"
git merge --no-ff "github/fork/samuelshaner/add-material"

Step 4. Push the result of the merge to GitLab

git push origin "develop"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
2
Labels
Other Enhancement Python API
Assign labels
  • View project labels
Reference: shikhark/openmc!773