diff --git a/ProcessLib/LocalAssemblerInterface.cpp b/ProcessLib/LocalAssemblerInterface.cpp index bdc455178f18ba8c612afb4c52dd14bfe9e5700b..98c59588e90c2d5dfc145debf987455c67a3e9f2 100644 --- a/ProcessLib/LocalAssemblerInterface.cpp +++ b/ProcessLib/LocalAssemblerInterface.cpp @@ -78,6 +78,16 @@ void LocalAssemblerInterface::computeSecondaryVariable( computeSecondaryVariableConcrete(t, local_x); } +void LocalAssemblerInterface::setInitialConditions( + std::size_t const mesh_item_id, + NumLib::LocalToGlobalIndexMap const& dof_table, GlobalVector const& x) +{ + auto const indices = NumLib::getIndices(mesh_item_id, dof_table); + auto const local_x = x.get(indices); + + setInitialConditionsConcrete(local_x); +} + void LocalAssemblerInterface::preTimestep( std::size_t const mesh_item_id, NumLib::LocalToGlobalIndexMap const& dof_table, GlobalVector const& x, diff --git a/ProcessLib/LocalAssemblerInterface.h b/ProcessLib/LocalAssemblerInterface.h index 4c22ce42d919eb07d7405bc47e2b9abdbabc2964..02cb41bcd1b20f2c9c35893eae3a751afed69a64 100644 --- a/ProcessLib/LocalAssemblerInterface.h +++ b/ProcessLib/LocalAssemblerInterface.h @@ -34,6 +34,10 @@ class LocalAssemblerInterface public: virtual ~LocalAssemblerInterface() = default; + virtual void setInitialConditions( + std::size_t const mesh_item_id, + NumLib::LocalToGlobalIndexMap const& dof_table, GlobalVector const& x); + virtual void preAssemble(double const /*t*/, std::vector<double> const& /*local_x*/){}; @@ -96,6 +100,11 @@ public: } private: + virtual void setInitialConditionsConcrete( + std::vector<double> const& /*local_x*/) + { + } + virtual void preTimestepConcrete(std::vector<double> const& /*local_x*/, double const /*t*/, double const /*dt*/) { diff --git a/ProcessLib/Process.cpp b/ProcessLib/Process.cpp index 5c6bb2843b3f41bd2c0f5a18f2a88cd05dae6be3..57ef8b47d93829813f8a84e88a6888b1f72c04d9 100644 --- a/ProcessLib/Process.cpp +++ b/ProcessLib/Process.cpp @@ -121,6 +121,7 @@ void Process::setInitialConditions(const int process_id, double const t, variable_id < per_process_variables.size(); variable_id++) { + MathLib::LinAlg::setLocalAccessibleVector(x); SpatialPosition pos; auto const& pv = per_process_variables[variable_id]; @@ -163,6 +164,7 @@ void Process::setInitialConditions(const int process_id, double const t, } } } + setInitialConditionsConcreteProcess(x); } MathLib::MatrixSpecifications Process::getMatrixSpecifications( diff --git a/ProcessLib/Process.h b/ProcessLib/Process.h index d1d22bdfb4101c4c5508e3259da36d2451c05add..44c099591af6ce7117ef48f12a2990677552fc88 100644 --- a/ProcessLib/Process.h +++ b/ProcessLib/Process.h @@ -176,6 +176,10 @@ private: /// processes. It is called by initialize(). virtual void initializeBoundaryConditions(); + virtual void setInitialConditionsConcreteProcess(GlobalVector const& /*x*/) + { + } + virtual void preAssembleConcreteProcess(const double /*t*/, GlobalVector const& /*x*/) {