From c1461845ecbf8bd32f609f1cfb5cebce92a659f7 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 3 Jun 2026 08:21:06 +0200 Subject: [PATCH] move BlackOilConvectiveMixingParam to separate header --- CMakeLists_files.cmake | 1 + .../blackoilconvectivemixingmodule.hh | 39 +-------- .../blackoilconvectivemixingmoduleparam.hpp | 79 +++++++++++++++++++ 3 files changed, 82 insertions(+), 37 deletions(-) create mode 100644 opm/models/blackoil/blackoilconvectivemixingmoduleparam.hpp diff --git a/CMakeLists_files.cmake b/CMakeLists_files.cmake index 9a27bb9ee0..2e0db0cf07 100644 --- a/CMakeLists_files.cmake +++ b/CMakeLists_files.cmake @@ -716,6 +716,7 @@ list (APPEND PUBLIC_HEADER_FILES opm/models/blackoil/blackoilbrinemodules.hh opm/models/blackoil/blackoilbrineparams.hpp opm/models/blackoil/blackoilconvectivemixingmodule.hh + opm/models/blackoil/blackoilconvectivemixingmoduleparam.hpp opm/models/blackoil/blackoildarcyfluxmodule.hh opm/models/blackoil/blackoildiffusionmodule.hh opm/models/blackoil/blackoildispersionmodule.hh diff --git a/opm/models/blackoil/blackoilconvectivemixingmodule.hh b/opm/models/blackoil/blackoilconvectivemixingmodule.hh index dbb3fe8415..981179f33d 100644 --- a/opm/models/blackoil/blackoilconvectivemixingmodule.hh +++ b/opm/models/blackoil/blackoilconvectivemixingmodule.hh @@ -36,52 +36,17 @@ #include #include -#include +#include #include +#include #include -#include - #include #include namespace Opm { - template class Storage = Opm::VectorWithDefaultAllocator> - struct ConvectiveMixingModuleParam - { - Storage active_; - Storage Xhi_; - Storage Psi_; - }; - -#ifdef HAVE_CUDA -namespace gpuistl -{ - template - ConvectiveMixingModuleParam make_view(ConvectiveMixingModuleParam& params) - { - ConvectiveMixingModuleParam view; - view.active_ = gpuistl::make_view(params.active_); - view.Xhi_ = gpuistl::make_view(params.Xhi_); - view.Psi_ = gpuistl::make_view(params.Psi_); - return view; - } - - template - ConvectiveMixingModuleParam copy_to_gpu(const ConvectiveMixingModuleParam& params) - { - return ConvectiveMixingModuleParam{ - gpuistl::GpuBuffer(params.active_), - gpuistl::GpuBuffer(params.Xhi_), - gpuistl::GpuBuffer(params.Psi_) - }; - } -} - -#endif - /*! * \copydoc Opm::BlackOilConvectiveMixingModule * \brief Provides the convective term in the transport flux for the brine diff --git a/opm/models/blackoil/blackoilconvectivemixingmoduleparam.hpp b/opm/models/blackoil/blackoilconvectivemixingmoduleparam.hpp new file mode 100644 index 0000000000..3d24cfbbd9 --- /dev/null +++ b/opm/models/blackoil/blackoilconvectivemixingmoduleparam.hpp @@ -0,0 +1,79 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/* + This file is part of the Open Porous Media project (OPM). + + OPM is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 2 of the License, or + (at your option) any later version. + + OPM is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with OPM. If not, see . + + Consult the COPYING file in the top-level source directory of this + module for the precise wording of the license and the list of + copyright holders. +*/ +/*! + * \file + * + * \brief Classes required for dynamic convective mixing. + */ +#ifndef OPM_CONVECTIVEMIXING_MODULE_PARAM_HPP +#define OPM_CONVECTIVEMIXING_MODULE_PARAM_HPP + +#include + +#ifdef HAVE_CUDA +#include +#include +#endif + +namespace Opm { + +template class Storage = VectorWithDefaultAllocator> +struct ConvectiveMixingModuleParam +{ + Storage active_; + Storage Xhi_; + Storage Psi_; +}; + +#ifdef HAVE_CUDA +namespace gpuistl +{ + +template +ConvectiveMixingModuleParam +make_view(ConvectiveMixingModuleParam& params) +{ + ConvectiveMixingModuleParam view; + view.active_ = gpuistl::make_view(params.active_); + view.Xhi_ = gpuistl::make_view(params.Xhi_); + view.Psi_ = gpuistl::make_view(params.Psi_); + return view; +} + +template +ConvectiveMixingModuleParam +copy_to_gpu(const ConvectiveMixingModuleParam& params) +{ + return ConvectiveMixingModuleParam{ + gpuistl::GpuBuffer(params.active_), + gpuistl::GpuBuffer(params.Xhi_), + gpuistl::GpuBuffer(params.Psi_) + }; +} + +} +#endif + +} + +#endif