Merge pull request #4900 from hnil/fix_nnz_thermal

fixed error using NNC with thermal
This commit is contained in:
Markus Blatt 2023-10-02 11:08:24 +02:00 committed by GitHub
commit 9dac9de6a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 64 additions and 10 deletions

View File

@ -101,7 +101,10 @@ public:
using GridView = GetPropType<TypeTag, Properties::GridView>;
using TransmissibilityType = EclTransmissibility<Grid, GridView, ElementMapper, CartesianIndexMapper, Scalar>;
static constexpr int dimensionworld = Grid::dimensionworld;
using Indices = GetPropType<TypeTag, Properties::Indices>;
static constexpr bool waterEnabled = Indices::waterEnabled;
static constexpr bool gasEnabled = Indices::gasEnabled;
static constexpr bool oilEnabled = Indices::oilEnabled;
private:
using Element = typename GridView::template Codim<0>::Entity;
@ -174,6 +177,22 @@ public:
throw std::runtime_error("Input specifies Solvent while simulator has it disabled");
}
}
if(phases.active(Phase::WATER)){
if(waterEnabled == false){
throw std::runtime_error("Input specifies water while simulator has it disabled");
}
}
if(phases.active(Phase::GAS)){
if(gasEnabled == false){
throw std::runtime_error("Input specifies gas while simulator has it disabled");
}
}
if(phases.active(Phase::OIL)){
if(oilEnabled == false){
throw std::runtime_error("Input specifies oil while simulator has it disabled");
}
}
}
/*!

View File

@ -222,9 +222,9 @@ protected:
const std::function<void(double&, const double&)>& apply);
void extractPermeability_();
void extractPermeability_(const std::function<unsigned int(unsigned int)>& map);
void extractPorosity_();
void computeHalfTrans_(Scalar& halfTrans,
@ -266,7 +266,7 @@ protected:
std::map<std::pair<unsigned, unsigned>, Scalar> thermalHalfTransBoundary_;
bool enableEnergy_;
bool enableDiffusivity_;
std::unordered_map<std::uint64_t, Scalar> thermalHalfTrans_;
std::unordered_map<std::uint64_t, Scalar> thermalHalfTrans_; //NB this is based on direction map size is ca 2*trans_ (diffusivity_)
std::unordered_map<std::uint64_t, Scalar> diffusivity_;
};

View File

@ -301,6 +301,14 @@ update(bool global, const std::function<unsigned int(unsigned int)>& map, const
// *added to* by applyNncToGridTrans_() later.
assert(outsideFaceIdx == -1);
trans_[isId(elemIdx, outsideElemIdx)] = 0.0;
if (enableEnergy_){
thermalHalfTrans_[directionalIsId(elemIdx, outsideElemIdx)] = 0.0;
thermalHalfTrans_[directionalIsId(outsideElemIdx, elemIdx)] = 0.0;
}
if (updateDiffusivity) {
diffusivity_[isId(elemIdx, outsideElemIdx)] = 0.0;
}
continue;
}
@ -866,13 +874,40 @@ applyNncToGridTrans_(const std::unordered_map<std::size_t,int>& cartesianToCompr
continue;
}
auto candidate = trans_.find(isId(low, high));
if (candidate != trans_.end()) {
// NNC is represented by the grid and might be a neighboring connection
// In this case the transmissibilty is added to the value already
// set or computed.
candidate->second += nncEntry.trans;
{
auto candidate = trans_.find(isId(low, high));
if (candidate != trans_.end()) {
// NNC is represented by the grid and might be a neighboring connection
// In this case the transmissibilty is added to the value already
// set or computed.
candidate->second += nncEntry.trans;
}
}
// if (enableEnergy_) {
// auto candidate = thermalHalfTrans_.find(directionalIsId(low, high));
// if (candidate != trans_.end()) {
// // NNC is represented by the grid and might be a neighboring connection
// // In this case the transmissibilty is added to the value already
// // set or computed.
// candidate->second += nncEntry.transEnergy1;
// }
// auto candidate = thermalHalfTrans_.find(directionalIsId(high, low));
// if (candidate != trans_.end()) {
// // NNC is represented by the grid and might be a neighboring connection
// // In this case the transmissibilty is added to the value already
// // set or computed.
// candidate->second += nncEntry.transEnergy2;
// }
// }
// if (enableDiffusivity_) {
// auto candidate = diffusivity_.find(isId(low, high));
// if (candidate != trans_.end()) {
// // NNC is represented by the grid and might be a neighboring connection
// // In this case the transmissibilty is added to the value already
// // set or computed.
// candidate->second += nncEntry.transDiffusion;
// }
// }
}
}