Log Output Example

Location: examples/rappture2/log/

This example demonstrates the <log> output type – a textual record of simulation results displayed as preformatted text.

Script

import sys
import rappture2web.rp_library as Rappture

rx = Rappture.PyXml(sys.argv[1])

rx['output.log'] = """****** ADEPT/F - 2.1   Sat Jul 30 19:39:36 2005 ******

   1 *title  input generated by adeptwr
   2 mesh  nx=250 xres=0.5
   3 misc  tempk=300

 ******execution time =        0.1 cpu seconds."""

rx.close()

Key concepts

  • Assign a multi-line string directly to output.log.

  • The log is displayed as monospaced text in the output panel.

  • This is useful for echoing solver output or progress information.

tool.xml

<?xml version="1.0"?>
<run xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../../rappture2web/contract.xsd">
<tool>
  <title>log (rappture2web)</title>
  <about>Example of Rappture &lt;log&gt; output.

Each run can produce an output log--a textual record of simulation results.

When you click the Simulate button, this tool will produce a single &lt;log&gt; element.
  </about>
  <command>python3 @tool/log.py @driver</command>
  <contract>
    <output>
      <log id="log"><about><label>Simulation Log</label><description>Example log text output.</description></about></log>
    </output>
  </contract>
</tool>
<input>
</input>
</run>

Running

rappture2web examples/rappture2/log/