Repository navigation
Fix issues #222, #224, #226, #230; fix meanFlowDir = +/-3 in init_ConvectedVortex #258
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -646,9 +646,22 @@ void NavierStokes::init_ConvectedVortex (Box const& vbx, | |||||||||||||||||||||||||
| // amrex::Abort() cannot be called from within the device lambda below, so | ||||||||||||||||||||||||||
| // validate the mean flow direction here. | ||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||
| if ( IC.meanFlowDir < -3 || IC.meanFlowDir > 3 ) { | ||||||||||||||||||||||||||
| amrex::Abort("\n init_ConvectedVortex: prob.meanFlowDir must be 0 (no mean flow) or +/-1, +/-2, +/-3\n in the inputs file."); | ||||||||||||||||||||||||||
| if ( IC.meanFlowDir < -4 || IC.meanFlowDir > 4 ) { | ||||||||||||||||||||||||||
| amrex::Abort("\n init_ConvectedVortex: prob.meanFlowDir must be 0 (no mean flow)," | ||||||||||||||||||||||||||
| "\n +/-1, +/-2, +/-3 (mean flow along x, y, z) or +/-4 (diagonal in the x-y plane)" | ||||||||||||||||||||||||||
| "\n in the inputs file."); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| #if (AMREX_SPACEDIM == 2) | ||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||
| // +/-4 is the non-axis-aligned option and works in 2D; +/-3 does not, | ||||||||||||||||||||||||||
| // since AMREX_D_TERM drops the z component and the mean flow would | ||||||||||||||||||||||||||
| // silently vanish. | ||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||
| if ( IC.meanFlowDir == 3 || IC.meanFlowDir == -3 ) { | ||||||||||||||||||||||||||
| amrex::Abort("\n init_ConvectedVortex: prob.meanFlowDir = +/-3 puts the mean flow along z" | ||||||||||||||||||||||||||
| "\n and requires 3D. Use +/-4 for a diagonal mean flow in the x-y plane."); | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| amrex::ParallelFor(vbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept | ||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||
|
|
@@ -691,11 +704,21 @@ void NavierStokes::init_ConvectedVortex (Box const& vbx, | |||||||||||||||||||||||||
| vel(i,j,k,2) = w_vort); | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
| case 3 : | ||||||||||||||||||||||||||
| AMREX_D_TERM(vel(i,j,k,0) = u_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,1) = v_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,2) = IC.meanFlowMag + w_vort); | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
| case -3 : | ||||||||||||||||||||||||||
| AMREX_D_TERM(vel(i,j,k,0) = u_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,1) = v_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,2) = -IC.meanFlowMag + w_vort); | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
|
Collaborator
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.
Suggested change
Contributor
Author
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. Applied in ff09d46, with I applied it by hand rather than with the "commit suggestion" button: the suggested block has trailing whitespace after Otherwise the body is your text unchanged, which also means it is character-identical to the pre-PR |
||||||||||||||||||||||||||
| case 4 : // diagonal in the x-y plane; |U| = meanFlowMag*sqrt(2) | ||||||||||||||||||||||||||
| AMREX_D_TERM(vel(i,j,k,0) = IC.meanFlowMag + u_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,1) = IC.meanFlowMag + v_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,2) = w_vort); | ||||||||||||||||||||||||||
| break; | ||||||||||||||||||||||||||
| case -3 : | ||||||||||||||||||||||||||
| case -4 : | ||||||||||||||||||||||||||
| AMREX_D_TERM(vel(i,j,k,0) = -IC.meanFlowMag + u_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,1) = -IC.meanFlowMag + v_vort;, | ||||||||||||||||||||||||||
| vel(i,j,k,2) = w_vort); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
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.
The intent of meanFlowDir = 3 was as originally written, that is to create a mean flow that is not axis aligned. This problem is inherently 2D but can be run as pseudo 3D. I can see that meanFlowDir = 3 is confusing and suggest we could use 4 instead of 3.
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.
Thanks — you are right, and I had this backwards. I read the old
case 3as a typo because it was the only branch that was not single-component, and I did not consider that non-axis-aligned was the point. Sorry for removing it.Adopted your numbering in ff09d46:
+/-4is now the diagonal, restored as the pre-PRcase +/-3body verbatim, and+/-3is the z-aligned flow.One extension to your suggestion, which I am happy to drop if you disagree: I kept this 2D guard, but narrowed it to
+/-3only. Now that+/-3means z,AMREX_D_TERMstill drops it in 2D and the mean flow would vanish silently. The message now points at+/-4:+/-4itself works fine in 2D, so the pseudo-2D use you describe is unaffected.