PHASTA/phastaChef

switch between openfile and openstream

Closed this issue · 5 comments

I found an issue with openfile/openstream in phastaChef level.

When we restart the case with phastaChef, we would like to read data from files (restart files saved from the previous run). But once the loop is started, we would like to read data from stream. Thus, I think we need to add a switch in chef level so phastaChef can call it to switch between openfile and openstream.

This driver:
https://github.com/PHASTA/phastaChef/blob/478cedc376196f37deb265ec43eb0c10a58fffa1/chef_phasta_sam_adaptLoop.cc
reads a mesh, attaches fields from restart files, runs the pre-processor, and then enters a loop that uses streams between the phasta solver and chef. Is this what you want to do? If not, can you point me at the driver you are using and indicate where the problem is?

I am using this driver:
https://github.com/yangf4/phastaChef/blob/master/loopChefPhasta.cc#L91

The reading, attaching and pre-processing part is warped in chef:cook.

And openfile/openstream is determined at chef level:
https://github.com/SCOREC/core/blob/master/phasta/phCook.cc#L259-L285

based on which chef::cook is called

I think these are the lines missing from the loopChefPhasta.cc driver:

/* setup stream reading */
ctrl.openfile_read = openstream_read;
ctrl.rs = rs;

Take a closer look at the chef_phasta_sam_adaptLoop.cc driver. I think everything you need is already there.

I saw that and I agreed with you.

But I have two concerns:

  1. duplicated code. We also have openstream_read in chef:
    https://github.com/SCOREC/core/blob/master/phasta/phCook.cc#L117

  2. PHASTAIO_OPENTIME is used in chef level. But phastaChef doesn't have this feature.
    https://github.com/SCOREC/core/blob/master/phasta/phCook.cc#L122