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

Implementing k-eps and k-omega RANS models #1001

Merged
merged 1 commit into from
Aug 2, 2022
Merged

Conversation

marchdf
Copy link
Contributor

@marchdf marchdf commented Jul 13, 2022

Co-authored-by: Jeremy Melvin [email protected]

@marchdf marchdf requested review from psakievich and jamelvin July 13, 2022 21:50
@marchdf marchdf added the wip-no-merge WIP, pull-request meant for discussions label Jul 13, 2022
@marchdf marchdf requested a review from gantech July 13, 2022 21:58
docs/references/references.bib Outdated Show resolved Hide resolved
docs/source/theory/turbulenceModeling.rst Outdated Show resolved Hide resolved
include/Enums.h Outdated Show resolved Hide resolved
include/Enums.h Outdated Show resolved Hide resolved
include/Enums.h Outdated Show resolved Hide resolved
src/WilcoxKOmegaEquationSystem.C Outdated Show resolved Hide resolved
src/ngp_algorithms/TurbViscKEAlg.C Show resolved Hide resolved
src/node_kernels/TDRKENodeKernel.C Outdated Show resolved Hide resolved
src/node_kernels/TKEKENodeKernel.C Outdated Show resolved Hide resolved
src/node_kernels/TKEKONodeKernel.C Outdated Show resolved Hide resolved
@marchdf marchdf added enhancement New feature or request and removed wip-no-merge WIP, pull-request meant for discussions labels Jul 14, 2022
@marchdf marchdf changed the title WIP: Implementing k-eps and k-omega RANS models Implementing k-eps and k-omega RANS models Jul 14, 2022
@marchdf marchdf marked this pull request as ready for review July 14, 2022 20:33
@marchdf marchdf requested a review from jamelvin July 15, 2022 15:49
Copy link
Contributor

@jamelvin jamelvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/SpecificDissipationRateEquationSystem.C Show resolved Hide resolved
@marchdf
Copy link
Contributor Author

marchdf commented Jul 20, 2022

How is this looking for everyone? I know it's a big one but I've got two more of these kind of PRs sitting in the wing... I tried to break all the work we did into smaller chunks but smaller doesn't mean small ;)

@psakievich
Copy link
Contributor

I'm about halfway through it. I'll try to finish in the next day or so.

@marchdf
Copy link
Contributor Author

marchdf commented Jul 21, 2022

Thanks, @psakievich, for taking the time to look at this!

Copy link
Contributor

@psakievich psakievich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good, but I'm running out of steam on this first pass. I made it up to the Wilcox files. I'll post what I've seen so far so you can make a few changes.

Main requests are to clean up the few raw pointer instances, and double check that this works on device. I've noted a few syncs that looked like they were missing.

include/ChienKEpsilonEquationSystem.h Show resolved Hide resolved
include/WilcoxKOmegaEquationSystem.h Show resolved Hide resolved
src/SpecificDissipationRateEquationSystem.C Show resolved Hide resolved
src/ChienKEpsilonEquationSystem.C Outdated Show resolved Hide resolved
src/ChienKEpsilonEquationSystem.C Show resolved Hide resolved
src/ChienKEpsilonEquationSystem.C Outdated Show resolved Hide resolved
src/ChienKEpsilonEquationSystem.C Show resolved Hide resolved
src/ChienKEpsilonEquationSystem.C Show resolved Hide resolved
src/ChienKEpsilonEquationSystem.C Show resolved Hide resolved
meta.aura_part()) &
stk::mesh::selectField(*tdr_);
nalu_ngp::field_copy(ngpMesh, sel, tdrNp1, tdrN);
tdrNp1.modify_on_device();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI the modify_on_device flag is set inside field_copy so this is unnecessary. It is a null op though so it doesn't matter. Might be worth adding a sync call on tdrN though. @alanw0 is there a reason we don't do a sync on the src field inside copy_field too?

@marchdf
Copy link
Contributor Author

marchdf commented Jul 22, 2022

Thanks for taking the time! Great catches, all. I really like the enum class idea and might actually do a separate PR for that. I will take care of your requested changes.

@marchdf
Copy link
Contributor Author

marchdf commented Jul 22, 2022

I am not sure why the unittest failed on the latest commit? Looking into that now.

@marchdf marchdf force-pushed the k-eps branch 2 times, most recently from 41c498d to e1084bf Compare July 25, 2022 21:48
@marchdf
Copy link
Contributor Author

marchdf commented Jul 25, 2022

For reasons I don't understand yet, the unique_ptr edits for tkeEqSys_ (and others, see https://github.com/marchdf/nalu-wind/blob/k-eps/src/ShearStressTransportEquationSystem.C#L70) is causing a segfault in the unittests:

[----------] 20 tests from SSTKernelHex8Mesh
[ RUN      ] SSTKernelHex8Mesh.StreletsUpwindComputation
Process 47428 stopped
* thread #1, name = 'unittestX', stop reason = signal SIGSEGV: invalid address (fault address: 0x331)
    frame #0: 0x0000000000000331
error: memory read failed for 0x200
(lldb) bt
* thread #1, name = 'unittestX', stop reason = signal SIGSEGV: invalid address (fault address: 0x331)
  * frame #0: 0x0000000000000331
    frame #1: 0x0000000000b3a23f unittestX`sierra::nalu::EquationSystems::~EquationSystems() + 47
    frame #2: 0x0000000000be4cfc unittestX`sierra::nalu::Realm::~Realm() + 2060
    frame #3: 0x0000000000be5189 unittestX`sierra::nalu::Realm::~Realm() + 9
    frame #4: 0x0000000000beb5b2 unittestX`sierra::nalu::Realms::~Realms() + 50
    frame #5: 0x0000000000c058da unittestX`sierra::nalu::Simulation::~Simulation() + 26
    frame #6: 0x0000000000723f52 unittestX`unit_test_utils::HelperObjects::~HelperObjects() + 306
    frame #7: 0x00000000008aca98 unittestX`sierra::nalu::SSTKernelHex8Mesh_StreletsUpwindComputation_Test::TestBody() + 5336
    frame #8: 0x00007ffff10d2bad libgtest.so.13`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 61
    frame #9: 0x00007ffff10be51e libgtest.so.13`testing::Test::Run() + 206
    frame #10: 0x00007ffff10be675 libgtest.so.13`testing::TestInfo::Run() + 309
    frame #11: 0x00007ffff10be76c libgtest.so.13`testing::TestSuite::Run() + 204
    frame #12: 0x00007ffff10c8aa3 libgtest.so.13`testing::internal::UnitTestImpl::RunAllTests() + 1171
    frame #13: 0x00007ffff10c8cd8 libgtest.so.13`testing::UnitTest::Run() + 184
    frame #14: 0x000000000058fae2 unittestX`main + 450
    frame #15: 0x00007fffef411555 libc.so.6`__libc_start_main + 245
    frame #16: 0x00000000006e4833 unittestX`_start + 41

I am wondering if there's some kind of conflict between, e.g. ShearStressTransportEquationSystem.C:

  // push back EQ to manager
  realm_.push_equation_to_systems(this);

and in EquationSystems.C

  for (size_t ie = 0; ie < equationSystemVector_.size(); ++ie)
    delete equationSystemVector_[ie];

@psakievich
Copy link
Contributor

Hmm I'm not immediately seeing why this is failing. It seems like all the unique_ptr's are locally owned and the copy operation is on pointer. There is something about the clean up that is not good though. This could be related to issues I want to address in #997. It's okay if you want to drop the unique_ptr from this PR for now. I don't like doing it, but I don't have the cycles to work through this failure right now. The fact that all the EquationSystem's need an EquationSystems in their constructor seems to indicate some tangled interdependencies.

@marchdf
Copy link
Contributor Author

marchdf commented Jul 26, 2022

Ok I will drop for now. Thanks for looking at this.

Copy link
Contributor

@psakievich psakievich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took me so long to get back to the review. Thanks for making the changes and going on a unique_ptr adventure with me. I looked at it closer and it will take a bigger (but easy) refactor to make those unique_ptr's. I will do that in a separate PR soon.

src/ChienKEpsilonEquationSystem.C Outdated Show resolved Hide resolved
src/node_kernels/TKEKsgsNodeKernel.C Show resolved Hide resolved
@marchdf marchdf force-pushed the k-eps branch 2 times, most recently from 0c67f36 to dfcb5a4 Compare August 2, 2022 15:26
@jrood-nrel jrood-nrel merged commit c61870d into Exawind:master Aug 2, 2022
@marchdf marchdf deleted the k-eps branch August 2, 2022 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants