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

implement workaround for table edge issue #53

Merged
merged 1 commit into from
Dec 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions sesame2spiner/generate_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <cmath>
#include <cstdlib>
#include <limits>
#include <string>
#include <vector>

Expand Down Expand Up @@ -203,12 +204,21 @@ herr_t saveAllMaterials(const std::string &savename,

void getMatBounds(int i, int matid, const SesameMetadata &metadata, const Params &params,
Bounds &lRhoBounds, Bounds &lTBounds, Bounds &leBounds) {
Real rhoMin = params.Get("rhomin", metadata.rhoMin);
Real rhoMax = params.Get("rhomax", metadata.rhoMax);
Real TMin = params.Get("Tmin", metadata.TMin);
Real TMax = params.Get("Tmax", metadata.TMax);
Real sieMin = params.Get("siemin", metadata.sieMin);
Real sieMax = params.Get("siemax", metadata.sieMax);

// The "epsilon" shifts here are required to avoid eospac
// extrapolation errors at table bounds
constexpr Real TINY = std::numeric_limits<Real>::epsilon();
auto TinyShift = [=](Real val, int sign) {
Real shift = std::abs(std::min(10*val*TINY, TINY));
return val + sign*shift;
};

Real rhoMin = params.Get("rhomin", TinyShift(metadata.rhoMin,1));
Real rhoMax = params.Get("rhomax", TinyShift(metadata.rhoMax,-1));
Real TMin = params.Get("Tmin", TinyShift(metadata.TMin,1));
Real TMax = params.Get("Tmax", TinyShift(metadata.TMax,-1));
Real sieMin = params.Get("siemin", TinyShift(metadata.sieMin,1));
Real sieMax = params.Get("siemax", TinyShift(metadata.sieMax,-1));

checkValInMatBounds(matid, "rhoMin", rhoMin, metadata.rhoMin, metadata.rhoMax);
checkValInMatBounds(matid, "rhoMax", rhoMax, metadata.rhoMin, metadata.rhoMax);
Expand Down