Restarting a USim SimulationΒΆ

Restart in USim is performed on the command line with the -r option. To restart from dump 5 in parallel enter:

mpiexec -np 4 ulixes -i sodshock.in -r 5

Restart in USim can be tricky so for large problems it’s best to first test restart to make sure that you’ve dumped out all the required data and furthermore that you’ve included the correct updater in the restoreOnly loop and entered the proper synchronization during the restoreOnly loop. The restore loop should include all the entities that are generated along with anything in the initialization loop that does not overwrite the data you are reading in. An example of the restoreOnly loop and the associated UpdateStep is:

<UpdateStep generateStep>
  updaters = [generateOpen, generateWall, generateInflow, generateNoInflow]
  syncVars = [q]
</UpdateStep>

restoreOnly=[generateStep]

Geometry is regenerated at the beginning of every simulation regardless of whether it is restarted or no. Secondly, all DataStruct write their data out to file by default unless writeOut=false (or 0). All the DataStructs that have been written out will be written in. It is best not to modify the writeOut option before a simulation is restarted since USim only reads in values whose writeOut value is true (the default). The example below is a fairly typical input file using an unstructured grid. The input file uses the entityGenerator which is typically called only once during the initialization step. Restore will work properly in this case only if the entity generators are also called with the restoreOnly option. The startOnly loop is not called on restart so restoreOnly acts as it’s substitute for restart. The reason for this is simple, during restart we do not want to initialize our DataStruct since they are being read in, however we do want to initialize geometric quantities. One final important point to make, in addition to reading in the proper data synchronization must be performed across the DataStructs that are read in. In the example below our step generateStep initialized entities and synchronizes the DataStruct q.

An example of a USim input file that illustrates the concepts described above is given below:

<Component fluids>
  kind = updaterComponent

  <Grid domain>
    kind = unstructured

    writeGeom = true
    writeConn = true
    ghostLayers = 2
    decomposeHalos = false

    <Creator ctor>
      kind = gmsh
      ndim = 2
      file = rampgeom4.msh
    </Creator>
  </Grid>

  <DataStruct q>
    kind = nodalArray
    numComponents = 5
    onGrid = domain
  </DataStruct>

  <DataStruct dummy1>
    kind = nodalArray
    numComponents = 5
    onGrid = domain
    writeOut = false
  </DataStruct>

  <DataStruct qnew>
    kind = nodalArray
    numComponents = 5
    onGrid = domain
    writeOut = false
  </DataStruct>

  .
  .
  .

  <Updater generateOpen>
    kind = entityGenerator2d
    onGrid = domain
    newEntityName = openBoundary
    onEntity = ghost
    <Function mask>
      kind = exprFunc
      exprs = ["if( (x>0.001) and (y>0.34),1.0,-1.0)"]
    </Function>
  </Updater>

  <Updater generateWall>
    kind = entityGenerator2d
    onGrid = domain
    newEntityName = wallBoundary
    onEntity = ghost
    <Function mask>
      kind = exprFunc
      exprs = ["if( (x>0.01) and (y<0.35),1.0,-1.0)"]
    </Function>
  </Updater>

  <Updater generateInflow>
    kind = entityGenerator2d
    onGrid = domain
    newEntityName = inflowBoundary
    onEntity = ghost
    <Function mask>
      kind = exprFunc
      exprs = ["if(x<0.01,1.0,-1.0)"]
    </Function>
  </Updater>

  <Updater generateNoInflow>
    kind = entityGenerator2d
    onGrid = domain
    newEntityName = noInFlowBoundary
    onEntity = ghost
    <Function mask>
      kind = exprFunc
      exprs = ["if(y<0.0,1.0,-1.0)"]
    </Function>
  </Updater>

  .
  .
  .

  <UpdateStep initStep>
    updaters = [initdn]
  </UpdateStep>

  <UpdateStep generateStep>
    updaters = [generateOpen, generateWall, generateInflow, generateNoInflow]
    syncVars = [q]
  </UpdateStep>

  .
  .
  .

  <UpdateSequence seq>
    startOnly = [initStep, generateStep]
    restoreOnly = [generateStep]
    loop = [boundaryStep, hyperStep, copyStep]
  </UpdateSequence>

</Component>