-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add SmartField usage to some legacy algorithms #1236
Merged
+46
−43
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aae040d
Add SmartField usage to some legacy algorithms
psakievich e8b7d48
Merge branch 'master' into f/sf-algo
psakievich f4fe720
Format
psakievich 568a87e
Merge branch 'master' into f/sf-algo
psakievich 68b0e18
Fixes for change in API
psakievich b82ddc8
Style
psakievich 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 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
#include <Algorithm.h> | ||
#include <property_evaluator/ThermalConductivityFromPrandtlPropAlgorithm.h> | ||
#include <FieldManager.h> | ||
#include <FieldTypeDef.h> | ||
#include <Realm.h> | ||
|
||
|
@@ -31,19 +32,12 @@ namespace nalu { | |
//-------------------------------------------------------------------------- | ||
ThermalConductivityFromPrandtlPropAlgorithm:: | ||
ThermalConductivityFromPrandtlPropAlgorithm( | ||
Realm& realm, | ||
const stk::mesh::PartVector& part_vec, | ||
ScalarFieldType* thermalCond, | ||
ScalarFieldType* specHeat, | ||
ScalarFieldType* viscosity, | ||
const double Pr) | ||
: Algorithm(realm, part_vec), | ||
thermalCond_(thermalCond), | ||
specHeat_(specHeat), | ||
viscosity_(viscosity), | ||
Pr_(Pr) | ||
Realm& realm, const stk::mesh::PartVector& part_vec, const double Pr) | ||
: Algorithm(realm, part_vec), Pr_(Pr) | ||
{ | ||
// does nothing | ||
fieldManager_.register_field<double>("thermal_conductivity", part_vec); | ||
fieldManager_.register_field<double>("specific_heat", part_vec); | ||
fieldManager_.register_field<double>("viscosity", part_vec); | ||
} | ||
|
||
//-------------------------------------------------------------------------- | ||
|
@@ -60,25 +54,23 @@ ThermalConductivityFromPrandtlPropAlgorithm::execute() | |
stk::mesh::BucketVector const& node_buckets = | ||
realm_.get_buckets(stk::topology::NODE_RANK, selector); | ||
|
||
thermalCond_->sync_to_host(); | ||
specHeat_->sync_to_host(); | ||
viscosity_->sync_to_host(); | ||
auto thermalCond = | ||
fieldManager_.get_legacy_smart_field<double, tags::READ_WRITE>( | ||
"thermal_conductivity"); | ||
const auto specHeat = | ||
fieldManager_.get_legacy_smart_field<double, tags::READ>("specific_heat"); | ||
const auto viscosity = | ||
fieldManager_.get_legacy_smart_field<double, tags::READ>("viscosity"); | ||
|
||
for (stk::mesh::BucketVector::const_iterator ib = node_buckets.begin(); | ||
ib != node_buckets.end(); ++ib) { | ||
stk::mesh::Bucket& b = **ib; | ||
const stk::mesh::Bucket::size_type length = b.size(); | ||
|
||
double* thermalCond = stk::mesh::field_data(*thermalCond_, b); | ||
const double* specHeat = stk::mesh::field_data(*specHeat_, b); | ||
const double* viscosity = stk::mesh::field_data(*viscosity_, b); | ||
|
||
for (stk::mesh::Bucket::size_type k = 0; k < length; ++k) { | ||
thermalCond[k] = specHeat[k] * viscosity[k] / Pr_; | ||
thermalCond(b)[k] = specHeat(b)[k] * viscosity(b)[k] / Pr_; | ||
} | ||
} | ||
thermalCond_->modify_on_host(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's nice to be able to remove these modify and sync calls. |
||
thermalCond_->sync_to_device(); | ||
} | ||
|
||
} // namespace nalu | ||
|
Submodule wind-utils
updated
17 files
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.
I'm curious how field registry can be a compile-time definition, if it depends on a part-vector which would have run-time contents.
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.
I was thinking the type look up could be moved to compile time so that when fields are accessed we wouldn't have to include the type. Registry would still have to be runtime. However, looking at the dependencies I'm not sure I want to do that anymore. We'd have to expose more of the field information across the code base instead of isolating it to a single
*.C
file. This could wreak havoc on the compile times. After we convert to the simple fields the type information becomes way less cumbersome for accessing fields. So I think we should keep it as is.