23 m_log <<
"reading model properties...";
26 m_restart = Context::getSolverProperty<MBool>(
"restartFile", solverId(), AT_, &m_restart);
28 m_restartTimeStep = Context::getSolverProperty<MInt>(
"restartTimeStep", solverId(), AT_);
30 m_maxNoParticles = 1E6;
31 m_maxNoParticles = Context::getSolverProperty<MInt>(
"maxNoParticles", solverId(), AT_, &m_maxNoParticles);
41 m_exchangeBufferSize =
42 Context::getSolverProperty<MInt>(
"particleExchangeBufferSize", solverId(), AT_, &m_exchangeBufferSize);
53 m_sizeLimit = Context::getSolverProperty<MFloat>(
"particleSizeLimit", solverId(), AT_, &m_sizeLimit);
62 m_spawnParticles =
false;
63 m_spawnParticles = Context::getSolverProperty<MBool>(
"spawnParticles", solverId(), AT_, &m_spawnParticles);
65 if(m_spawnParticles) {
66 m_log <<
"Particle spawning has been activated." << std::endl;
76 m_activePrimaryBUp =
false;
77 m_activePrimaryBUp = Context::getSolverProperty<MBool>(
"sprayPrimaryBUp", solverId(), AT_, &m_activePrimaryBUp);
85 m_activeSecondaryBUp =
false;
86 m_activeSecondaryBUp = Context::getSolverProperty<MBool>(
"spraySecondaryBUp", solverId(), AT_, &m_activeSecondaryBUp);
96 m_ellipsoids = Context::getSolverProperty<MBool>(
"particleIncludeEllipsoids", solverId(), AT_, &m_ellipsoids);
117 m_collisions = Context::getSolverProperty<MInt>(
"particleCollisions", solverId(), AT_, &m_collisions);
119 if(m_collisions > 0) {
120 m_collisionModel = std::unique_ptr<ParticleCollision<nDim>>(
132 m_wallCollisions = Context::getSolverProperty<MBool>(
"particleWallCollisions", solverId(), AT_, &m_wallCollisions);
150 m_initializationMethod =
151 Context::getSolverProperty<MInt>(
"particleInitializationMethod", solverId(), AT_, &m_initializationMethod);
176 m_dragModelType = Context::getSolverProperty<MInt>(
"particleDrag", solverId(), AT_, &m_dragModelType);
190 m_liftModelType = Context::getSolverProperty<MInt>(
"particleLift", solverId(), AT_, &m_liftModelType);
204 m_torqueModelType = Context::getSolverProperty<MInt>(
"particleTorque", solverId(), AT_, &m_torqueModelType);
225 m_motionEquationType = Context::getSolverProperty<MInt>(
"motionEquation", solverId(), AT_, &m_motionEquationType);
239 m_respawn = Context::getSolverProperty<MBool>(
"particleRespawn", solverId(), AT_, &m_respawn);
249 m_respawnPlane = Context::getSolverProperty<MFloat>(
"particleRespawnPlane", solverId(), AT_);
253 for(
MInt i = 0; i < noInternalCells(); i++) {
254 if(!c_isLeafCell(i))
continue;
255 MInt level = c_level(i);
256 halfLength = c_cellLengthAtLevel(level + 1);
257 if(fabs(c_coordinate(i, 0) - m_respawnPlane) < halfLength) {
258 auto weightedTimes =
static_cast<MInt>(pow(pow(2, nDim), (maxRefinementLevel() - level)));
259 for(
MInt count = 0; count < weightedTimes; ++count) {
260 m_respawnCells.push_back(i);
264 m_log << m_respawnCells.size() <<
" respawn cells found in this solver" << std::endl;
277 m_xCutOff = Context::getSolverProperty<MFloat>(
"particlePartOffset", solverId(), AT_, &m_xCutOff);
286 m_momentumCoupling =
false;
288 Context::getSolverProperty<MBool>(
"particleMomentumCoupling", solverId(), AT_, &m_momentumCoupling);
289 if(m_momentumCoupling) {
290 m_log <<
"Momentum coupling has been activated." << std::endl;
300 m_heatCoupling =
false;
301 m_heatCoupling = Context::getSolverProperty<MBool>(
"particleHeatCoupling", solverId(), AT_, &m_heatCoupling);
304 m_log <<
"Heat coupling has been activated." << std::endl;
314 m_massCoupling =
false;
315 m_massCoupling = Context::getSolverProperty<MBool>(
"particleMassCoupling", solverId(), AT_, &m_massCoupling);
317 m_log <<
"Mass coupling has been activated." << std::endl;
327 m_evaporation =
false;
328 m_evaporation = Context::getSolverProperty<MBool>(
"particleEvaporation", solverId(), AT_, &m_evaporation);
331 m_log <<
"Evaporation modeling has been activated." << std::endl;
343 m_maxNoBndryCells = Context::getSolverProperty<MInt>(
"maxNoBndryCells", solverId(), AT_);
354 MInt range[2] = {2, 0};
355 for(
MInt i = 0; i < 2; i++) {
356 range[i] = Context::getSolverProperty<MInt>(
"particleAdapRange", solverId(), AT_, &range[i], i);
359 mAlloc(m_bandWidth, maxRefinementLevel() + 1,
"m_bandWidth", 0, AT_);
360 m_bandWidth[maxRefinementLevel() - 1] = range[0];
361 for(
MInt i = maxRefinementLevel() - 2; i >= 0; i--) {
362 m_bandWidth[i] = (m_bandWidth[i + 1] / 2) + 1 + range[1];
365 m_innerBound = Context::getSolverProperty<MInt>(
"innerBound", solverId(), AT_, &m_innerBound);
367 MFloat referenceTemperature = 273.15;
380 referenceTemperature =
381 Context::getSolverProperty<MFloat>(
"referenceTemperature", m_solverId, AT_, &referenceTemperature);
383 m_sutherlandConstant = 110.4;
395 m_sutherlandConstant =
396 Context::getSolverProperty<MFloat>(
"sutherlandConstant", solverId(), AT_, &m_sutherlandConstant);
398 m_sutherlandConstant /= referenceTemperature;
399 m_sutherlandPlusOne = m_sutherlandConstant + F1;
414 m_cfl = Context::getSolverProperty<MFloat>(
"cfl", solverId(), AT_, &m_cfl);
416 m_timeStepComputationInterval = m_restart ? -1 : 0;
431 m_timeStepComputationInterval =
432 Context::getSolverProperty<MInt>(
"timeStepComputationInterval", solverId(), AT_, &m_timeStepComputationInterval);
435 m_nonBlockingComm = Context::getSolverProperty<MBool>(
"nonBlockingComm", solverId(), AT_, &m_nonBlockingComm);
437 if(m_nonBlockingComm) {
438 m_nonBlockingStage = 0;
440 cerr0 <<
"LPT-Warning: nonBlocking currently only works with either spherical or ellipsoidal particles "
441 <<
"--> disabling exchange of spherical particles" << std::endl;
453 m_weightBaseCell = 0.0;
454 m_weightBaseCell = Context::getSolverProperty<MFloat>(
"weightBaseCell", solverId(), AT_, &m_weightBaseCell);
464 m_weightLeafCell = 0.0;
465 m_weightLeafCell = Context::getSolverProperty<MFloat>(
"weightLeafCell", solverId(), AT_, &m_weightLeafCell);
475 m_weightParticleCell = 0.1;
476 m_weightParticleCell =
477 Context::getSolverProperty<MFloat>(
"weightParticleCell", solverId(), AT_, &m_weightParticleCell);
486 m_weightParticle = 1.0;
487 m_weightParticle = Context::getSolverProperty<MFloat>(
"weightParticle", solverId(), AT_, &m_weightParticle);
496 m_weightSpawnCell = 0.0;
497 m_weightSpawnCell = Context::getSolverProperty<MFloat>(
"weightSpawnCell", solverId(), AT_, &m_weightSpawnCell);
506 m_weightMulitSolverFactor = 1.0;
507 m_weightMulitSolverFactor =
508 Context::getSolverProperty<MFloat>(
"weightMulitSolverFactor", solverId(), AT_, &m_weightMulitSolverFactor);
517 m_limitWeights =
false;
518 m_limitWeights = Context::getSolverProperty<MBool>(
"limitDLBWeights", solverId(), AT_, &m_limitWeights);
520 m_weightSourceCells =
false;
521 m_weightSourceCells =
522 Context::getSolverProperty<MBool>(
"weightLPTSourceCells", solverId(), AT_, &m_weightSourceCells);
524 m_domainIdOutput =
false;
525 m_domainIdOutput = Context::getSolverProperty<MBool>(
"domainIdOutput", m_solverId, AT_, &m_domainIdOutput);
529 m_sleepLPT = Context::getSolverProperty<MInt>(
"sleepTimeLPT", m_solverId, AT_, &m_sleepLPT);
532 m_skipLPT = Context::getSolverProperty<MBool>(
"skipLPT", m_solverId, AT_, &m_skipLPT);
534 m_log <<
"finished" << std::endl;
556 m_spawnSeed = (
MLong)Context::getSolverProperty<MInt>(
"spawnSeed", solverId(), AT_);
560 m_PRNGSpawn.seed(m_spawnSeed);
561 m_PRNGRespawn.seed(m_spawnSeed);
571 m_spawnDiameter = 0.00001;
572 m_spawnDiameter = Context::getSolverProperty<MFloat>(
"spawnDiameter", solverId(), AT_, &m_spawnDiameter);
582 m_spawnVelocity = Context::getSolverProperty<MFloat>(
"spawnParticlesInitVelo", solverId(), AT_, &m_spawnVelocity);
592 m_spawnParticlesCount =
593 Context::getSolverProperty<MInt>(
"spawnParticlesCount", solverId(), AT_, &m_spawnParticlesCount);
602 m_spawnDistSigmaCoeff =
603 Context::getSolverProperty<MFloat>(
"spawnDistSigmaCoeff", solverId(), AT_, &m_spawnDistSigmaCoeff);
605 m_spawnParticlesConeAngle =
606 Context::getSolverProperty<MFloat>(
"spawnParticlesConeAngle", solverId(), AT_, &m_spawnParticlesConeAngle);
615 for(
MInt i = 0; i < nDim; i++) {
617 if(i == 0) m_spawnDir[i] = 1.0;
622 TERMM(1,
"Need to give a Coordinate for every dimension");
625 for(
MInt i = 0; i < nDim; i++) {
626 m_spawnDir[i] = Context::getSolverProperty<MFloat>(
"spawnDir", solverId(), AT_, i);
637 m_engineSetup =
false;
638 m_engineSetup = Context::getSolverProperty<MBool>(
"engineSetup", solverId(), AT_, &m_engineSetup);
659 m_ellipsoidRandomOrientation = Context::getSolverProperty<MInt>(
"particleEllipsoidRandomOrientation", solverId(), AT_,
660 &m_ellipsoidRandomOrientation);
667 m_ellipsoidRandomOrientationSeed = 4865U;
669 m_ellipsoidRandomOrientationSeed =
670 (
MLong)Context::getSolverProperty<MInt>(
"particleEllipsoidRandomOrientationSeed", solverId(), AT_);
691 m_couplingRedist =
false;
692 m_couplingRedist = Context::getSolverProperty<MBool>(
"particleCouplingRedist", solverId(), AT_, &m_couplingRedist);
694 if(m_couplingRedist) {
702 m_noRedistLayer = Context::getSolverProperty<MInt>(
"particleNoRedistLayer", solverId(), AT_, &m_noRedistLayer);
704 if(m_noRedistLayer > grid().noHaloLayers() && noDomains() > 1) {
705 mTerm(-1, AT_,
"ERROR: Number of halo layers needs to be higher than the redistribution area!");
708 m_log <<
"Momentum redistribution is active with a redistribution area of " << m_noRedistLayer << std::endl;
722 const MBool redetermination = m_spawnCellId >= 0;
723 const MInt lastSpawnCellId = m_spawnCellId;
724 const MInt lastSpawnDomainId = m_spawnDomainId;
736 TERMM(1,
"Need to give a Coordinate for every dimension");
739 for(
MInt i = 0; i < nDim; i++) {
740 m_spawnCoord[i] = Context::getSolverProperty<MFloat>(
"spawnCoordinates", solverId(), AT_, i);
743 m_spawnCellId = grid().findContainingLeafCell(&m_spawnCoord[0]);
747 if(noDomains() > 1) {
748 MInt spawnDomain = domainId();
750 if(m_spawnCellId < 0 || a_isHalo(m_spawnCellId)) {
751 spawnDomain = std::numeric_limits<MInt>::max();
756 MPI_Allreduce(&spawnDomain, &minDomain, 1, MPI_INT, MPI_MIN, mpiComm(), AT_,
"spawnDomain",
"minDomain");
758 if(minDomain != domainId()) {
762 m_spawnDomainId = minDomain;
764 m_log <<
" LPT selected spawn-cell " << m_spawnCellId <<
" on domain " << m_spawnDomainId << std::endl;
765 if(domainId() == m_spawnDomainId) {
766 std::cerr <<
" LPT selected spawn-cell " << m_spawnCellId <<
" on domain " << m_spawnDomainId
767 <<
" with coordinates " << c_coordinate(m_spawnCellId, 0) <<
" " << c_coordinate(m_spawnCellId, 1)
768 <<
" " << c_coordinate(m_spawnCellId, nDim - 1) << std::endl;
772 if(redetermination) {
773 std::cerr <<
" LPT spawn-cellId was redetermined";
774 if(m_spawnCellId < 0) {
775 std::cerr <<
" and spawnDomain changed from " << domainId() <<
" to " << m_spawnDomainId;
776 std::cerr <<
" left-over mass was : " << m_particleResiduum << std::endl;
778 std::cerr << std::endl;
781 if(lastSpawnCellId < 0 && m_spawnCellId > 0 && lastSpawnDomainId > 0) {
782 std::cerr <<
"Revieved left-over mass is : " << m_particleResiduum << std::endl;
784 if((m_spawnDomainId + 1 > noDomains() && noDomains() > 1) || (m_spawnCellId < 0 && noDomains() == 1)) {
785 TERMM(-1,
"Invalid spawn coordinates, values are probably outside the fluid-domain/box?");
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
static MInt propertyLength(const MString &name, MInt solverId=m_noSolvers)
Returns the number of elements of a property.
static MBool propertyExists(const MString &name, MInt solver=m_noSolvers)
This function checks if a property exists in general.
void readSpawnProps()
Read properties related to creating particles from configuration file.
void readMomentumCouplingProps()
Read properties specific to the momentum coupling.
void readEllipsoidProps()
Read properties specific to ellipsoids.
void findSpawnCellId()
Find spawn cellId.
void readModelProps()
Read model configuration properties from configuration file.
void mTerm(const MInt errorCode, const MString &location, const MString &message)
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce