Lemonergy Wiki

Worked examples

Iron rod: insulated heating

Integrate the temperature of a uniform insulated rod heated with a constant 18 W input.

Document created Updated
Editorially reviewedSource record reviewed

Integrate the temperature of an insulated thermal mass

Heat a uniform rod with a constant 18 W source and follow its temperature for 100 s. This Lemonergy example introduces a Thermal balance block and an Integrator: one calculates the temperature rate, the other stores the temperature state.

The complete mw-thermal-insulated case, reference version 1, contains four prepared blocks and four connections, executed by the Rust/WebAssembly solver. It is a useful starting point before adding the ambient losses in the lumped rod transient.

Open the prepared model

Open prepared examples and choose Iron rod: insulated heating. The complete supplied model loads automatically. Choose Run prepared model to calculate a fresh result with Rust/WebAssembly, then select blocks to inspect their read-only parameters and connections. You can download the original model data for reference.

The public viewer lets you inspect, run and explore this prepared example. To change parameters, connect blocks, import a file or save an edited model, choose Edit with Pro. The Design app opens the selected example in its authenticated Pro editor; the workflow guide explains both experiences.

The insulated-heating model in Lemonergy, with heat input, thermal balance and temperature integrator.
Iron rod: insulated heating: the complete prepared graph and Display outputs in the public Lemonergy example viewer. Fit, zoom and scroll reveal its connected blocks; the graph is read-only. Captured .

Define the heat capacity and balance

The rod has one uniform temperature and no heat loss to its surroundings. Its heat capacity is mass times specific heat:

A = π D² / 4
Cth = ρ c A L
Cth dT/dt = Q
T(t) = T0 + (Q/Cth) t
Active input or derived quantityValueMeaning
Diameter D0.025 mCross-section geometry
Length L0.2 mVolume geometry
Density ρ7800 kg/m³Converts volume to mass
Specific heat c447 J/(kg·K)Material heat storage
Derived heat capacity CthApproximately 342.296154563 J/KStored in the Thermal balance parameter
Initial temperature T020 °C = 293.15 KIntegrator initial state
Heat input Q18 WConstant energy input per second
Ambient conductance0 W/KNo environmental heat loss
Observation window0–100 sAuthored transient interval

The source metadata also carries conductivity 80.2 W/(m·K) and convection coefficient 32.1 W/(m²·K), but neither is active in this insulated graph. The material and geometry values are already combined in Cth; changing a written geometry label does not change that live block parameter.

The solver stores temperature in kelvin and rate in K/s. The comparison displays temperature in °C. A rise of 1 K is a rise of 1 °C, so converting the absolute temperature does not alter the slope.

Inspect the blocks and feedback path

Select a block in the prepared diagram to inspect its read-only parameters and connections. The full inventory is two Constant blocks, one Thermal balance and one Integrator.

Block ID · typeParametersConnection and role
imposed-heat · ConstantValue 18 W; heat outputFeeds the generated-heat input of Thermal balance
ambient-temperature · ConstantValue 293.15 K; temperature outputFeeds the ambient-temperature input
temperature-rate · Thermal balanceHeat capacity 342.29615456269295 J/K; ambient conductance 0 W/KReturns [Q − H(T − Tair)]/Cth in K/s
rod-temperature · IntegratorInitial 293.15 K; rate gain 1; temperature-rate inputIntegrates the rate and feeds temperature back to the balance
The insulated-heating example's selected block and parameter values inside Lemonergy.
Iron rod: insulated heating: read-only parameters and connections for the selected temperature-rate block. Pro opens the model editor for changes. Captured .

The temperature feedback and ambient input are connected even though H is zero. They make the Thermal balance interface explicit; the ambient source has no effect while the conductance remains zero. The Integrator breaks the state feedback path, so the model does not require an instantaneous algebraic loop.

Run both temperature and rate comparisons

  1. Confirm Iron rod: insulated heating is selected and loaded, with four blocks and four connections.
  2. Inspect the Thermal balance's heat capacity and zero conductance, then the Integrator's 293.15 K initial value.
  3. Keep Dormand–Prince 4(5), start 0 s, end 100 s, initial step 0.01 s, minimum 1e−10 s, maximum 5 s, relative tolerance 1e−11 and absolute tolerance 1e−12. Maximum steps is 100,000.
  4. Choose Run prepared model. Confirm Passed and trace completeness passed.
  5. In Scope signal, inspect Rod temperature, then Heating rate. Temperature rises linearly; rate stays constant. Examine both error plots.
  6. Choose Download run evidence to retain the fresh model/result comparison and Download results CSV for the sampled signals. The original model data is available under Model, method and references.

Algebraic tolerance/iteration limit is 1e−10/30; implicit tolerance/iteration limit is 1e−10/20. See read validation results if the traces look plausible but the contract or a gate fails.

After the run, move Display time to inspect numerical Display outputs at retained solver times. Choose a signal’s Scope button, or use Scope signal, to view its full trajectory and reference-error plot. Scrubbing changes the inspected time, not the prepared model or its result.

Expected temperature rise

The insulated-heating result in Lemonergy with its reference overlay and error plot.
Iron rod: insulated heating: fresh Rust/WebAssembly results captured on 2026-10-10. The numerical checks, Scope overlay and error plot come from this same successful run. Captured .

The calculated rate is 18/342.29615456269295 ≈ 0.052586042116 K/s. These rounded analytical checkpoints make the expected trajectory readable:

Time (s)Temperature (°C)Added energy Q t (J)
020.0000000000
2521.314651053450
5022.629302106900
10025.2586042121800

Multiplying the final rise by Cth returns 1800 J. This is a balance check derived from the model; the example compares temperature and rate rather than exporting a separate energy-residual signal.

The retained reference report, generated 1 October 2026 at 19:06:01 UTC, passed with 25 output points. Its temperature maximum error was 3.907985e−13 °C against the 1e−7 °C gate. The rate is compared with the printed value 0.0526 K/s, giving a maximum difference of 1.395788e−5 K/s against a 0.00005 K/s gate. Historical report values are distinct from the fresh application capture.

The different errors have different meanings: temperature uses an independently derived full-precision trajectory, while rate uses a rounded printed scalar. The rate discrepancy is expected rounding, not accumulating numerical drift. The display checkpoints above are also rounded and are not acceptance thresholds.

Try a controlled edit (Pro)

Choose Edit with Pro to open this example in the authenticated Design editor. The following changes require Pro editing. Use Run blocks & compare there to solve the edited graph; the public prepared model stays unchanged.

Select Heat input · W and change its value from 18 to 19.8 W. The input rises 10%, so the predicted rate becomes approximately 0.057844646328 K/s and the 100 s temperature becomes approximately 25.784464633 °C.

Run again. Both original comparisons should fail because the reference remains fixed to 18 W. Save the variant separately, then Load reference blocks and rerun to restore the case. As another physical interpretation, increasing Cth while keeping Q fixed would reduce the slope; edit the Thermal balance parameter when exploring that effect.

Troubleshoot the transient

SymptomWhat to inspect
Temperature remains constantConfirm heat reaches Thermal balance and rate reaches the Integrator
Temperature approaches a plateauAmbient conductance must be zero for this case
Correct slope but wrong starting pointIntegrator initial value must be 293.15 K
Temperature rises much too quicklyHeat capacity is in J/K and heat input is in W, not kW
Rate differs slightly from 0.0526Expected: the reference rate is printed to four decimal places

Scope, source and next steps

Uniform temperature and constant material properties are assumptions. There is no spatial field, radiation, conduction to a support or measured rod trace. The 100 s horizon is authored. Numerical agreement verifies this balance and its integration for the stated settings, not physical accuracy under arbitrary heating conditions.

The rod inputs and rounded heating-rate answer are attributed to MathWorks, Heat Conduction Through Iron Rod. The transient is independently derived from the heat balance; the external application was not executed for the retained report.

Continue with the lumped transient to combine heat storage and losses, or passive heat exchange between two cells to examine two interacting thermal states and an explicit energy residual. The validation index links the full collection.

Models and evidence

  • Open Block validation
  • Download original model data 6367 bytes
    Artifact provenance

    Repository origin: outputs/validation-performance/models/mw-thermal-insulated.lemon.json

    SHA-256: f8c8b5346aca6c279ecb4a2abcfdec15c549a0425378be55d50d5332872529ff

  • Download reference-case evidence (JSON) 48240 bytes
    Artifact provenance

    Repository origin: outputs/validation-performance/native.json

    SHA-256: 2523aa6c919662d18fd11226a2f72d0f555a555ed24e162c05505ba22b91814f

  • Download reference contract (JSON) 22401 bytes
    Artifact provenance

    Repository origin: benchmarks/cross-tool/matlab-campaign/evidence/reference.json

    SHA-256: 5fafd62331140b6ea2c47df3ba25dcaed14632d63e1b9a6e0537fc31c688d171

Downloads preserve recorded inputs and results. Opening a saved result does not run a new simulation.

Related papers and references

  • article

    MathWorks: Heat Conduction Through Iron Rod

    MathWorks

    The retained campaign contract records the iron-rod inputs and printed answers for Examples 1–3. Campaign source notes record a September 30, 2026 check. The local linear and lumped exponential trajectories are analytical constructions, not downloaded Simscape traces.

    Read original

    Bibliographic reference · contents not reviewed · Example 3: insulated rod heating; printed heating-rate answer 0.0526 °C/s and retained material/geometry inputs.