Merge pull request #4520 from bska/load-aquflux-rst-info

Add Support for Initialising Constant Flux Aquifers from Restart
This commit is contained in:
Kai Bao 2023-05-26 22:00:46 +02:00 committed by GitHub
commit 84cb77a870
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 92 additions and 5 deletions

View File

@ -91,12 +91,18 @@ public:
aquifer_data_ = aquifer;
}
void initFromRestart(const data::Aquifers& /* aquiferSoln */) override {
}
void initialSolutionApplied() override {
void initFromRestart(const data::Aquifers& aquiferSoln) override
{
auto xaqPos = aquiferSoln.find(this->aquiferID());
if (xaqPos == aquiferSoln.end()) {
return;
}
this->cumulative_flux_ = this->area_fraction_ * xaqPos->second.volume;
}
void initialSolutionApplied() override
{}
void beginTimeStep() override
{}

View File

@ -134,6 +134,9 @@ private:
void createDynamicAquifers(const int episode_index);
void initializeStaticAquifers();
void initializeRestartDynamicAquifers();
bool needRestartDynamicAquifers() const;
template <typename AquiferType, typename AquiferData>
std::unique_ptr<AquiferType>

View File

@ -165,6 +165,9 @@ void BlackoilAquiferModel<TypeTag>::init()
this->initializeStaticAquifers();
}
if (this->needRestartDynamicAquifers()) {
this->initializeRestartDynamicAquifers();
}
}
template<typename TypeTag>
@ -202,6 +205,15 @@ serializeOp(Serializer& serializer)
}
}
template <typename TypeTag>
void BlackoilAquiferModel<TypeTag>::initializeRestartDynamicAquifers()
{
const auto rstStep = this->simulator_.vanguard().eclState()
.getInitConfig().getRestartStep() - 1;
this->createDynamicAquifers(rstStep);
}
template <typename TypeTag>
void BlackoilAquiferModel<TypeTag>::initializeStaticAquifers()
{
@ -248,6 +260,20 @@ void BlackoilAquiferModel<TypeTag>::initializeStaticAquifers()
}
}
template <typename TypeTag>
bool BlackoilAquiferModel<TypeTag>::needRestartDynamicAquifers() const
{
const auto& initconfig =
this->simulator_.vanguard().eclState().getInitConfig();
if (! initconfig.restartRequested()) {
return false;
}
return this->simulator_.vanguard()
.schedule()[initconfig.getRestartStep() - 1].hasAnalyticalAquifers();
}
template <typename TypeTag>
template <typename AquiferType, typename AquiferData>
std::unique_ptr<AquiferType>

View File

@ -44,6 +44,24 @@ add_test_compare_parallel_restarted_simulation(CASENAME numerical_aquifer_3d_1aq
DIR aquifer-num
TEST_ARGS --enable-tuning=true --tolerance-cnv=0.00003 --time-step-control=pid --linear-solver=cpr_trueimpes)
add_test_compare_parallel_restarted_simulation(CASENAME aquflux_01
FILENAME AQUFLUX-01
SIMULATOR flow
ABS_TOL ${abs_tol_restart}
REL_TOL 5.0e-2
RESTART_STEP 3
DIR aquifers
TEST_ARGS --solver-max-time-step-in-days=1)
add_test_compare_parallel_restarted_simulation(CASENAME aquflux_02
FILENAME AQUFLUX-02
SIMULATOR flow
ABS_TOL ${abs_tol_restart}
REL_TOL 5.0e-2
RESTART_STEP 50
DIR aquifers
TEST_ARGS --solver-max-time-step-in-days=1)
# Serialized restart tests
if(HDF5_FOUND)
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-serialization-regressionTest.sh "")

View File

@ -141,6 +141,14 @@ add_test_compare_parallel_simulation(CASENAME aquflux_01
DIR aquifers
TEST_ARGS --enable-tuning=true)
add_test_compare_parallel_simulation(CASENAME aquflux_02
FILENAME AQUFLUX-02
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${coarse_rel_tol_parallel}
DIR aquifers
TEST_ARGS --enable-tuning=true)
add_test_compare_parallel_simulation(CASENAME network_balance_01
FILENAME NETWORK-01
SIMULATOR flow

View File

@ -199,7 +199,14 @@ add_test_compareECLFiles(CASENAME aquflux_01
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
DIR aquifers)
DIR aquifers --solver-max-time-step-in-days=1)
add_test_compareECLFiles(CASENAME aquflux_02
FILENAME AQUFLUX-02
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
DIR aquifers --solver-max-time-step-in-days=1)
add_test_compareECLFiles(CASENAME spe3
FILENAME SPE3CASE1

View File

@ -56,6 +56,24 @@ add_test_compare_restarted_simulation(CASENAME numerical_aquifer_3d_2aqu
DIR aquifer-num
TEST_ARGS --sched-restart=true --enable-tuning=true)
add_test_compare_restarted_simulation(CASENAME aquflux_01
FILENAME AQUFLUX-01
SIMULATOR flow
ABS_TOL ${abs_tol_restart}
REL_TOL 3.0e-3
RESTART_STEP 3
DIR aquifers
TEST_ARGS --enable-tuning=true)
add_test_compare_restarted_simulation(CASENAME aquflux_02
FILENAME AQUFLUX-02
SIMULATOR flow
ABS_TOL ${abs_tol_restart}
REL_TOL ${rel_tol_restart}
RESTART_STEP 50
DIR aquifers
TEST_ARGS --enable-tuning=true)
# The dynamic MSW data is not written to /read from the restart file
# We therefore accept significant deviation in the results.
# Note also that we use --sched-restart=true since some necessary

View File

@ -85,6 +85,7 @@ tests[fetkovich_2d]="flow aquifer-fetkovich 2D_FETKOVICHAQUIFER"
tests[numerical_aquifer_3d_1aqu]="flow aquifer-num 3D_1AQU_3CELLS"
tests[numerical_aquifer_3d_2aqu]="flow aquifer-num 3D_2AQU_NUM"
tests[aquflux_01]="flow aquifers AQUFLUX-01"
tests[aquflux_02]="flow aquifers AQUFLUX-02"
tests[msw_2d_h]="flow msw_2d_h 2D_H__"
tests[msw_3d_hfa]="flow msw_3d_hfa 3D_MSW"
tests[polymer_oilwater]="flow polymer_oilwater 2D_OILWATER_POLYMER"