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

View File

@ -768,7 +768,7 @@ setRestart(const data::Solution& sol,
if (!rswSol_.empty()) { if (!rswSol_.empty()) {
if (sol.has("RSWSOL")) 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 } // namespace Opm

View File

@ -123,22 +123,26 @@ void registerNonlinearParameters()
template<class Scalar, int Size> template<class Scalar, int Size>
using BV = Dune::BlockVector<Dune::FieldVector<Scalar,Size>>; using BV = Dune::BlockVector<Dune::FieldVector<Scalar,Size>>;
#define INSTANTIATE(T,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); const T, NonlinearRelaxType);
#define INSTANTIATE_TYPE(T) \ #define INSTANTIATE_TYPE(T) \
template void detectOscillations(const std::vector<std::vector<T>>&, \ template void detectOscillations(const std::vector<std::vector<T>>&, \
const int, const int, const T, const int, \ const int, const int, const T, \
bool&, bool&); \ const int, bool&, bool&); \
template void registerNonlinearParameters<T>(); \ template void registerNonlinearParameters<T>(); \
INSTANTIATE(T,1) \ INSTANTIATE(T,1) \
INSTANTIATE(T,2) \ INSTANTIATE(T,2) \
INSTANTIATE(T,3) \ INSTANTIATE(T,3) \
INSTANTIATE(T,4) \ INSTANTIATE(T,4) \
INSTANTIATE(T,5) \ INSTANTIATE(T,5) \
INSTANTIATE(T,6) INSTANTIATE(T,6)
INSTANTIATE_TYPE(double) INSTANTIATE_TYPE(double)
#if FLOW_INSTANTIATE_FLOAT
INSTANTIATE_TYPE(float)
#endif
} // namespace Opm::detail } // namespace Opm::detail

View File

@ -1775,7 +1775,7 @@ private:
this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped][globalDofIdx] = imMobileMassGas; this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumTrapped][globalDofIdx] = imMobileMassGas;
} }
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped].empty()) { 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; this->fip_[Inplace::Phase::CO2MassInGasPhaseMaximumUnTrapped][globalDofIdx] = mobileMassGas;
} }
} }
@ -1793,7 +1793,7 @@ private:
this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped][globalDofIdx] = imMobileMassGas; this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveTrapped][globalDofIdx] = imMobileMassGas;
} }
if (!this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped].empty()) { 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; this->fip_[Inplace::Phase::CO2MassInGasPhaseEffectiveUnTrapped][globalDofIdx] = mobileMassGas;
} }
} }