1
\$\begingroup\$

I am using LT spice to simulate a thermal problem involving a phase-change material (a paraffin). [thermal simulation1

with the paraffin modeled as a non-linear capacitor and resistor (the capacitor represents the heat capacity, the resistor the thermal conductivity: Paraffin simulation block Note: the thermal resistance is simulated as a voltage-controlled current source because a normal resistor can't handle if() statements in its value, even in parameters.

For thermal simulations, the voltages in the circuit equate to temperatures in Kelvin and current equates to heat-flow. (See, for instance, Learn LTSpice: A Tutorial The non-linear capacitor has the equation

Q = {PCM_mass_g} * if(
    V(Heat_In) <= ({Tm} - ({epsilon}/2)), 
    (x*{Cps}),
    if(
        V(Heat_In)>=({Tm}+({epsilon}/2)
      ), 
      ({Cps}*{Tm}+{Hfus}*{Cpl}*(x-{Tm})),
      (
        ({C3}*((x-{deltaTc})**3)) + ({C2}*((x-{deltaTc})**2)) +({C1}*(x-{deltaTc}))+{C0}
      )
    )
)

epsilon is a small band around the melting point. Below temperature = (Tmelting - epsilon/2) the thermal capacity has the value for a solid; above (Tmelting + epsilon/2) it has another value for the liquid form, and within the epsilon band it is a complex polynomial that describes the heat of fusion for the material.

The equation should be reasonably continuous, at least it is in the spreadsheet:

Spreadsheet heat capacity calculations

But whenever the simulation voltage V(a) hits (Tmelting-epsilon/2) LTSpice throws a "timestep too small" error.

I will be most grateful for any suggestions as to how to get around this!

\$\endgroup\$
6
  • \$\begingroup\$ Normally I throw in small, negligible resistors here and there so things do not have to happen instantly and there is something to provide some give and take up slack in the system. Without them, you often have unstoppable force versus immovable object contradictions where things have to happen both instantly and not at all. \$\endgroup\$
    – DKNguyen
    Jan 30 at 20:47
  • \$\begingroup\$ What's the .SUBCKT? The complete model would be a big help. \$\endgroup\$
    – jonk
    Jan 30 at 21:10
  • \$\begingroup\$ There isn't a SUBCKT per se. Just the "Q=..." definition. The current source is "I=(V(Heat_In)-V(Heat_Out))*((if((V(Heat_In)>{Tm}),{tcl},{tcs})*{PCM_area_m2})/{PCM_depth_m})" \$\endgroup\$
    – Paul Blase
    Jan 30 at 22:15
  • 1
    \$\begingroup\$ That looks scary. I haven't ran your formula, but did you make sure it's the integrated version of the desired result? The manual (LTspice > Circuit Elements > C) clearly says "LTspice will compile this expression and symbolically differentiate it with respect to all the variables, finding the partial derivative's that correspond to capacitances" (more on this). I would use that expression in a bi source with a unity value capacitor in parallel (and 1G resistor), then take that voltage to Q= (+ maybe a small cap across). \$\endgroup\$ Jan 30 at 22:15
  • 1
    \$\begingroup\$ Also take care of this. \$\endgroup\$ Jan 30 at 22:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.