| 302 | // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // |
| 303 | |
| 304 | bool Foam::functionObjects::streamLine::read(const dictionary& dict) |
| 305 | { |
| 306 | if (dict != dict_) |
| 307 | { |
| 308 | dict_ = dict; |
| 309 | } |
| 310 | |
| 311 | Info<< type() << " " << name() << ":" << nl; |
| 312 | |
| 313 | dict.lookup("fields") >> fields_; |
| 314 | UName_ = dict.lookupOrDefault("U", word("U")); |
| 315 | |
| 316 | if (findIndex(fields_, UName_) == -1) |
| 317 | { |
| 318 | FatalIOErrorInFunction(dict) |
| 319 | << "Velocity field for tracking " << UName_ |
| 320 | << " should be present in the list of fields " << fields_ |
| 321 | << exit(FatalIOError); |
| 322 | } |
| 323 | |
| 324 | |
| 325 | dict.lookup("trackForward") >> trackForward_; |
| 326 | dict.lookup("lifeTime") >> lifeTime_; |
| 327 | if (lifeTime_ < 1) |
| 328 | { |
| 329 | FatalErrorInFunction |
| 330 | << "Illegal value " << lifeTime_ << " for lifeTime" |
| 331 | << exit(FatalError); |
| 332 | } |
| 333 | |
| 334 | |
| 335 | bool subCycling = dict.found("nSubCycle"); |
| 336 | bool fixedLength = dict.found("trackLength"); |
| 337 | |
| 338 | if (subCycling && fixedLength) |
| 339 | { |
| 340 | FatalIOErrorInFunction(dict) |
| 341 | << "Cannot both specify automatic time stepping (through '" |
| 342 | << "nSubCycle' specification) and fixed track length (through '" |
| 343 | << "trackLength')" |
| 344 | << exit(FatalIOError); |
| 345 | } |
| 346 | |
| 347 | |
| 348 | nSubCycle_ = 1; |
| 349 | if (dict.readIfPresent("nSubCycle", nSubCycle_)) |
| 350 | { |
| 351 | trackLength_ = VGREAT; |
| 352 | if (nSubCycle_ < 1) |
| 353 | { |
| 354 | nSubCycle_ = 1; |
| 355 | } |
| 356 | Info<< " automatic track length specified through" |
| 357 | << " number of sub cycles : " << nSubCycle_ << nl << endl; |
| 358 | } |
| 359 | else |
| 360 | { |
| 361 | dict.lookup("trackLength") >> trackLength_; |