diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/execute/execute.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/execute/execute.C index a824fcab..3b79f718 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/execute/execute.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/execute/execute.C @@ -71,13 +71,13 @@ execute::execute timeStamp_(false) { // read list of scalars - if(propsDict_.found("scalars")) + if (propsDict_.found("scalars")) { scalarList_ = scalarList(propsDict_.lookup("scalars")); } // read list of labels - if(propsDict_.found("labels")) + if (propsDict_.found("labels")) { labelList_ = labelList(propsDict_.lookup("labels")); } @@ -91,7 +91,7 @@ execute::execute parseCommandList(commandList_, labelList_, scalarList_, command_, propsDict_, timeStamp_); Info << "liggghtsCommand " << command_ << endl; - strCommand_=string(command_); + strCommand_ = string(command_); checkTimeMode(propsDict_); @@ -114,7 +114,7 @@ const char* execute::command(int commandLine) bool execute::runCommand(int couplingStep) { - if(timeStamp_) strCommand_=addTimeStamp(command_); + if (timeStamp_) strCommand_ = addTimeStamp(command_); checkTimeSettings(propsDict_); return runThisCommand(couplingStep); diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C index 9d7da2ed..9c6236d8 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/liggghtsCommandModel/liggghtsCommandModel.C @@ -88,24 +88,24 @@ void liggghtsCommandModel::checkTimeMode(dictionary& propsDict) { runFirst_=Switch(propsDict.lookup("runFirst")); - if(!runFirst_) + if (!runFirst_) { // check if being run only at last coupling step runLast_=Switch(propsDict.lookup("runLast")); - if(!runLast_) + if (!runLast_) { // check if being run every coupling step runEveryCouplingStep_=Switch(propsDict.lookup("runEveryCouplingStep")); - if(!runEveryCouplingStep_) + if (!runEveryCouplingStep_) { runEveryWriteStep_=Switch(propsDict.lookup("runEveryWriteStep")); } } } - if(verbose_) + if (verbose_) { Info << "runFirst = " << runFirst_ << endl; Info << "runLast = " << runLast_ << endl; @@ -116,13 +116,13 @@ void liggghtsCommandModel::checkTimeMode(dictionary& propsDict) void liggghtsCommandModel::checkTimeSettings(const dictionary& propsDict) { - if(!runFirst_) //lastRun or runEveryCouplingStep or every n steps or every writeStep + if (!runFirst_) //lastRun or runEveryCouplingStep or every n steps or every writeStep { scalar DEMts = particleCloud_.dataExchangeM().DEMts(); scalar couplingInterval = particleCloud_.dataExchangeM().couplingInterval(); scalar simStartTime = particleCloud_.mesh().time().startTime().value(); - if(runLast_) // last run + if (runLast_) // last run { // read time options from subdict endTime_ = particleCloud_.mesh().time().endTime().value()-simStartTime; @@ -164,7 +164,7 @@ void liggghtsCommandModel::checkTimeSettings(const dictionary& propsDict) couplingStepInterval_ =-1; } - if(verbose_) + if (verbose_) { Info << "firstCouplingStep = " << firstCouplingStep_ << endl; Info << "lastCouplingStep = " << lastCouplingStep_ << endl; @@ -175,14 +175,15 @@ void liggghtsCommandModel::checkTimeSettings(const dictionary& propsDict) bool liggghtsCommandModel::runThisCommand(int couplingStep) { - if(verbose_) Info << "couplingStep = " << couplingStep << endl; + if (verbose_) Info << "couplingStep = " << couplingStep << endl; bool runIt=false; - if( + if + ( (!runEveryWriteStep_ && firstCouplingStep_ <= couplingStep && lastCouplingStep_ >= couplingStep) || (runEveryWriteStep_ && particleCloud_.mesh().time().outputTime()) ) { - if(couplingStep >= nextRun_) + if (couplingStep >= nextRun_) { runIt=true; nextRun_=couplingStep + couplingStepInterval_; @@ -211,7 +212,7 @@ DynamicList liggghtsCommandModel::executionsWithinPeriod(scalar TSstart, DynamicList executions(0); // current TS within active period - if(startTime_+SMALLTSstart-SMALL ) + if (startTime_+SMALLTSstart-SMALL ) { Info << "working time within this TS" << endl; @@ -219,7 +220,7 @@ DynamicList liggghtsCommandModel::executionsWithinPeriod(scalar TSstart, int startNr = 0; scalar t = startTime_ + startNr * timeInterval_; - if(timeInterval_ > SMALL) + if (timeInterval_ > SMALL) { while (TSend - t > SMALL) { @@ -229,7 +230,7 @@ DynamicList liggghtsCommandModel::executionsWithinPeriod(scalar TSstart, t -= timeInterval_; } // check if first exec found within TS - if(TSstart < t + SMALL && t +SMALL < TSend) + if (TSstart < t + SMALL && t +SMALL < TSend) { // check for more executions while (t < endTime_ + SMALL && TSend - t > SMALL) diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C index 15e2bc34..9c5b00e5 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.C @@ -110,10 +110,10 @@ readLiggghtsData::~readLiggghtsData() const char* readLiggghtsData::command(int commandLine) { char h[50]; - sprintf(h,"_%d",insertionNr_); + sprintf(h, "_%d", insertionNr_); word add = h; insertionNr_++; - strCommand_=string(command_ + add + " add"); + strCommand_ = string(command_ + add + " add"); return strCommand_.c_str(); } diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.H b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.H index 5b14a00b..6cd26e31 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.H +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/readLiggghtsData/readLiggghtsData.H @@ -64,8 +64,6 @@ private: word command_; - //word myName_; - wordList filePathList_; public: diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C index 4922dc6e..c9c86b73 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.C @@ -64,17 +64,16 @@ runLiggghts::runLiggghts liggghtsCommandModel(dict,sm,i), propsDict_(dict.subOrEmptyDict(typeName + "Props")), command_("run"), - preNo_(propsDict_.lookupOrDefault("preNo", true)), - stdInterval_(0) + preNo_(propsDict_.lookupOrDefault("preNo", true)) { if (propsDict_.found("verbose")) { verbose_ = propsDict_.lookup("verbose"); } - runEveryCouplingStep_=true; + runEveryCouplingStep_ = true; - strCommand_=createCommand(command_); + strCommand_ = createCommand(command_); checkTimeSettings(dict_); } @@ -97,7 +96,7 @@ string runLiggghts::createCommand( word command, int interval, word appendix, wo { fileName add; char h[50]; - sprintf(h,"%d",interval); + sprintf(h, "%d", interval); add = h; command += " " + add + " " + appendix + " " + appendix2 + " " + appendix3 + " " + appendix4; @@ -108,9 +107,13 @@ bool runLiggghts::runCommand(int couplingStep) { //change command to "run xxx pre no" if (preNo_ && (couplingStep > firstCouplingStep_)) - strCommand_=createCommand(command_, particleCloud_.dataExchangeM().couplingInterval(),"pre","no","post","no"); + { + strCommand_ = createCommand(command_, particleCloud_.dataExchangeM().couplingInterval(),"pre","no","post","no"); + } else - strCommand_=createCommand(command_, particleCloud_.dataExchangeM().couplingInterval()); + { + strCommand_ = createCommand(command_, particleCloud_.dataExchangeM().couplingInterval()); + } return runThisCommand(couplingStep); } @@ -118,9 +121,13 @@ bool runLiggghts::runCommand(int couplingStep) void runLiggghts::set(int interval) { if (preNo_) + { strCommand_ = createCommand(command_, interval,"pre","no","post","no"); + } else + { strCommand_ = createCommand(command_, interval); + } } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H index 6437adde..aa76f2ca 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/runLiggghts/runLiggghts.H @@ -63,8 +63,6 @@ private: bool preNo_; - int stdInterval_; - public: //- Runtime type information diff --git a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/writeLiggghts/writeLiggghts.C b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/writeLiggghts/writeLiggghts.C index 137d4fa8..7d80e998 100644 --- a/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/writeLiggghts/writeLiggghts.C +++ b/src/lagrangian/cfdemParticle/subModels/liggghtsCommandModel/writeLiggghts/writeLiggghts.C @@ -77,41 +77,49 @@ writeLiggghts::writeLiggghts if (propsDict_.found("path")) { - path_=fileName(propsDict_.lookup("path")); + path_ = fileName(propsDict_.lookup("path")); if (!checkPath(path_)) - FatalError<<"The path you provided in writeLiggghtsProps is incorrect: " << path_ << "\n" << abort(FatalError); + { + FatalError << "The path you provided in writeLiggghtsProps is incorrect: " << path_ << "\n" << abort(FatalError); + } else + { Info << "Using user defined path to write LIGGGHTS restart file: " << path_ << endl; + } } - if(propsDict_.found("writeName")) + if (propsDict_.found("writeName")) { propsDict_.lookup("writeName") >> writeName_; } if (!writeLast_ && propsDict_.found("overwrite")) { - overwrite_=Switch(propsDict_.lookup("overwrite")); + overwrite_ = Switch(propsDict_.lookup("overwrite")); } - if(writeLast_) + if (writeLast_) { - runLast_=true; + runLast_ = true; } else { //Warning << "Using invalid options of writeLiggghts, please use 'writeLast' option." << endl; - runEveryWriteStep_=true; + runEveryWriteStep_ = true; } command_ += " " + path_ + "/" + writeName_; - if(overwrite_) + if (overwrite_) + { strCommand_=string(command_); + } else + { command_ += "_"; + } - Info << "writeLiggghts: A restart file writeName_"<< command_ <<" is written." << endl; + Info << "writeLiggghts: A restart file writeName_" << command_ << " is written." << endl; checkTimeSettings(dict_); } @@ -132,7 +140,7 @@ const char* writeLiggghts::command(int commandLine) bool writeLiggghts::runCommand(int couplingStep) { - if(!overwrite_) strCommand_=addTimeStamp(command_); + if (!overwrite_) strCommand_ = addTimeStamp(command_); return runThisCommand(couplingStep); }