ok, put a bunch of breaks in at the various points it pulls enthalpy/heat capacity. it appears the problem is within the EffectiveHeatCapacity subroutine.
the first time through the transient model, because there is no previous timestep, even with Phase Change Model = 'Temporal' it instead uses 'Spatial 1' to calcualte the initial material enthalpy. I.e., in Line 1594, TSolution is not yet allocated, so it executes the ELSE PhaseChangeModel= PHASE_SPATIAL_1 in line 1604.
This affects how it pulls the enthalpy from the sif file definitions. In Spatial 1, first at line 1635 it checks to see if an "Effective Heat Capacity" is defined. It's not, so then it checks at 1638 to see if properties are defined per mass (specific) or per volume. Mine isn't specific, so it goes on to execute 1643 to get a heat capacity:
Code: Select all
HeatCapacity(1:n) = ListGetDerivValue( Material, &
'Enthalpy', n,Element % NodeIndexes )
Now, when Enthalpy = Variable Temperature is defined with a table, at this point Heat Capacity is populated with legitimate values. It finishes all elements for this first iteration. then, for the second iteration, because there's a previous timestep, it sets PhaseChangeModel =PHASE_TEMPORAL, and from then on it uses lines 1658-1676 to determine HeatCapacity, which apparently works fine.
Doing nothing more than switching to the MATC definition, however, it never gets any value of HeatCapacity during the first iteration when it goes through PHASE_SPATIAL_1. It goes through the same program path, but I guess that ListGetDerivValue function fails in some way when it's not a table. I noticed there's no logical 'GotIt" check on the function, so it carries on desipite getting nothing.
If CheckLatentHeatRelease = False, then it will go through with bad values to the second iteration, and at the second iteration it will go through the PHASE_TEMPORAL structure, and from then on it works correctly. HOWEVER, if you set "CheckLatentHeatRelease = True", it sees the large error, reduces the timestep, and reruns the first iteration. Thus it goes through PHASE_SPATIAL_1 again, HeatCapacity stays at zeros, it checks the large error, reduces the timestep, reruns the first iteration... etc., etc. ad infinitum.
SO, THERE's THE PROBLEM! I'll start looking to tweak it to see if I can find a fix.