-
Notifications
You must be signed in to change notification settings - Fork 660
Specify temperature from a field (structured mesh only) #3734
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
Open
JoffreyDorville
wants to merge
104
commits into
openmc-dev:develop
Choose a base branch
from
JoffreyDorville:temperate_from_mesh
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 95 commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
282ba43
First prototype for temperature field
JoffreyDorville cf19709
Clean event identifiers for history-based transport
JoffreyDorville 032275a
New particle attribute for the next event
JoffreyDorville 8a138da
Cleaning
JoffreyDorville d29e700
Common update function for the particle temperature
JoffreyDorville 2e5e0c9
Cleaning
JoffreyDorville ba02d46
Cleaning
JoffreyDorville 5c52c5f
Add temperature values during the initialization for thermal scatteri…
JoffreyDorville 06f27c7
Clean Python API
JoffreyDorville d20e3ea
Regression test
JoffreyDorville 6c9b918
Update documentation
JoffreyDorville 4b660d6
Create a main C++ ScalarField class
JoffreyDorville 3b3b32f
Check that size of mesh and size of values are consistent in the fiel…
JoffreyDorville 6dd684d
Formatting
JoffreyDorville 76cdf20
Manage incompatibility with event-based mode
JoffreyDorville 49bfb76
Unit test for the distance to next boundary method
JoffreyDorville 5e79b7b
Missing init file in new regression test
JoffreyDorville 0c67016
Formatting
JoffreyDorville 2ee8edb
First attempt to enable event-based mode
JoffreyDorville cd4443b
Revert error message for incompatibility with event-based mode
JoffreyDorville aef0709
Formatting
JoffreyDorville 091925a
Cleaning
JoffreyDorville b0b28ba
Add distance_to_next_boundary() tests for rectilinear, cylindrical, a…
JoffreyDorville d886d44
Initialize coord_ with an element to be compatible with p.r() at Part…
JoffreyDorville cf903c8
C++ unit tests for temperature fields
JoffreyDorville b1e4fee
C API interface to update temperature values in the temperature field
JoffreyDorville 68d8d9c
C API documentation update
JoffreyDorville 614564b
Remove unused function in Python API
JoffreyDorville 7bee829
Test that the number of temperature values given is consistent with t…
JoffreyDorville 78529b5
Fix XML reader
JoffreyDorville d91a64d
Define equality function for ScalarFields
JoffreyDorville 068b92b
Unit test for temperature field - Python API
JoffreyDorville 027c35c
Change fatal_error to throw
JoffreyDorville 1bd1b5c
Unit test temperature field - C++ side
JoffreyDorville 9bd31c1
Merge branch 'develop' into temperate_from_mesh
JoffreyDorville 242a842
Temporarily disable part of temperature field c++ unit tests
JoffreyDorville 967090c
Revert initialization of coord_ and declare n_coord_levels in test in…
JoffreyDorville a8ddf99
Allow c++ test to be compiled with the DAGMC flag
JoffreyDorville 3420117
Restore c++ unit test
JoffreyDorville 5ddfca2
Formatting
JoffreyDorville d73f0cf
Change where the temperature update is performed for a field
JoffreyDorville 1e104a9
Add unit test corresponding to the failing case
JoffreyDorville 5e6b409
First attempt to solve the coincidence test case
JoffreyDorville c954785
Update unit tests
JoffreyDorville 7f79940
Cleaning
JoffreyDorville d6c7a26
Cleaner minimun distance selection
JoffreyDorville 7b7c80a
More robust search of the distance to the next boundary in structured…
JoffreyDorville 6eaef71
Correction
JoffreyDorville 2c51de4
Add a new attribute to particles to store information on the next tra…
JoffreyDorville a6f6617
Refactor history-based transport to only have one cross surface event
JoffreyDorville 5e88589
Refactor event-based transport to only have one cross surface event
JoffreyDorville 3bde460
Add temperature field bin and bin next
JoffreyDorville a5f63bf
Cleaning
JoffreyDorville 7ca5f8f
Temporary function to calculate distance to a regular mesh when the p…
JoffreyDorville bcd208a
Change signature of distance_to_next_boundary to get bins information
JoffreyDorville 92271f9
Update distance_to_next_boundary
JoffreyDorville 0150a02
Remove unused functions
JoffreyDorville 2311beb
Update particle temperature after locating the new cell
JoffreyDorville e020118
Manage temperature field bins with boundary conditions
JoffreyDorville 9949c56
Clean the temperature field interface
JoffreyDorville de054db
Update DAGMC part of transport
JoffreyDorville 6a9bd74
Update field cpp unit tests
JoffreyDorville b4954d1
Update regular mesh unit test with new distance to next boundary inte…
JoffreyDorville 9cf6057
Add distance to mesh boundary from outside for rectilinear meshes
JoffreyDorville 3c9a810
Update unit tests for rectilinear meshes
JoffreyDorville 07ad591
Remove tests from features that are no longer available
JoffreyDorville d4b2140
Find the temperature field cell of secondary particles for pulse-heig…
JoffreyDorville f397a9a
Fix reflective boundary conditions with temperature field
JoffreyDorville cd906d7
Regression test - box with reflective BC
JoffreyDorville 6a8f4a8
Regression test - box with vacuum BC
JoffreyDorville 549beb0
Simplify the implementation and remove tf_bin_last
JoffreyDorville a9fff5a
Fix regular mesh index calculation when point is on the lower boundary
JoffreyDorville 2e10a5d
Formatting
JoffreyDorville 8f9f44a
Regression test - box with periodic BC
JoffreyDorville 1ed498a
Regression test - surrounding box with reflective BC
JoffreyDorville 2966590
Regression test - surrounding box with vacuum BC
JoffreyDorville 2155926
Regression test - surrounding box with periodic BC
JoffreyDorville 1901a85
Cleaning
JoffreyDorville f2e1948
Reset DAGMC history after crossing the temperature field only
JoffreyDorville 6009008
Define next event in random ray transport
JoffreyDorville bd6a64f
Warn that the temperature field is ignored with random ray
JoffreyDorville 0af48ac
Update test results because of the fix on regular mesh index when the…
JoffreyDorville 24e3659
Manage lattices
JoffreyDorville ded9baa
Reorganize regular single cube regression tests
JoffreyDorville 7f2fd78
Reorganize regular nested cubes regression tests
JoffreyDorville 22f4eb1
Cleaning
JoffreyDorville edb6fb9
Reorganize regular verification scripts
JoffreyDorville f48b085
DAGMC regression tests + verification scripts
JoffreyDorville 0edb912
Lattice verification scripts - nested cubes
JoffreyDorville a5952fb
Lattice verification scripts - single cube
JoffreyDorville 7f96b45
Regression tests - lattices
JoffreyDorville c2bb44d
README file for temperature field regression tests
JoffreyDorville d3e2953
Documentation updates
paulromano 8b83aa2
Remove unnecessary docstrings on __init__
paulromano b8e2148
Reorder settings
paulromano 8a86e7f
Ensure values are written when the mesh is shared
JoffreyDorville 2a0ecf1
Add openmc_temperature_field_set_temperature to the C API
JoffreyDorville d696229
Clean docstring for get_temperature(int)
JoffreyDorville 376c2c8
Add settings documentation for temperature_field
JoffreyDorville 7ff1402
Add consistency checks in field Python classes
JoffreyDorville 98401f6
Merge branch 'develop' into temperate_from_mesh
JoffreyDorville c46c859
Update regression test because of the fix on get_index_direction for …
JoffreyDorville e517af4
Remove verification scripts and relocate them in a new repo
JoffreyDorville b05aeac
Update DAGMC test models
JoffreyDorville File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| #ifndef OPENMC_FIELD_H | ||
| #define OPENMC_FIELD_H | ||
|
|
||
| #include "openmc/mesh.h" | ||
| #include "openmc/vector.h" | ||
|
|
||
| namespace openmc { | ||
|
|
||
| class ScalarField { | ||
| public: | ||
| //---------------------------------------------------------------------------- | ||
| // Constructors | ||
| ScalarField() = default; | ||
| ScalarField( | ||
| Mesh* mesh_ptr, vector<double> values, const std::string& field_name); | ||
| ScalarField(Mesh* mesh_ptr, vector<double> values) | ||
| : ScalarField(mesh_ptr, values, "ScalarField") {}; | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| // Methods | ||
|
|
||
| //! Returns the distance to the next mesh boundary given a particle position | ||
| //! and direction. If the particle is initially outside, the distance will | ||
| //! correspond to the nearest distance to the outer boundaries of the mesh. | ||
| // | ||
| //! \param[in] current_bin Current bin number | ||
| //! \param[in] r Position of the particle | ||
| //! \param[in] u Direction of the particle | ||
| //! \param[out] bin_next Next bin number | ||
| //! \return The distance in cm to the next mesh boundary | ||
| double distance_to_next_boundary( | ||
| int current_bin, const Position& r, const Direction& d, int& bin_next); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| // Accessors | ||
|
|
||
| // Field type | ||
| const std::string& field_type() const { return this->field_type_; } | ||
|
|
||
| // Mesh pointer | ||
| Mesh* mesh_ptr() const | ||
| { | ||
| if (this->mesh_ptr_ == nullptr) { | ||
| fatal_error(fmt::format("No mesh found for {}!", this->field_type_)); | ||
| } else { | ||
| return this->mesh_ptr_; | ||
| } | ||
| } | ||
|
|
||
| // Values | ||
| double& value(int i) { return values_[i]; } | ||
| const double& value(int i) const { return values_[i]; } | ||
| const vector<double>& values() const { return values_; } | ||
|
|
||
| private: | ||
| //---------------------------------------------------------------------------- | ||
| // Data members | ||
| std::string field_type_; //! Name of field type | ||
| Mesh* mesh_ptr_; //!< Pointer to the geometric mesh | ||
| vector<double> values_; //!< Values associated with each mesh cell | ||
| }; | ||
|
|
||
| class TemperatureField : public ScalarField { | ||
| public: | ||
| //---------------------------------------------------------------------------- | ||
| // Constructors | ||
| TemperatureField() = default; | ||
| TemperatureField(Mesh* mesh_ptr, vector<double> values) | ||
| : ScalarField(mesh_ptr, values, "TemperatureField") {}; | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| // Methods | ||
|
|
||
| //! Returns the temperature in Kelvin corresponding to a given bin number | ||
| //! relative to the mesh. | ||
| // | ||
| //! \param[in] r Position of the particle | ||
| //! \return Temperature in Kelvin | ||
| double get_temperature(int bin); | ||
|
|
||
| //! Returns the square root of the temperature multiplied by the Boltzmann | ||
| //! constant in eV for a given bin number relative to the mesh. | ||
| // | ||
| //! \param[in] bin Bin number | ||
| //! \return Sqrt(k_Boltzmann * temperature) in eV | ||
| double get_sqrtkT(int bin); | ||
|
|
||
| //! Returns the bin number corresponding to the location of the particle. | ||
| // | ||
| //! \param[in] r Position of the particle | ||
| //! \return Corresponding bin number or -1 if outside the mesh | ||
| int get_bin(const Position& r); | ||
| }; | ||
|
|
||
| } // namespace openmc | ||
| #endif // OPENMC_FIELD_H | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mismatch between Doxygen comment and actual arguments (r vs bin)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done