KratosMultiphysics / Kratos

Kratos Multiphysics (A.K.A Kratos) is a framework for building parallel multi-disciplinary simulation software. Modularity, extensibility and HPC are the main objectives. Kratos has BSD license and is written in C++ with extensive Python interface.
https://kratosmultiphysics.github.io/Kratos/
Other
991 stars 244 forks source link

Add SetTime method for cosimulation solver_wrapper #12399

Closed ghanique-altair closed 1 month ago

ghanique-altair commented 1 month ago

📝 Description This development enable to send the global time of a cosimulation to a steady solver through the solver_wrapper. This is only usefull for steady solvers which need to update parameters depending on the global time and then reproduce a so-called transient behavior.

🆕 Changelog

philbucher commented 1 month ago

Thanks for the contribution Please give me a few day to think about this, maybe there is a better way of doing this I coupled with steady state solvers before, then it was working

ghanique-altair commented 1 month ago

Any news ?

philbucher commented 1 month ago

AdvanceInTime already get the current global time, did you try using this?

ghanique-altair commented 1 month ago

For sure I tried, but in the case, the time sent to the steady solver is one step late.

philbucher commented 1 month ago

But AdvanceInTime is called before your proposed SetTime method

ghanique-altair commented 1 month ago

AdvanceInTime get the currentTime from the transient solver, so you have to wait for the next call of AdvanceInTime to be able to sent that time value to a steady solver, so it is one step late.

philbucher commented 1 month ago

Ok now I understand

Given that the global time is already in the processInfo of the coupled solver, I am leaning towards passing this one to the solver-wrappers. Checking it now ...

philbucher commented 1 month ago

can you check if it works with my commit?

Now you can access the global time from the solver wrapper

ghanique-altair commented 1 month ago

Ok, thanks to your modification I can access to the global time of the cosimulation in my Flux solver_wrapper by using 'solver'._parent_process_info[KM.TIME]. This way will be deliver in the Flux solver_wrapper (delivered in Flux setup). Can you commit your modification in the main branch of Kratos ?

philbucher commented 1 month ago

Can you commit your modification in the main branch of Kratos ?

yes, will happen automatically as soon as the pipelines passed