diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp index 3e414ece1b6ef527eaa718a9bfaaa8ce310916fc..294389bafc8bc442555b6b27b5fc1e0444b995ee 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.cpp @@ -44,15 +44,37 @@ ComponentTransportProcess::ComponentTransportProcess( std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux, std::unique_ptr<ChemistryLib::ChemicalSolverInterface>&& chemical_solver_interface, - bool const is_linear) + bool const is_linear, + bool const ls_compute_only_upon_timestep_change) : Process(std::move(name), mesh, std::move(jacobian_assembler), parameters, integration_order, std::move(process_variables), std::move(secondary_variables), use_monolithic_scheme), _process_data(std::move(process_data)), _surfaceflux(std::move(surfaceflux)), _chemical_solver_interface(std::move(chemical_solver_interface)), - _asm_mat_cache{is_linear, use_monolithic_scheme} + _asm_mat_cache{is_linear, use_monolithic_scheme}, + _ls_compute_only_upon_timestep_change{ + ls_compute_only_upon_timestep_change} { + if (ls_compute_only_upon_timestep_change) + { + if (!is_linear) + { + OGS_FATAL( + "Using the linear solver compute() method only upon timestep " + "change only makes sense for linear model equations."); + } + + WARN( + "You specified that the ComponentTransport linear solver will do " + "the compute() step only upon timestep change. This is an expert " + "option. It is your responsibility to ensure that " + "the conditions for the correct use of this feature are met! " + "Otherwise OGS might compute garbage without being recognized. " + "There is no " + "safety net!"); + } + _residua.push_back(MeshLib::getOrCreateMeshProperty<double>( mesh, "LiquidMassFlowRate", MeshLib::MeshItemType::Node, 1)); diff --git a/ProcessLib/ComponentTransport/ComponentTransportProcess.h b/ProcessLib/ComponentTransport/ComponentTransportProcess.h index 930941a473e23647a9fa5322e4574f66aa888d4a..79738129848e058c0a493738f955116923e24ecc 100644 --- a/ProcessLib/ComponentTransport/ComponentTransportProcess.h +++ b/ProcessLib/ComponentTransport/ComponentTransportProcess.h @@ -111,7 +111,8 @@ public: std::unique_ptr<ProcessLib::SurfaceFluxData>&& surfaceflux, std::unique_ptr<ChemistryLib::ChemicalSolverInterface>&& chemical_solver_interface, - bool const is_linear); + bool const is_linear, + bool const ls_compute_only_upon_timestep_change); //! \name ODESystem interface //! @{ @@ -141,6 +142,11 @@ public: const double dt, int const process_id) override; + bool shouldLinearSolverComputeOnlyUponTimestepChange() const override + { + return _ls_compute_only_upon_timestep_change; + } + private: void initializeConcreteProcess( NumLib::LocalToGlobalIndexMap const& dof_table, @@ -176,6 +182,8 @@ private: std::vector<MeshLib::PropertyVector<double>*> _residua; AssembledMatrixCache _asm_mat_cache; + + bool const _ls_compute_only_upon_timestep_change; }; } // namespace ComponentTransport diff --git a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp index 0082703f4366ac86a6b40c75a928b85d67fe078f..d10f328f2fc5be39af90ecedf00593bbd2f6d22f 100644 --- a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp @@ -256,6 +256,11 @@ std::unique_ptr<Process> createComponentTransportProcess( //! \ogs_file_param{prj__processes__process__ComponentTransport__is_linear} config.getConfigParameter("is_linear", false); + auto const ls_compute_only_upon_timestep_change = + //! \ogs_file_param{prj__processes__process__ComponentTransport__linear_solver_compute_only_upon_timestep_change} + config.getConfigParameter( + "linear_solver_compute_only_upon_timestep_change", false); + auto const rotation_matrices = MeshLib::getElementRotationMatrices( mesh_space_dimension, mesh.getDimension(), mesh.getElements()); std::vector<Eigen::VectorXd> projected_specific_body_force_vectors; @@ -298,7 +303,8 @@ std::unique_ptr<Process> createComponentTransportProcess( integration_order, std::move(process_variables), std::move(process_data), std::move(secondary_variables), use_monolithic_scheme, std::move(surfaceflux), - std::move(chemical_solver_interface), is_linear); + std::move(chemical_solver_interface), is_linear, + ls_compute_only_upon_timestep_change); } } // namespace ComponentTransport