-
Notifications
You must be signed in to change notification settings - Fork 129
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
MHD reproducibility #648
base: master
Are you sure you want to change the base?
MHD reproducibility #648
Changes from all commits
6ddfb52
30faabf
cdd766e
83b393a
4622a99
1802abe
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 |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
//======================================================================================== | ||
|
||
// C headers | ||
#include <float.h> | ||
|
||
// C++ headers | ||
#include <algorithm> // min | ||
|
@@ -100,28 +101,7 @@ void FaceCenteredBoundaryVariable::SendEMFShearingBoxBoundaryCorrection() { | |
int offset[2]{0, 3}; | ||
for (int upper=0; upper<2; upper++) { | ||
if (pbval_->is_shear[upper]) { | ||
// step 1. -- average edges of shboxvar_fc_flx_ | ||
// average e3 for x1x2 edge | ||
for (int k=pmb->ks; k<=pmb->ke; k++) { | ||
for (int j=pmb->js; j<=pmb->je+1; j+=pmb->block_size.nx2) | ||
shear_var_emf_[upper].x3e(k,j) *= 0.5; | ||
} | ||
if(pmb->block_size.nx3 > 1) { | ||
// average e2 for x1x3 edge | ||
if (pbval_->block_bcs[BoundaryFace::inner_x3] == BoundaryFlag::block | ||
|| pbval_->block_bcs[BoundaryFace::inner_x3] == BoundaryFlag::periodic) { | ||
for (int j=pmb->js; j<=pmb->je; j++) | ||
shear_var_emf_[upper].x2e(pmb->ks,j) *= 0.5; | ||
} | ||
if (pbval_->block_bcs[BoundaryFace::outer_x3] == BoundaryFlag::block | ||
|| pbval_->block_bcs[BoundaryFace::outer_x3] == BoundaryFlag::periodic) { | ||
for (int j=pmb->js; j<=pmb->je; j++) | ||
shear_var_emf_[upper].x2e(pmb->ke+1,j) *= 0.5; | ||
} | ||
} | ||
|
||
// step 2. -- load sendbuf; memcpy to recvbuf if on same rank, post | ||
// MPI_Isend otherwise | ||
// load sendbuf; memcpy to recvbuf if on same rank, post MPI_Isend otherwise | ||
for (int n=0; n<3; n++) { | ||
SimpleNeighborBlock& snb = pbval_->sb_flux_data_[upper].send_neighbor[n]; | ||
if (snb.rank != -1) { | ||
|
@@ -298,7 +278,12 @@ void FaceCenteredBoundaryVariable::SetEMFShearingBoxBoundaryCorrection() { | |
void FaceCenteredBoundaryVariable::ClearEMFShearing(EdgeField &work) { | ||
AthenaArray<Real> &e2 = work.x2e; | ||
AthenaArray<Real> &e3 = work.x3e; | ||
e2.ZeroClear(); | ||
e3.ZeroClear(); | ||
constexpr Real m = (sizeof(Real) == sizeof(float)) ? -FLT_MAX : -DBL_MAX; | ||
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. the C++ way of doing this is much better: constexpr Real m = -std::numeric_limits<Real>::max(); I noticed that the C-style approach somehow made it through to orbital advection and FC flux correction files in the past:
would you mind changing them? 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. Please change them. Regarding OA, I just opened another PR about it, so probably it is better to fix them there. |
||
int s = e2.GetSize(); | ||
for (int i = 0; i < s; ++i) | ||
e2(i) = m; | ||
s = e3.GetSize(); | ||
for (int i = 0; i < s; ++i) | ||
e3(i) = m; | ||
return; | ||
} |
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.
see below, use
#include <limits>
(or at a minimum, cfloat)