Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 49 additions & 9 deletions src/Init/Init_Load_DumpTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,46 @@ void Init_Load_DumpTable()
// stop the reading
if ( input_line[0] == 42 ) // '*' == 42
{

// ensure that at least one data dump time is loaded
if ( line == 0 )
Aux_Error( ERROR_INFO, "please provide at least one data dump time in the dump table !!\n" );

DumpTable_NDump = line; // record the number of data dumps
DumpTable[line] = __FLT_MAX__; // set the next dump as an extremely large number
DumpTable_NDump = line; // record the number of data dumps
DumpTable[line] = __FLT_MAX__; // set the next dump as an extremely large number

if ( DumpTable[line-1] < END_T )
// for END_T < 0.0, reset the ending time as the time of the last dump
if ( END_T < 0.0 )
{
END_T = DumpTable[line-1]; // reset the ending time as the time of the last dump
END_T = DumpTable[line-1];

if ( MPI_Rank == 0 )
Aux_Message( stdout, "NOTE : the END_T is reset to the time of the last data dump = %13.7e\n",
END_T );
Aux_Message( stdout, "NOTE : END_T is reset to the time of the last data dump in %s: %13.7e\n",
FileName, END_T );
}

// for END_T >= 0.0, reset the ending time to the largest data dump time not greater than the input END_T
else
{
for (int t=line-1; t>=0; t--)
{
if ( END_T >= DumpTable[t] )
{
END_T = DumpTable[t];

if ( MPI_Rank == 0 )
Aux_Message( stdout, "NOTE : END_T is reset to the largest time in %s not greater "
"than the input END_T: %13.7e\n",
FileName, END_T );
break;
}
}
} // if ( END_T < 0.0 ) ... else ...


// verify the loaded dump table
for (int t=1; t<=line; t++)
{
if ( DumpTable[t] < DumpTable[t-1] )
if ( DumpTable[t] <= DumpTable[t-1] )
Aux_Error( ERROR_INFO, "values recorded in \"%s\" must be monotonically increasing !!\n",
FileName );
}
Expand All @@ -79,14 +97,36 @@ void Init_Load_DumpTable()


if ( line == MaxLine )
Aux_Error( ERROR_INFO, "please prepare a symbol * in the end of the file <%s> !!\n", FileName );
Aux_Error( ERROR_INFO, "please prepare a * symbol at the end of the file <%s> !!\n", FileName );


fclose( File );

if ( input_line != NULL ) free( input_line );


// insert initial time Time[0]
for (int t=0; t<DumpTable_NDump; t++)
{
// check if the initial time is already in the dump table
if ( ( Time[0] != 0.0 && fabs( (Time[0]-DumpTable[t])/Time[0] ) < 1.0e-8 ) ||
( Time[0] == 0.0 && fabs( Time[0]-DumpTable[t] ) < 1.0e-12 ) ) break;

// insert the initial time into the dump table
if ( ( Time[0] < DumpTable[t] ) && ( t == 0 || Time[0] > DumpTable[t-1] ) )
{
for (int s=DumpTable_NDump; s>t; s--) DumpTable[s] = DumpTable[s-1];
DumpTable[t] = Time[0];
DumpTable_NDump ++;

if ( MPI_Rank == 0 )
Aux_Message( stdout, "NOTE : initial time %13.7e is inserted into the dump table\n", Time[0] );

break;
}
}


if ( MPI_Rank == 0 ) Aux_Message( stdout, "Init_Load_DumpTable ... done\n" );

} // FUNCTION : Init_Load_DumpTable
12 changes: 6 additions & 6 deletions src/Output/Output_DumpData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ void Output_DumpData( const int Stage )
DumpTime = round( int(Time[0]/OUTPUT_DT) + 1.0 )*OUTPUT_DT;

// be careful about round-off errors
if ( ( DumpTime <= Time[0] ) ||
( Time[0] != 0.0 && fabs( (Time[0]-DumpTime)/Time[0] ) < 1.0e-8 ) ||
( Time[0] == 0.0 && fabs( Time[0]-DumpTime ) < 1.0e-12 ) ) DumpTime += OUTPUT_DT;
if ( ( DumpTime <= Time[0] ) ||
( Time[0] != 0.0 && fabs( (Time[0]-DumpTime)/Time[0] ) < 1.0e-8 ) ||
( Time[0] == 0.0 && fabs( Time[0]-DumpTime ) < 1.0e-12 ) ) DumpTime += OUTPUT_DT;
}
}
break;
Expand All @@ -71,9 +71,9 @@ void Output_DumpData( const int Stage )
{
DumpTime = DumpTable[DumpTableID];

if ( ( DumpTime >= Time[0] ) ||
( Time[0] != 0.0 && fabs( (Time[0]-DumpTime)/Time[0] ) < 1.0e-8 ) ||
( Time[0] == 0.0 && fabs( Time[0]-DumpTime ) < 1.0e-12 ) ) break;
if ( ( DumpTime >= Time[0] ) ||
( Time[0] != 0.0 && fabs( (Time[0]-DumpTime)/Time[0] ) < 1.0e-8 ) ||
( Time[0] == 0.0 && fabs( Time[0]-DumpTime ) < 1.0e-12 ) ) break;
}
}

Expand Down
Loading