How do we get initial data? That depends on the structure of the original program. In this case, the evolution routine detects when it is being called the first time and produces its own initial data. When the evolver is run, it will give a warning that it can't read the initial data file and will expect the update to do its own initialization.
If, on the other hand, there is a separate initial data generator which produces a file, then we could simply insert some calls to write the data into an initial data HDF file. RNPL produces these calls in a file called initfrag.f. In this case the file contains:
!---------------------------------------------------------------------- ! Code fragment for creating initial data file !---------------------------------------------------------------------- call rnpl_id_set_file('idfile.hdf') call rnpl_id_set_rank(3) call rnpl_id_set_shape(101,101,101) call rnpl_id_write('phre[0]',phre_n) call rnpl_id_set_rank(3) call rnpl_id_set_shape(101,101,101) call rnpl_id_write('phim[0]',phim_n) call rnpl_id_set_rank(3) call rnpl_id_set_shape(101,101,101) call rnpl_id_write('v[1]',v_n) call rnpl_id_write('v[0]',v_nm1) call rnpl_id_set_rank(3) call rnpl_id_set_shape(101,101,101) call rnpl_id_write('rho[0]',rho) call rnpl_id_set_rank(3) call rnpl_id_set_shape(101,101,101) call rnpl_id_write('nu[0]',nu) call rnpl_id_set_rank(3) call rnpl_id_set_shape(101,101,101) call rnpl_id_write('vnph[0]',vnph) call rnpl_id_end()
We just insert this into the initial data program and edit the shape information and the grid function names. Do NOT edit the names inside the single quotes, just the actual variable names. In our case we might edit the file to look like this:
!---------------------------------------------------------------------- ! Code fragment for creating initial data file !---------------------------------------------------------------------- call rnpl_id_set_file('bosid.hdf') call rnpl_id_set_rank(3) call rnpl_id_set_shape(nx,ny,nz) call rnpl_id_write('phre[0]',phren) call rnpl_id_set_rank(3) call rnpl_id_set_shape(nx,ny,nz) call rnpl_id_write('phim[0]',phimn) call rnpl_id_set_rank(3) call rnpl_id_set_shape(nx,ny,nz) call rnpl_id_write('v[1]',vn) call rnpl_id_write('v[0]',vnm1) call rnpl_id_set_rank(3) call rnpl_id_set_shape(nx,ny,nz) call rnpl_id_write('rho[0]',rho) call rnpl_id_set_rank(3) call rnpl_id_set_shape(nx,ny,nz) call rnpl_id_write('nu[0]',nu) call rnpl_id_set_rank(3) call rnpl_id_set_shape(nx,ny,nz) call rnpl_id_write('vnph[0]',vnph) call rnpl_id_end()
We can then name the initial data generator bos0_init and the evolver will automatically call it to generate the initial data. More information about these routines is provided in chapter 4 below.