wecopttool.pto.PTO.post_process
- PTO.post_process(wec, res, waves=None, nsubsteps=1)[source]
Transform the results from optimization solution to a form that the user can work with directly.
Examples
The
wecopttool.WEC.solve()
method only returns the raw results dictionary produced byscipy.optimize.minimize()
.>>> res_opt = wec.solve(waves=wave, obj_fun=pto.average_power, nstate_opt=2*nfreq+1)
To get the post-processed results for the
wecopttool.pto.PTO
, you may call>>> res_pto_fd, res_pto_td = pto.post_process(wec,res_opt[0],wave)
For smoother plots, you can set
nsubsteps
to a value greater than 1.>>> res_pto_fd, res_pto_td = pto.post_process(wec,res_opt, nsubsteps=4) >>> res_pto_td[0].power.plot()
- Parameters:
wec (WEC) –
wecopttool.WEC
object.res (OptimizeResult | list) – Results produced by
wecopttool.WEC.solve()
.waves (DataArray | None) –
xarray.Dataset
with the structure and elements shown bywecopttool.waves
.nsubsteps (int | None) – Number of steps between the default (implied) time steps. A value of
1
corresponds to the default step length.
- Returns:
results_fd – list of
xarray.Dataset
with frequency domain results.results_td – list of
xarray.Dataset
with time domain results.
- Return type:
tuple[list[Dataset], list[Dataset]]