Restart from a linear combination #644
-
Hello, I'm new to NekRS and I would like to ask if it's possible to perform a restart from a linear combination of two previous solution fields. I've seen in the documentation that it's possible to initialize a run using fields from different .fld files, selecting which field to use from each file. However, I haven't found any mention of the possibility of computing a linear combination of the same fields from two different solution files as the initial condition. Is this functionality currently supported in NekRS, or would it require a custom implementation? Any help would be appreciated. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
On master, you could do:
You now have the data in Repeat with the second field, but this time do Run On next, you have direct access to the read methods in |
Beta Was this translation helpful? Give feedback.
-
For the Line 743 in 5152fec |
Beta Was this translation helpful? Give feedback.
On master, you could do:
You now have the data in
nrs->U
,nrs->p
andnrs->cds->S
.Allocate a temporary helper array on the device (platform->device.malloc) where you copy the data to, slice it for U, p, and S.
Repeat with the second field, but this time do
nek::ocopyFromNek(curtime)
, the data is now in the correct target arrays.Run
platform->linalg.axpby
to compute the linear combination. The result will be in the device arrays.On next, you have direct access to the read methods in
iofld
so you don't have to do the hack with setting the restart filename.