Merge pull request #5551 from akva2/float_support4

Float support in simulators: Batch 4
This commit is contained in:
Bård Skaflestad 2024-08-21 13:57:24 +02:00 committed by GitHub
commit b74d84404e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 87 additions and 46 deletions

View File

@ -40,42 +40,70 @@
namespace Opm {
template class EclGenericWriter<Dune::CpGrid,
Dune::CpGrid,
Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>,
Dune::MultipleCodimMultipleGeomTypeMapper<Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>,
double>;
#define INSTANTIATE_TYPE(T) \
template class EclGenericWriter<Dune::CpGrid, \
Dune::CpGrid, \
Dune::GridView< \
Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>, \
Dune::MultipleCodimMultipleGeomTypeMapper< \
Dune::GridView< \
Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>, \
T>;
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
#if HAVE_DUNE_FEM
#if DUNE_VERSION_GTE(DUNE_FEM, 2, 9)
using GV = Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid,
(Dune::PartitionIteratorType)4,
false>;
template class EclGenericWriter<Dune::CpGrid,
Dune::CpGrid,
GV,
Dune::MultipleCodimMultipleGeomTypeMapper<GV>,
double>;
#define INSTANTIATE_FEM_TYPE(T) \
template class EclGenericWriter<Dune::CpGrid, \
Dune::CpGrid, \
GV, \
Dune::MultipleCodimMultipleGeomTypeMapper<GV>, \
T>;
#else
template class EclGenericWriter<Dune::CpGrid,
Dune::CpGrid,
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>, Dune::MultipleCodimMultipleGeomTypeMapper<Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>>,
double>;
template class EclGenericWriter<Dune::CpGrid,
Dune::CpGrid,
Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<
Dune::CpGrid,
Dune::PartitionIteratorType(4),
false>>,
Dune::MultipleCodimMultipleGeomTypeMapper<
Dune::Fem::GridPart2GridViewImpl<
Dune::Fem::AdaptiveLeafGridPart<
Dune::CpGrid,
Dune::PartitionIteratorType(4),
false>>>,
double>;
#define INSTANTIATE_FEM_TYPE(T) \
template class EclGenericWriter<Dune::CpGrid, \
Dune::CpGrid, \
Dune::GridView<Dune::Fem::GridPart2GridViewTraits< \
Dune::Fem::AdaptiveLeafGridPart< \
Dune::CpGrid, \
Dune::PartitionIteratorType(4), false>>>, \
Dune::MultipleCodimMultipleGeomTypeMapper< \
Dune::GridView< \
Dune::Fem::GridPart2GridViewTraits< \
Dune::Fem::AdaptiveLeafGridPart< \
Dune::CpGrid, \
Dune::PartitionIteratorType(4), false>>>>, \
T>; \
template class EclGenericWriter<Dune::CpGrid, \
Dune::CpGrid, \
Dune::Fem::GridPart2GridViewImpl< \
Dune::Fem::AdaptiveLeafGridPart< \
Dune::CpGrid, \
Dune::PartitionIteratorType(4), \
false>>, \
Dune::MultipleCodimMultipleGeomTypeMapper< \
Dune::Fem::GridPart2GridViewImpl< \
Dune::Fem::AdaptiveLeafGridPart< \
Dune::CpGrid, \
Dune::PartitionIteratorType(4), \
false>>>, \
T>;
#endif
#endif // HAVE_DUNE_FEM*/
INSTANTIATE_FEM_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_FEM_TYPE(float)
#endif
#endif // HAVE_DUNE_FEM
} // namespace Opm

View File

@ -768,7 +768,7 @@ setRestart(const data::Solution& sol,
if (!rswSol_.empty()) {
if (sol.has("RSWSOL"))
rswSol_[elemIdx] = sol.data<Scalar>("RSWSOL")[globalDofIndex];
rswSol_[elemIdx] = sol.data<double>("RSWSOL")[globalDofIndex];
}
@ -1660,6 +1660,15 @@ assignGlobalFieldsToSolution(data::Solution& sol)
}
}
template class GenericOutputBlackoilModule<BlackOilFluidSystem<double,BlackOilDefaultIndexTraits>>;
template<class T> using FS = BlackOilFluidSystem<T,BlackOilDefaultIndexTraits>;
#define INSTANTIATE_TYPE(T) \
template class GenericOutputBlackoilModule<FS<T>>;
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm

View File

@ -124,13 +124,13 @@ template<class Scalar, int Size>
using BV = Dune::BlockVector<Dune::FieldVector<Scalar,Size>>;
#define INSTANTIATE(T,Size) \
template void stabilizeNonlinearUpdate<BV<T,Size>,T>(BV<T,Size>&, BV<T,Size>&, \
template void stabilizeNonlinearUpdate(BV<T,Size>&, BV<T,Size>&, \
const T, NonlinearRelaxType);
#define INSTANTIATE_TYPE(T) \
template void detectOscillations(const std::vector<std::vector<T>>&, \
const int, const int, const T, const int, \
bool&, bool&); \
const int, const int, const T, \
const int, bool&, bool&); \
template void registerNonlinearParameters<T>(); \
INSTANTIATE(T,1) \
INSTANTIATE(T,2) \
@ -141,4 +141,8 @@ using BV = Dune::BlockVector<Dune::FieldVector<Scalar,Size>>;
INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm::detail

View File

@ -1775,7 +1775,7 @@ private:
this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped][globalDofIdx] = imMobileMassGas;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty()) {
const Scalar mobileMassGas = massGas * std::max(0.0, sg - trappedGasSaturation);
const Scalar mobileMassGas = massGas * std::max(Scalar{0.0}, sg - trappedGasSaturation);
this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped][globalDofIdx] = mobileMassGas;
}
}
@ -1793,7 +1793,7 @@ private:
this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped][globalDofIdx] = imMobileMassGas;
}
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) {
const Scalar mobileMassGas = massGas * std::max(0.0, sg - trappedGasSaturation);
const Scalar mobileMassGas = massGas * std::max(Scalar{0.0}, sg - trappedGasSaturation);
this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped][globalDofIdx] = mobileMassGas;
}
}