// adjust negative resistance values to be multiplier of max value void Foam::porousZone::adjustNegativeResistance(dimensionedVector& resist) { scalar maxCmpt = max(0, cmptMax(resist.value())); if (maxCmpt < 0) { FatalErrorIn ( "Foam::porousZone::porousZone::adjustNegativeResistance" "(dimensionedVector&)" ) << "negative resistances! " << resist << exit(FatalError); } else { vector& val = resist.value(); for (label cmpt=0; cmpt < vector::nComponents; ++cmpt) { if (val[cmpt] < 0) { val[cmpt] *= -maxCmpt; } } } }
dimensionedTensor operator*(const dimensionedVector& dv) { return dimensionedTensor ( "*"+dv.name(), dv.dimensions(), *dv.value() ); }
dimensionedSymmTensor sqr(const dimensionedVector& dv) { return dimensionedSymmTensor ( "sqr("+dv.name()+')', sqr(dv.dimensions()), sqr(dv.value()) ); }
void Foam::solidParticleCloud::move(const dimensionedVector& g) { const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho"); const volVectorField& U = mesh_.lookupObject<const volVectorField>("U"); const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu"); interpolationCellPoint<scalar> rhoInterp(rho); interpolationCellPoint<vector> UInterp(U); interpolationCellPoint<scalar> nuInterp(nu); solidParticle::trackData td(*this, rhoInterp, UInterp, nuInterp, g.value()); Cloud<solidParticle>::move(td); }
// adjust negative resistance values to be multiplier of max value void Foam::porosityZone::checkNegativeResistance(dimensionedVector& resist) { scalar minCmpt = min(0, cmptMin(resist.value())); if (minCmpt < 0) { FatalErrorIn ( "Foam::porosityZone::porosityZone::adjustNegativeResistance" "(dimensionedVector&)" ) << "negative resistances! " << resist << exit(FatalError); } }
// Construct from components Foam::spray::spray ( const volVectorField& U, const volScalarField& rho, const volScalarField& p, const volScalarField& T, const basicMultiComponentMixture& composition, const PtrList<gasThermoPhysics>& gasProperties, const dictionary&, const dimensionedVector& g, bool readFields ) : Cloud<parcel>(U.mesh(), false), // suppress className checking on positions runTime_(U.time()), time0_(runTime_.value()), mesh_(U.mesh()), rndGen_(label(0)), g_(g.value()), U_(U), rho_(rho), p_(p), T_(T), sprayProperties_ ( IOobject ( "sprayProperties", U.time().constant(), U.db(), IOobject::MUST_READ, IOobject::NO_WRITE ) ), ambientPressure_(p_.average().value()), ambientTemperature_(T_.average().value()), injectors_ ( IOobject ( "injectorProperties", U.time().constant(), U.db(), IOobject::MUST_READ, IOobject::NO_WRITE ), injector::iNew(U.time()) ), atomization_ ( atomizationModel::New ( sprayProperties_, *this ) ), drag_ ( dragModel::New ( sprayProperties_ ) ), evaporation_ ( evaporationModel::New ( sprayProperties_ ) ), heatTransfer_ ( heatTransferModel::New ( sprayProperties_ ) ), wall_ ( wallModel::New ( sprayProperties_, U, *this ) ), breakupModel_ ( breakupModel::New ( sprayProperties_, *this ) ), collisionModel_ ( collisionModel::New ( sprayProperties_, *this, rndGen_ ) ), dispersionModel_ ( dispersionModel::New ( sprayProperties_, *this ) ), fuels_ ( liquidMixture::New ( mesh_.lookupObject<dictionary>("thermophysicalProperties") ) ), injectorModel_ ( injectorModel::New ( sprayProperties_, *this ) ), sprayIteration_(sprayProperties_.subDict("sprayIteration")), sprayIterate_(readLabel(sprayIteration_.lookup("sprayIterate"))), sprayRelaxFactor_(readScalar(sprayIteration_.lookup("sprayRelaxFactor"))), minimumParcelMass_ ( readScalar(sprayIteration_.lookup("minimumParcelMass")) ), subCycles_(readLabel(sprayProperties_.lookup("subCycles"))), gasProperties_(gasProperties), composition_(composition), liquidToGasIndex_(fuels_->components().size(), -1), gasToLiquidIndex_(composition.Y().size(), -1), isLiquidFuel_(composition.Y().size(), false), twoD_(0), axisOfSymmetry_(vector::zero), axisOfWedge_(vector(0,0,0)), axisOfWedgeNormal_(vector(0,0,0)), angleOfWedge_(0.0), interpolationSchemes_(sprayProperties_.subDict("interpolationSchemes")), UInterpolator_(NULL), rhoInterpolator_(NULL), pInterpolator_(NULL), TInterpolator_(NULL), sms_(mesh_.nCells(), vector::zero), shs_(mesh_.nCells(), 0.0), srhos_(fuels_->components().size()), totalInjectedLiquidMass_(0.0), injectedLiquidKE_(0.0) { // create the evaporation source fields forAll(srhos_, i) { srhos_.set(i, new scalarField(mesh_.nCells(), 0.0)); }
void Foam::fishParticleCloud::move(const dimensionedVector& g, int check) { // Particle Diameter scalar d = 1e-3; if(check == 1){ // Injector 1 vector pos1 = vector(-0.5,0.1,0.05); //Set initial velocity vector vector vel1=vector(1,0,0); // Find cell at specified injection position and add particle here label cell1=mesh_.findCell(pos1); if(cell1>=0) { fishParticle* ptr= new fishParticle(*this,pos1,cell1,d,vel1); Cloud<fishParticle>::addParticle(ptr); } // Injector 2 vector pos2 = vector(-0.5,0.08,0.05); //Set initial velocity vector vector vel2=vector(1,0,0); // Find cell at specified injection position and add particle here label cell2=mesh_.findCell(pos2); if(cell2>=0) { fishParticle* ptr= new fishParticle(*this,pos2,cell2,d,vel2); Cloud<fishParticle>::addParticle(ptr); } // Injector 3 vector pos3 = vector(-0.5,0.06,0.05); //Set initial velocity vector vector vel3=vector(1,0,0); // Find cell at specified injection position and add particle here label cell3=mesh_.findCell(pos3); if(cell3>=0) { fishParticle* ptr= new fishParticle(*this,pos3,cell3,d,vel3); Cloud<fishParticle>::addParticle(ptr); } // Injector 4 vector pos4 = vector(-0.5,0.04,0.05); //Set initial velocity vector vector vel4=vector(1,0,0); // Find cell at specified injection position and add particle here label cell4=mesh_.findCell(pos4); if(cell4>=0) { fishParticle* ptr= new fishParticle(*this,pos4,cell4,d,vel4); Cloud<fishParticle>::addParticle(ptr); } // Injector 5 vector pos5 = vector(-0.5,0.02,0.05); //Set initial velocity vector vector vel5=vector(1,0,0); // Find cell at specified injection position and add particle here label cell5=mesh_.findCell(pos5); if(cell5>=0) { fishParticle* ptr= new fishParticle(*this,pos5,cell5,d,vel5); Cloud<fishParticle>::addParticle(ptr); } // Injector 6 vector pos6 = vector(-0.5,0,0.05); //Set initial velocity vector vector vel6=vector(1,0,0); // Find cell at specified injection position and add particle here label cell6=mesh_.findCell(pos6); if(cell6>=0) { fishParticle* ptr= new fishParticle(*this,pos6,cell6,d,vel6); Cloud<fishParticle>::addParticle(ptr); } // Injector 7 vector pos7 = vector(-0.5,-0.02,0.05); //Set initial velocity vector vector vel7=vector(1,0,0); // Find cell at specified injection position and add particle here label cell7=mesh_.findCell(pos7); if(cell7>=0) { fishParticle* ptr= new fishParticle(*this,pos7,cell7,d,vel7); Cloud<fishParticle>::addParticle(ptr); } // Injector 7 vector pos8 = vector(-0.5,-0.04,0.05); //Set initial velocity vector vector vel8=vector(1,0,0); // Find cell at specified injection position and add particle here label cell8=mesh_.findCell(pos8); if(cell8>=0) { fishParticle* ptr= new fishParticle(*this,pos8,cell8,d,vel8); Cloud<fishParticle>::addParticle(ptr); } // Injector 8 vector pos9 = vector(-0.5,-0.06,0.05); //Set initial velocity vector vector vel9=vector(1,0,0); // Find cell at specified injection position and add particle here label cell9=mesh_.findCell(pos9); if(cell9>=0) { fishParticle* ptr= new fishParticle(*this,pos9,cell9,d,vel9); Cloud<fishParticle>::addParticle(ptr); } // Injector 9 vector pos10 = vector(-0.5,-0.08,0.05); //Set initial velocity vector vector vel10=vector(1,0,0); // Find cell at specified injection position and add particle here label cell10=mesh_.findCell(pos10); if(cell10>=0) { fishParticle* ptr= new fishParticle(*this,pos10,cell10,d,vel10); Cloud<fishParticle>::addParticle(ptr); } // Injector 11 vector pos11 = vector(-0.5,-0.1,0.05); //Set initial velocity vector vector vel11=vector(1,0,0); // Find cell at specified injection position and add particle here label cell11=mesh_.findCell(pos11); if(cell11>=0) { fishParticle* ptr= new fishParticle(*this,pos11,cell11,d,vel11); Cloud<fishParticle>::addParticle(ptr); } } const volScalarField& rho = mesh_.lookupObject<const volScalarField>("rho"); const volVectorField& U = mesh_.lookupObject<const volVectorField>("U"); const volScalarField& nu = mesh_.lookupObject<const volScalarField>("nu"); interpolationCellPoint<scalar> rhoInterp(rho); interpolationCellPoint<vector> UInterp(U); interpolationCellPoint<scalar> nuInterp(nu); fishParticle::trackData td(*this, rhoInterp, UInterp, nuInterp, g.value()); Cloud<fishParticle>::move(td); }