Using CREDO to run and analyse a Rayleigh-Taylor problem in Underworld

This examples shows how to use CREDO to run a simple single Underworld job, and perform some basic post-processing on the results, such as getting relevant values from the FrequentOutput.dat, and plotting observables of interest.

Setup

The script to run a Rayleigh Taylor model is as included below, currently in the Underworld/InputFiles directory:

The script above the #—————– comment line is setting up and running the model, and that below it is for doing some simple post-processing and analysis of the result.

Essentially, what we are doing is setting up a ModelRun to run the “RayleighTaylorBenchmark.xml” model, with some small customisations to some of the parameters. We also specify to save information about the model run via the writeInfoXML() method and writeModelResultsXML() function.

See also

Modules credo.modelrun and credo.modelresult

Looking at the post-processing in more detail:

We first use the readFrequentOutput() method to read the FrequentOutput.dat results into memory and make them accessible through CREDO, bound to a freqOutput attribute of the mRes object. We are then able to use various methods of this credo.io.stgfreq.FreqOutput class to query the Frequent Output for properties of interest - in this case the maximum value of the “Vrms” property, the time this occurred. We also use the plotOverTime() method to plot and save a graph of the value of Vrms over time in the model.

See also

The credo.io.stgfreq.FreqOutput class, especially the plotOverTime() method.

Outputs

Running this script at the terminal produces:

Running model 'RayTay-basicBenchmark' with command 'mpirun -np 1 /home/psunter/AuScopeCodes/stgUnderworldE-credoDev-work/build/bin/StGermain RayleighTaylorBenchmark.xml credo-analysis.xml  --gravity=1 > logFile.txt' ...
Model ran successfully.
Maximum value of Vrms was 0.000365, at time 64

Where the last line is the result of our post-processing query.

If you have Matplotlib installed, it will also produce a pop-up window showing the graph of VRMS against time, something like that shown below:

../_images/Vrms-timeSeries1.png

In the script above you can see the output path requested for the model was ./output/raytay-scibench-credo-basic.

If you have a look at the contents of the directory, as well all of the standard output that an Underworld run saves [1], you’ll see several things specific to CREDO:

  • An credo-analysis.xml file, recording a summary StGermain format XML of over-rides or new components created to complete the required analysis specified in the CREDO script;
  • ModelRun-RayTay-basicBenchmark.xml and ModelResult-RayTay-basicBenchmark.xml files, which keep a record of what CREDO was asked to run and the result it produced
  • Vrms-timeSeries.png, a saved copy of the image shown above [2].

The contents of the ModelRun and ModelResult XML files should look something like the below:

<StgModelRun>
  <name>RayTay-basicBenchmark</name>
  <modelInputFiles>
    <inputFile>RayleighTaylorBenchmark.xml</inputFile>
  </modelInputFiles>
  <outputPath>output/raytay-scibench-credo-basic</outputPath>
  <jobParams>
    <nproc>1</nproc>
  </jobParams>
  <simParams>
    <restartstep>None</restartstep>
    <stoptime>60.0</stoptime>
    <nsteps>None</nsteps>
    <dumpevery>1</dumpevery>
    <cpevery>1</cpevery>
  </simParams>
  <paramOverrides>
    <param modelPath="gravity" paramVal="1" />
  </paramOverrides>
  <analysis />
</StgModelRun>

... and:

<StgModelResult>
  <modelName>RayTay-basicBenchmark</modelName>
  <outputPath>output/raytay-scibench-credo-basic</outputPath>
  <jobMetaInfo>
    <simtime>64.0557</simtime>
  </jobMetaInfo>
</StgModelResult>

You will see that they save essential quantities about the run requested and the result [3].

Footnotes

[1]such as FrequentOutput.dat, and a record of the flattened XML produced by the run as input.xml. For more on these, see the Underworld manual.
[2]Note it’s possible not to save these images, by passing save=False as a keyword argument to the plotOverTime method (see plotOverTime()).
[3]Note: in future, we plan to provide the capability to read in a ModelResult.xml file into CREDO, which will create a ModelResult object for post-processing. However as yet this capability isn’t included.