|
|
|
|
@ -133,7 +133,9 @@ void Output::init()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < ndump; i++) dump[i]->init();
|
|
|
|
|
for (int i = 0; i < ndump; i++)
|
|
|
|
|
any_time_dumps = 0;
|
|
|
|
|
for (int i = 0; i < ndump; i++) {
|
|
|
|
|
if (mode_dump[i]) any_time_dumps = 1;
|
|
|
|
|
if ((mode_dump[i] == 0 && every_dump[i] == 0) ||
|
|
|
|
|
(mode_dump[i] == 1 && every_time_dump[i] == 0.0)) {
|
|
|
|
|
ivar_dump[i] = input->variable->find(var_dump[i]);
|
|
|
|
|
@ -142,6 +144,7 @@ void Output::init()
|
|
|
|
|
if (!input->variable->equalstyle(ivar_dump[i]))
|
|
|
|
|
error->all(FLERR,"Variable for dump every or delta is invalid style");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (restart_flag_single && restart_every_single == 0) {
|
|
|
|
|
ivar_restart_single = input->variable->find(var_restart_single);
|
|
|
|
|
@ -176,9 +179,11 @@ void Output::setup(int memflag)
|
|
|
|
|
if (ndump && update->restrict_output == 0) {
|
|
|
|
|
for (int idump = 0; idump < ndump; idump++) {
|
|
|
|
|
|
|
|
|
|
// wrap dumps that invoke computes or do variable eval with clear/add
|
|
|
|
|
// wrap step dumps that invoke computes or do variable eval with clear/add
|
|
|
|
|
// see NOTE in write() about also wrapping time dumps
|
|
|
|
|
|
|
|
|
|
if (dump[idump]->clearstep || var_dump[idump])
|
|
|
|
|
if (mode_dump[idump] == 0 &&
|
|
|
|
|
(dump[idump]->clearstep || var_dump[idump]))
|
|
|
|
|
modify->clearstep_compute();
|
|
|
|
|
|
|
|
|
|
// write a snapshot at setup only if any of these 3 conditions hold
|
|
|
|
|
@ -226,7 +231,8 @@ void Output::setup(int memflag)
|
|
|
|
|
// if dump not written now, use addstep_compute_all()
|
|
|
|
|
// since don't know what computes the dump will invoke
|
|
|
|
|
|
|
|
|
|
if (dump[idump]->clearstep || var_dump[idump]) {
|
|
|
|
|
if (mode_dump[idump] == 0 &&
|
|
|
|
|
(dump[idump]->clearstep || var_dump[idump])) {
|
|
|
|
|
if (writeflag) modify->addstep_compute(next_dump[idump]);
|
|
|
|
|
else modify->addstep_compute_all(next_dump[idump]);
|
|
|
|
|
}
|
|
|
|
|
@ -304,21 +310,28 @@ void Output::setup(int memflag)
|
|
|
|
|
|
|
|
|
|
next = MIN(next_dump_any,next_restart);
|
|
|
|
|
next = MIN(next,next_thermo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
perform all output for this timestep
|
|
|
|
|
only perform output if next matches current step and last output doesn't
|
|
|
|
|
do dump/restart before thermo so thermo CPU time will include them
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
void Output::write(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
void Output::write(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
// perform dump if its next_dump = current ntimestep
|
|
|
|
|
// but not if it was already written on this step
|
|
|
|
|
// set next_dump and also next_time_dump for mode_dump = 1
|
|
|
|
|
// set next_dump_any to smallest next_dump
|
|
|
|
|
// wrap dumps that invoke computes or do variable eval with clear/add
|
|
|
|
|
// wrap step dumps that invoke computes or do variable eval with clear/add
|
|
|
|
|
// NOTE:
|
|
|
|
|
// could wrap time dumps as well, if timestep size did not vary
|
|
|
|
|
// if wrap when timestep size varies frequently,
|
|
|
|
|
// then can do many unneeded addstep() --> inefficient
|
|
|
|
|
// hard to know if timestep varies, since run every could change it
|
|
|
|
|
// can't remove an uneeded addstep from a compute, b/c don't know
|
|
|
|
|
// what other command may have added it
|
|
|
|
|
|
|
|
|
|
int writeflag;
|
|
|
|
|
|
|
|
|
|
@ -327,7 +340,8 @@ void Output::write(bigint ntimestep)
|
|
|
|
|
if (next_dump[idump] == ntimestep) {
|
|
|
|
|
if (last_dump[idump] == ntimestep) continue;
|
|
|
|
|
|
|
|
|
|
if (dump[idump]->clearstep || var_dump[idump])
|
|
|
|
|
if (mode_dump[idump] == 0 &&
|
|
|
|
|
(dump[idump]->clearstep || var_dump[idump]))
|
|
|
|
|
modify->clearstep_compute();
|
|
|
|
|
|
|
|
|
|
// perform dump
|
|
|
|
|
@ -337,7 +351,8 @@ void Output::write(bigint ntimestep)
|
|
|
|
|
last_dump[idump] = ntimestep;
|
|
|
|
|
calculate_next_dump(1,idump,ntimestep);
|
|
|
|
|
|
|
|
|
|
if (dump[idump]->clearstep || var_dump[idump])
|
|
|
|
|
if (mode_dump[idump] == 0 &&
|
|
|
|
|
(dump[idump]->clearstep || var_dump[idump]))
|
|
|
|
|
modify->addstep_compute(next_dump[idump]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -418,22 +433,22 @@ void Output::write(bigint ntimestep)
|
|
|
|
|
|
|
|
|
|
next = MIN(next_dump_any,next_restart);
|
|
|
|
|
next = MIN(next,next_thermo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
force a snapshot to be written for all dumps
|
|
|
|
|
called from PRD and TAD
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
void Output::write_dump(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
void Output::write_dump(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
for (int idump = 0; idump < ndump; idump++) {
|
|
|
|
|
dump[idump]->write();
|
|
|
|
|
last_dump[idump] = ntimestep;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
calculate when next dump occurs for Dump instance idump
|
|
|
|
|
operates in one of two modes, based on mode_dump flag
|
|
|
|
|
for timestep mode, set next_dump
|
|
|
|
|
@ -442,10 +457,10 @@ void Output::write_dump(bigint ntimestep)
|
|
|
|
|
0 = from setup() at start of run
|
|
|
|
|
1 = from write() during run each time a dump file is written
|
|
|
|
|
2 = from reset_dt() called from fix dt/reset when it changes timestep size
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
void Output::calculate_next_dump(int which, int idump, bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
// dump mode is by timestep
|
|
|
|
|
// just set next_dump
|
|
|
|
|
|
|
|
|
|
@ -533,15 +548,26 @@ void Output::write_dump(bigint ntimestep)
|
|
|
|
|
next_time_dump[idump] = nexttime;
|
|
|
|
|
next_dump[idump] = nextdump;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
int Output::check_time_dumps(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
int nowflag = 0;
|
|
|
|
|
for (int i = 0; i < ndump; i++)
|
|
|
|
|
if (mode_dump[i] && next_dump[i] == ntimestep) nowflag = 1;
|
|
|
|
|
|
|
|
|
|
return nowflag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
force restart file(s) to be written
|
|
|
|
|
called from PRD and TAD
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
void Output::write_restart(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
void Output::write_restart(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
if (restart_flag_single) {
|
|
|
|
|
std::string file = restart1;
|
|
|
|
|
std::size_t found = file.find('*');
|
|
|
|
|
@ -561,22 +587,22 @@ void Output::write_restart(bigint ntimestep)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
last_restart = ntimestep;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
timestep is being changed, called by update->reset_timestep()
|
|
|
|
|
for dumps, require that no dump is "active"
|
|
|
|
|
meaning that a snapshot has already been output
|
|
|
|
|
reset next output values restart and thermo output
|
|
|
|
|
reset next output values for restart and thermo
|
|
|
|
|
reset to smallest value >= new timestep
|
|
|
|
|
if next timestep set by variable evaluation,
|
|
|
|
|
eval for ntimestep-1, so current ntimestep can be returned if needed
|
|
|
|
|
no guarantee that variable can be evaluated for ntimestep-1
|
|
|
|
|
e.g. if it depends on computes, but live with that rare case for now
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
void Output::reset_timestep(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
void Output::reset_timestep(bigint ntimestep)
|
|
|
|
|
{
|
|
|
|
|
next_dump_any = MAXBIGINT;
|
|
|
|
|
for (int idump = 0; idump < ndump; idump++)
|
|
|
|
|
if (last_dump[idump] >= 0)
|
|
|
|
|
@ -641,11 +667,13 @@ void Output::reset_timestep(bigint ntimestep)
|
|
|
|
|
|
|
|
|
|
next = MIN(next_dump_any,next_restart);
|
|
|
|
|
next = MIN(next,next_thermo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
timestep size is being changed, called by fix dt/reset (at end of step)
|
|
|
|
|
timestep size is being changed
|
|
|
|
|
reset next output values for dumps which have mode_dump=1
|
|
|
|
|
called by fix dt/reset (at end of step)
|
|
|
|
|
or called by timestep command via run every (also at end of step)
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
|
|
void Output::reset_dt()
|
|
|
|
|
@ -659,21 +687,10 @@ void Output::reset_dt()
|
|
|
|
|
|
|
|
|
|
// reset next_dump but do not change next_time_dump, 2 arg for reset_dt()
|
|
|
|
|
// do not invoke for a dump already scheduled for this step
|
|
|
|
|
// use compute_all() b/c don't know what computes will be needed
|
|
|
|
|
// since timestep change affects next step
|
|
|
|
|
|
|
|
|
|
if (next_dump[idump] != ntimestep) {
|
|
|
|
|
calculate_next_dump(2,idump,update->ntimestep);
|
|
|
|
|
|
|
|
|
|
// NOTE: think I should not do this here
|
|
|
|
|
// for time dumps, calc_next_dump should calc the next timestep
|
|
|
|
|
// as one less and not add it to computes
|
|
|
|
|
// then on that step, write() should not actually write the dump
|
|
|
|
|
// but trigger it on next step and addstep_compute_all for that step
|
|
|
|
|
// b/c when write() is called, the next-step timestep is set
|
|
|
|
|
// unless run every timestep is invoked in-between!
|
|
|
|
|
|
|
|
|
|
//if (dump[idump]->clearstep || var_dump[idump])
|
|
|
|
|
// modify->addstep_compute_all(next_dump[idump]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -684,6 +701,7 @@ void Output::reset_dt()
|
|
|
|
|
next = MIN(next,next_thermo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ----------------------------------------------------------------------
|
|
|
|
|
add a Dump to list of Dumps
|
|
|
|
|
------------------------------------------------------------------------- */
|
|
|
|
|
|