Skip to content

Commit afae25a

Browse files
authored
Avoid edge case where liquid cells remain and time steps are skipped (#191)
* Avoid edge case where liquid cells remain and time steps are skipped * Added comments clarifying new variable/future update
1 parent fd94e73 commit afae25a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/CAupdate.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ void FillSteeringVector_Remelt(int cycle, int LocalActiveDomainSize, int nx, int
138138
bool atMeltTime = (cycle == MeltTimeStep(GlobalD3D1ConvPosition));
139139
bool pastCritTime = (cycle > CritTimeStep(GlobalD3D1ConvPosition));
140140
if ((atMeltTime) && ((cellType == TempSolid) || (cellType == Active))) {
141-
// This cell should be a liquid cell
141+
// FIXME: Active cells that didn't finish their previous solidification event should have that
142+
// solidification event skipped instead of having both this one and the previous one complete This cell
143+
// should be a liquid cell
142144
CellType(GlobalD3D1ConvPosition) = Liquid;
143145
// Reset current undercooling to zero
144146
UndercoolingCurrent(GlobalD3D1ConvPosition) = 0.0;
@@ -749,10 +751,12 @@ void IntermediateOutputAndCheck_Remelt(
749751
XSwitch = 1;
750752
}
751753
MPI_Bcast(&XSwitch, 1, MPI_INT, 0, MPI_COMM_WORLD);
754+
// Cells of interest are those currently undergoing a melting-solidification cycle
755+
unsigned long int RemainingCellsOfInterest = GlobalActiveCells + GlobalSuperheatedCells + GlobalUndercooledCells;
752756
if ((XSwitch == 0) && ((TemperatureDataType == "R") || (TemperatureDataType == "S")))
753-
JumpTimeStep(cycle, GlobalActiveCells, LocalTempSolidCells, MeltTimeStep, LocalActiveDomainSize, MyYSlices,
754-
ZBound_Low, true, CellType, LayerID, id, layernumber, np, nx, ny, nz, MyYOffset, GrainID,
755-
CritTimeStep, GrainUnitVector, UndercoolingChange, UndercoolingCurrent, OutputFile,
757+
JumpTimeStep(cycle, RemainingCellsOfInterest, LocalTempSolidCells, MeltTimeStep, LocalActiveDomainSize,
758+
MyYSlices, ZBound_Low, true, CellType, LayerID, id, layernumber, np, nx, ny, nz, MyYOffset,
759+
GrainID, CritTimeStep, GrainUnitVector, UndercoolingChange, UndercoolingCurrent, OutputFile,
756760
NGrainOrientations, PathToOutput, IntermediateFileCounter, nzActive, deltax, XMin, YMin, ZMin,
757761
NumberOfLayers, XSwitch, TemperatureDataType, PrintIdleMovieFrames, MovieFrameInc, PrintBinary);
758762
}

0 commit comments

Comments
 (0)