mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Function1 - updated time-based Function1 usage
This commit is contained in:
committed by
Mark Olesen
parent
f6ee1811e7
commit
ba45fb2cba
@ -77,7 +77,7 @@ Foam::Function1Types::Sine<Type>::Sine(const Sine<Type>& rhs)
|
|||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::Function1Types::Sine<Type>::userTimeToTime(const Time& t)
|
void Foam::Function1Types::Sine<Type>::userTimeToTime(const Time& t)
|
||||||
{
|
{
|
||||||
t0_ = t.timeToUserTime(t0_);
|
t0_ = t.userTimeToTime(t0_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -61,8 +61,8 @@ void Foam::Function1Types::ramp::writeEntries(Ostream& os) const
|
|||||||
|
|
||||||
void Foam::Function1Types::ramp::userTimeToTime(const Time& t)
|
void Foam::Function1Types::ramp::userTimeToTime(const Time& t)
|
||||||
{
|
{
|
||||||
start_ = t.timeToUserTime(start_);
|
start_ = t.userTimeToTime(start_);
|
||||||
duration_ = t.timeToUserTime(duration_);
|
duration_ = t.userTimeToTime(duration_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -106,7 +106,13 @@ Foam::ConeInjection<CloudType>::ConeInjection
|
|||||||
tanVec1_.setSize(positionAxis_.size());
|
tanVec1_.setSize(positionAxis_.size());
|
||||||
tanVec2_.setSize(positionAxis_.size());
|
tanVec2_.setSize(positionAxis_.size());
|
||||||
|
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
// Convert from user time to reduce the number of time conversion calls
|
||||||
|
const Time& time = owner.db().time();
|
||||||
|
duration_ = time.userTimeToTime(duration_);
|
||||||
|
flowRateProfile_->userTimeToTime(time);
|
||||||
|
Umag_->userTimeToTime(time);
|
||||||
|
thetaInner_->userTimeToTime(time);
|
||||||
|
thetaOuter_->userTimeToTime(time);
|
||||||
|
|
||||||
// Normalise direction vector and determine direction vectors
|
// Normalise direction vector and determine direction vectors
|
||||||
// tangential to injector axis direction
|
// tangential to injector axis direction
|
||||||
|
|||||||
@ -91,19 +91,19 @@ class ConeInjection
|
|||||||
const label parcelsPerInjector_;
|
const label parcelsPerInjector_;
|
||||||
|
|
||||||
//- Flow rate profile relative to SOI []
|
//- Flow rate profile relative to SOI []
|
||||||
const autoPtr<Function1<scalar>> flowRateProfile_;
|
autoPtr<Function1<scalar>> flowRateProfile_;
|
||||||
|
|
||||||
//- Parcel velocity magnitude relative to SOI [m/s]
|
//- Parcel velocity magnitude relative to SOI [m/s]
|
||||||
const autoPtr<Function1<scalar>> Umag_;
|
autoPtr<Function1<scalar>> Umag_;
|
||||||
|
|
||||||
//- Inner half-cone angle relative to SOI [deg]
|
//- Inner half-cone angle relative to SOI [deg]
|
||||||
const autoPtr<Function1<scalar>> thetaInner_;
|
autoPtr<Function1<scalar>> thetaInner_;
|
||||||
|
|
||||||
//- Outer half-cone angle relative to SOI [deg]
|
//- Outer half-cone angle relative to SOI [deg]
|
||||||
const autoPtr<Function1<scalar>> thetaOuter_;
|
autoPtr<Function1<scalar>> thetaOuter_;
|
||||||
|
|
||||||
//- Parcel size distribution model
|
//- Parcel size distribution model
|
||||||
const autoPtr<distributionModel> sizeDistribution_;
|
autoPtr<distributionModel> sizeDistribution_;
|
||||||
|
|
||||||
//- Number of parcels per injector already injected
|
//- Number of parcels per injector already injected
|
||||||
mutable label nInjected_;
|
mutable label nInjected_;
|
||||||
|
|||||||
@ -83,6 +83,7 @@ void Foam::ConeNozzleInjection<CloudType>::setInjectionMethod()
|
|||||||
&this->owner().mesh()
|
&this->owner().mesh()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
positionVsTime_->userTimeToTime(this->owner().time());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -117,6 +118,7 @@ void Foam::ConeNozzleInjection<CloudType>::setFlowType()
|
|||||||
&this->owner().mesh()
|
&this->owner().mesh()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Pinj_->userTimeToTime(this->owner().time());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case flowType::ftFlowRateAndDischarge:
|
case flowType::ftFlowRateAndDischarge:
|
||||||
@ -130,6 +132,7 @@ void Foam::ConeNozzleInjection<CloudType>::setFlowType()
|
|||||||
&this->owner().mesh()
|
&this->owner().mesh()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Cd_->userTimeToTime(this->owner().time());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -221,7 +224,12 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
// Convert from user time to reduce the number of time conversion calls
|
||||||
|
const Time& time = owner.db().time();
|
||||||
|
duration_ = time.userTimeToTime(duration_);
|
||||||
|
flowRateProfile_->userTimeToTime(time);
|
||||||
|
thetaInner_->userTimeToTime(time);
|
||||||
|
thetaOuter_->userTimeToTime(time);
|
||||||
|
|
||||||
setInjectionMethod();
|
setInjectionMethod();
|
||||||
|
|
||||||
|
|||||||
@ -155,16 +155,16 @@ private:
|
|||||||
const label parcelsPerSecond_;
|
const label parcelsPerSecond_;
|
||||||
|
|
||||||
//- Flow rate profile relative to SOI []
|
//- Flow rate profile relative to SOI []
|
||||||
const autoPtr<Function1<scalar>> flowRateProfile_;
|
autoPtr<Function1<scalar>> flowRateProfile_;
|
||||||
|
|
||||||
//- Inner half-cone angle relative to SOI [deg]
|
//- Inner half-cone angle relative to SOI [deg]
|
||||||
const autoPtr<Function1<scalar>> thetaInner_;
|
autoPtr<Function1<scalar>> thetaInner_;
|
||||||
|
|
||||||
//- Outer half-cone angle relative to SOI [deg]
|
//- Outer half-cone angle relative to SOI [deg]
|
||||||
const autoPtr<Function1<scalar>> thetaOuter_;
|
autoPtr<Function1<scalar>> thetaOuter_;
|
||||||
|
|
||||||
//- Parcel size PDF model
|
//- Parcel size PDF model
|
||||||
const autoPtr<distributionModel> sizeDistribution_;
|
autoPtr<distributionModel> sizeDistribution_;
|
||||||
|
|
||||||
|
|
||||||
// Tangential vectors to the direction vector
|
// Tangential vectors to the direction vector
|
||||||
|
|||||||
@ -82,7 +82,11 @@ Foam::InflationInjection<CloudType>::InflationInjection
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
// Convert from user time to reduce the number of time conversion calls
|
||||||
|
const Time& time = owner.db().time();
|
||||||
|
duration_ = time.userTimeToTime(duration_);
|
||||||
|
flowRateProfile_->userTimeToTime(time);
|
||||||
|
growthRate_->userTimeToTime(time);
|
||||||
|
|
||||||
if (selfSeed_)
|
if (selfSeed_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -348,6 +348,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
|
|||||||
&owner.mesh()
|
&owner.mesh()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
massFlowRate_->userTimeToTime(owner.db().time());
|
||||||
massTotal_ = massFlowRate_->value(owner.db().time().value());
|
massTotal_ = massFlowRate_->value(owner.db().time().value());
|
||||||
this->coeffDict().readIfPresent("SOI", SOI_);
|
this->coeffDict().readIfPresent("SOI", SOI_);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,10 @@ Foam::PatchFlowRateInjection<CloudType>::PatchFlowRateInjection
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
// Convert from user time to reduce the number of time conversion calls
|
||||||
|
const Time& time = owner.db().time();
|
||||||
|
duration_ = time.userTimeToTime(duration_);
|
||||||
|
concentration_->userTimeToTime(time);
|
||||||
|
|
||||||
patchInjectionBase::updateMesh(owner.mesh());
|
patchInjectionBase::updateMesh(owner.mesh());
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class PatchFlowRateInjection
|
|||||||
scalar duration_;
|
scalar duration_;
|
||||||
|
|
||||||
//- Concentration profile of particle volume to carrier volume [-]
|
//- Concentration profile of particle volume to carrier volume [-]
|
||||||
const autoPtr<Function1<scalar>> concentration_;
|
autoPtr<Function1<scalar>> concentration_;
|
||||||
|
|
||||||
//- Parcels to introduce per unit volume flow rate m3 [n/m3]
|
//- Parcels to introduce per unit volume flow rate m3 [n/m3]
|
||||||
const scalar parcelConcentration_;
|
const scalar parcelConcentration_;
|
||||||
|
|||||||
@ -65,7 +65,10 @@ Foam::PatchInjection<CloudType>::PatchInjection
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
duration_ = owner.db().time().userTimeToTime(duration_);
|
// Convert from user time to reduce the number of time conversion calls
|
||||||
|
const Time& time = owner.db().time();
|
||||||
|
duration_ = time.userTimeToTime(duration_);
|
||||||
|
flowRateProfile_->userTimeToTime(time);
|
||||||
|
|
||||||
patchInjectionBase::updateMesh(owner.mesh());
|
patchInjectionBase::updateMesh(owner.mesh());
|
||||||
|
|
||||||
|
|||||||
@ -84,7 +84,7 @@ class PatchInjection
|
|||||||
const vector U0_;
|
const vector U0_;
|
||||||
|
|
||||||
//- Flow rate profile relative to SOI []
|
//- Flow rate profile relative to SOI []
|
||||||
const autoPtr<Function1<scalar>> flowRateProfile_;
|
autoPtr<Function1<scalar>> flowRateProfile_;
|
||||||
|
|
||||||
//- Parcel size distribution model
|
//- Parcel size distribution model
|
||||||
const autoPtr<distributionModel> sizeDistribution_;
|
const autoPtr<distributionModel> sizeDistribution_;
|
||||||
|
|||||||
@ -92,7 +92,7 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpringDamper::restrain
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
scalar t = motion.time().value();
|
scalar t = motion.time().timeOutputValue();
|
||||||
|
|
||||||
restraintPosition = motion.transform(refAttachmentPt_);
|
restraintPosition = motion.transform(refAttachmentPt_);
|
||||||
|
|
||||||
|
|||||||
@ -131,7 +131,7 @@ void Foam::radiation::fvDOM::initialise()
|
|||||||
);
|
);
|
||||||
|
|
||||||
spectralDistribution_ =
|
spectralDistribution_ =
|
||||||
spectralDistributions_->value(mesh_.time().value());
|
spectralDistributions_->value(mesh_.time().timeOutputValue());
|
||||||
|
|
||||||
spectralDistribution_ =
|
spectralDistribution_ =
|
||||||
spectralDistribution_/sum(spectralDistribution_);
|
spectralDistribution_/sum(spectralDistribution_);
|
||||||
|
|||||||
@ -378,7 +378,7 @@ void Foam::radiation::solarLoad::initialise(const dictionary& coeffs)
|
|||||||
);
|
);
|
||||||
|
|
||||||
spectralDistribution_ =
|
spectralDistribution_ =
|
||||||
spectralDistributions_->value(mesh_.time().value());
|
spectralDistributions_->value(mesh_.time().timeOutputValue());
|
||||||
|
|
||||||
nBands_ = spectralDistribution_.size();
|
nBands_ = spectralDistribution_.size();
|
||||||
|
|
||||||
|
|||||||
@ -221,8 +221,10 @@ void Foam::solarCalculator::initialise()
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
directSolarRad_ = directSolarRads_->value(mesh_.time().value());
|
directSolarRad_ =
|
||||||
diffuseSolarRad_ = diffuseSolarRads_->value(mesh_.time().value());
|
directSolarRads_->value(mesh_.time().timeOutputValue());
|
||||||
|
diffuseSolarRad_ =
|
||||||
|
diffuseSolarRads_->value(mesh_.time().timeOutputValue());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mSunLoadFairWeatherConditions:
|
case mSunLoadFairWeatherConditions:
|
||||||
|
|||||||
Reference in New Issue
Block a user