Skip to content

OpenFOAM

OpenFOAM交流区

5.3k 主题 31.5k 帖子
  • 5 帖子
    2k 浏览

    @李东岳 在 波物作用of仿真:用k-omega SST湍流模型,k和omega初始时刻的值如何设置? 中说:

    瞬态流场的模拟,internalField对结果没有影响,只会影响最初的收敛性。internalField直接取0

    哦哦,老师,那入口处呢?

  • 6 帖子
    5k 浏览
    H

    yes ,i do and it solve.thank you .

  • 9 帖子
    4k 浏览
    李东岳

    :146: :146: :146:

    是的,对算法的理解影响到算例

  • 基于OF重叠网格模拟结构物入水的问题

    16
    16 帖子
    11k 浏览
    Z

    @李东岳 老师你好,我想请问下,设置了重力加速度g后,dynamicDict下不设置初速度,物体不能下落,这是哪里没设置好吗?

  • 关于结构入水的问题有些疑问

    3
    3 帖子
    3k 浏览
    Z

    @李东岳 老师我想请问一下,设置了重力加速度g后,我将dynamicDict文件下将 velcity设为(0 0 0),物体就停着不动了,请问需要怎么设置一下呢。

  • 3 帖子
    1k 浏览

    是不是一开始里面就有水然后没给速度

  • opf计算蒸汽气泡在过冷水中直接接触冷凝问题

    11
    11 帖子
    8k 浏览
    M

    请问大佬您算这个问题用的是哪个求解器,或是在哪个求解器中植入的相变模型

  • 拉格朗日求解器代码求助

    14
    14 帖子
    6k 浏览
    李东岳

    我在几年前做了个一拉格朗日粒子直径变化的代码。我现在已经记不起来太多了。能想起来的是:

    粒子直径跟流场的湍流动能耗散率有关系 植入的是一个跟PBM有关的粒径变化方程,考虑了coalescense和破碎 代码可以编译并且测试过可以体现粒径变化

    可以把下面的MomentumCloud.C:替换到OpenFOAM原来的代码然后编译。搞明白之后看看思路然后适配到你们的算法上。

    MomentumCloud.C:

    /*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. \*---------------------------------------------------------------------------*/ #include "MomentumCloud.H" #include "integrationScheme.H" #include "interpolation.H" #include "subCycleTime.H" #include "InjectionModelList.H" #include "DispersionModel.H" #include "PatchInteractionModel.H" #include "StochasticCollisionModel.H" #include "SurfaceFilmModel.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // template<class CloudType> void Foam::MomentumCloud<CloudType>::setModels() { dispersionModel_.reset ( DispersionModel<MomentumCloud<CloudType>>::New ( subModelProperties_, *this ).ptr() ); patchInteractionModel_.reset ( PatchInteractionModel<MomentumCloud<CloudType>>::New ( subModelProperties_, *this ).ptr() ); stochasticCollisionModel_.reset ( StochasticCollisionModel<MomentumCloud<CloudType>>::New ( subModelProperties_, *this ).ptr() ); surfaceFilmModel_.reset ( SurfaceFilmModel<MomentumCloud<CloudType>>::New ( subModelProperties_, *this ).ptr() ); UIntegrator_.reset ( integrationScheme::New ( "U", solution_.integrationSchemes() ).ptr() ); } template<class CloudType> template<class TrackCloudType> void Foam::MomentumCloud<CloudType>::solve ( TrackCloudType& cloud, typename parcelType::trackingData& td ) { if (solution_.steadyState()) { cloud.storeState(); cloud.preEvolve(); evolveCloud(cloud, td); if (solution_.coupled()) { cloud.relaxSources(cloud.cloudCopy()); } } else { ///////////////////////////////// Info<< "Dyfluid: Evolve function in MomentumCloud.C" << nl; List<DynamicList<label>> PartLabelPre(U_.size()); List<DynamicList<label>> PartLabelPost(U_.size()); DynamicList<label> cellWithPartPre; DynamicList<label> cellWithPartPost; pNumber_.primitiveFieldRef() = 0.0; forAllIter(typename MomentumCloud<CloudType>, *this, iter) { parcelType& p = iter(); pNumber_[p.cell()] += p.nParticle(); PartLabelPre[p.cell()].append(p.origId()); } forAll(U_, cell) { if (PartLabelPre[cell].size() != 0) { cellWithPartPre.append(cell); } } //Info<< cellWithPartPre << nl; ///////////////////////////////// cloud.preEvolve(); evolveCloud(cloud, td); if (solution_.coupled()) { cloud.scaleSources(); } ///////////////////////////////// forAllIter(typename MomentumCloud<CloudType>, *this, iter) { parcelType& p = iter(); PartLabelPost[p.cell()].append(p.origId()); } const volScalarField& epsi = U_.mesh().lookupObject<volScalarField>("epsilon.water"); scalar C1 = 0.00481; scalar C2 = 0.08; scalar sigma = 0.072; scalar rhoc = 998.0; scalar D1 = 0.88; scalar D2 = 9e6; scalar muc = 1e-3; const scalar dt = this->mesh().time().deltaTValue(); forAll(U_, cell) { // if there are particles in some cell if (PartLabelPost[cell].size() != 0) { cellWithPartPost.append(cell); scalar allVolume = 0.0; scalar allnParticle = 0.0; scalar allnParticleNew = 0.0; scalar diamAve = 0.0; //Info<< "Cell [" << cell << "] has " << PartLabelPost[cell].size() // << " particles" << nl; // loop all over particles forAllIter(typename MomentumCloud<CloudType>, *this, iter) { parcelType& p = iter(); // loop particles label in this cell forAll(PartLabelPost[cell], i) { // if this particle belongs to this cell if (p.origId() == PartLabelPost[cell](i)) { allVolume += p.nParticle()*M_PI/6.0*pow3(p.d()); allnParticle += p.nParticle(); diamAve = pow(allVolume/allnParticle*6.0/M_PI, 1.0/3.0); //Info<< " Labels are " << PartLabelPost[cell](i) // << ", its nParticle is " << p.nParticle() // << ", volume is " << allVolume << nl; } } } const scalar d = diamAve; // cell manipulation, calculate average diameter if (d > SMALL) { const scalar epsilon = epsi[cell]; scalar gN = allnParticle*C1*pow(epsilon, 1.0/3.0)/pow(d, 2.0/3.0) *exp(-C2*sigma/(rhoc*pow(epsilon, 2.0/3.0)*pow(d, 5.0/3.0))); scalar aSqrN = sqr(allnParticle)*D1*pow(epsilon, 1.0/3.0)*4.0*sqrt(2.0)*pow(d, 7.0/6.0) *exp(-D2*muc*rhoc*epsilon/sqr(sigma)*pow4(d)/16.0); allnParticleNew = allnParticle + (gN - aSqrN)*dt; diamAve = diamAve*pow(allnParticle/allnParticleNew, 1.0/3.0); //Info<< "gN = " << gN << nl; //Info<< "aSqrN = " << aSqrN << nl; //Info<< "Particle increased by " << allnParticleNew - allnParticle << nl; //Info<< "diamAve is " << diamAve << nl; } scalar newVolume = 0.0; forAllIter(typename MomentumCloud<CloudType>, *this, iter) { parcelType& p = iter(); forAll(PartLabelPost[cell], i) { if (p.origId() == PartLabelPost[cell](i)) { p.nParticle() = allnParticleNew/PartLabelPost[cell].size(); p.d() = diamAve; newVolume += p.nParticle()*M_PI/6.0*pow3(p.d()); //Info<< " after brecoa, volume is " << newVolume // << "p.nParticle is " << p.nParticle() << nl; } } } } } ///////////////////////////////// } cloud.info(); cloud.postEvolve(); if (solution_.steadyState()) { cloud.restoreState(); } } template<class CloudType> void Foam::MomentumCloud<CloudType>::buildCellOccupancy() { if (cellOccupancyPtr_.empty()) { cellOccupancyPtr_.reset ( new List<DynamicList<parcelType*>>(this->mesh().nCells()) ); } else if (cellOccupancyPtr_().size() != this->mesh().nCells()) { // If the size of the mesh has changed, reset the // cellOccupancy size cellOccupancyPtr_().setSize(this->mesh().nCells()); } List<DynamicList<parcelType*>>& cellOccupancy = cellOccupancyPtr_(); forAll(cellOccupancy, cO) { cellOccupancy[cO].clear(); } forAllIter(typename MomentumCloud<CloudType>, *this, iter) { cellOccupancy[iter().cell()].append(&iter()); } } template<class CloudType> void Foam::MomentumCloud<CloudType>::updateCellOccupancy() { // Only build the cellOccupancy if the pointer is set, i.e. it has // been requested before. if (cellOccupancyPtr_.valid()) { buildCellOccupancy(); } } template<class CloudType> template<class TrackCloudType> void Foam::MomentumCloud<CloudType>::evolveCloud ( TrackCloudType& cloud, typename parcelType::trackingData& td ) { if (solution_.coupled()) { cloud.resetSourceTerms(); } if (solution_.transient()) { label preInjectionSize = this->size(); this->surfaceFilm().inject(cloud); // Update the cellOccupancy if the size of the cloud has changed // during the injection. if (preInjectionSize != this->size()) { updateCellOccupancy(); preInjectionSize = this->size(); } injectors_.inject(cloud, td); // Assume that motion will update the cellOccupancy as necessary // before it is required. cloud.motion(cloud, td); stochasticCollision().update(td, solution_.trackTime()); } else { // this->surfaceFilm().injectSteadyState(cloud); injectors_.injectSteadyState(cloud, td, solution_.trackTime()); CloudType::move(cloud, td, solution_.trackTime()); } } template<class CloudType> void Foam::MomentumCloud<CloudType>::postEvolve() { Info<< endl; if (debug) { this->writePositions(); } this->dispersion().cacheFields(false); forces_.cacheFields(false); functions_.postEvolve(); solution_.nextIter(); if (this->db().time().writeTime()) { outputProperties_.writeObject ( IOstream::ASCII, IOstream::currentVersion, this->db().time().writeCompression(), true ); } } template<class CloudType> void Foam::MomentumCloud<CloudType>::cloudReset(MomentumCloud<CloudType>& c) { CloudType::cloudReset(c); rndGen_ = c.rndGen_; forces_.transfer(c.forces_); functions_.transfer(c.functions_); injectors_.transfer(c.injectors_); dispersionModel_.reset(c.dispersionModel_.ptr()); patchInteractionModel_.reset(c.patchInteractionModel_.ptr()); stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr()); surfaceFilmModel_.reset(c.surfaceFilmModel_.ptr()); UIntegrator_.reset(c.UIntegrator_.ptr()); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template<class CloudType> Foam::MomentumCloud<CloudType>::MomentumCloud ( const word& cloudName, const volScalarField& rho, const volVectorField& U, const volScalarField& mu, const dimensionedVector& g, const bool readFields ) : CloudType(cloudName, rho, U, mu, g, false), cloudCopyPtr_(nullptr), particleProperties_ ( IOobject ( cloudName + "Properties", this->mesh().time().constant(), this->mesh(), IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE ) ), outputProperties_ ( IOobject ( cloudName + "OutputProperties", this->mesh().time().timeName(), "uniform"/cloud::prefix/cloudName, this->mesh(), IOobject::READ_IF_PRESENT, IOobject::NO_WRITE ) ), solution_(this->mesh(), particleProperties_.subDict("solution")), constProps_(particleProperties_), subModelProperties_ ( particleProperties_.subOrEmptyDict("subModels", true) ), rndGen_(0), cellOccupancyPtr_(), cellLengthScale_(mag(cbrt(this->mesh().V()))), pNumber_ ( IOobject ( "pNumbers", this->mesh().time().timeName(), this->mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), this->mesh(), dimensionedScalar(dimless, 0.0) ), rho_(rho), U_(U), mu_(mu), g_(g), pAmbient_(0.0), forces_ ( *this, this->mesh(), subModelProperties_.subOrEmptyDict ( "particleForces", true ), true ), functions_ ( *this, particleProperties_.subOrEmptyDict("cloudFunctions"), true ), injectors_ ( subModelProperties_.subOrEmptyDict("injectionModels"), *this ), dispersionModel_(nullptr), patchInteractionModel_(nullptr), stochasticCollisionModel_(nullptr), surfaceFilmModel_(nullptr), UIntegrator_(nullptr), UTrans_ ( new volVectorField::Internal ( IOobject ( this->name() + ":UTrans", this->db().time().timeName(), this->db(), IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), this->mesh(), dimensionedVector(dimMass*dimVelocity, Zero) ) ), UCoeff_ ( new volScalarField::Internal ( IOobject ( this->name() + ":UCoeff", this->db().time().timeName(), this->db(), IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE ), this->mesh(), dimensionedScalar( dimMass, 0) ) ) { setModels(); if (readFields) { parcelType::readFields(*this); this->deleteLostParticles(); } if (solution_.resetSourcesOnStartup()) { resetSourceTerms(); } } template<class CloudType> Foam::MomentumCloud<CloudType>::MomentumCloud ( const word& cloudName, const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, const fluidThermo& carrierThermo, const bool readFields ) : MomentumCloud(cloudName, rho, U, carrierThermo.mu(), g, readFields) {} template<class CloudType> Foam::MomentumCloud<CloudType>::MomentumCloud ( MomentumCloud<CloudType>& c, const word& name ) : CloudType(c, name), cloudCopyPtr_(nullptr), particleProperties_(c.particleProperties_), outputProperties_(c.outputProperties_), solution_(c.solution_), constProps_(c.constProps_), subModelProperties_(c.subModelProperties_), rndGen_(c.rndGen_), cellOccupancyPtr_(nullptr), cellLengthScale_(c.cellLengthScale_), pNumber_(c.pNumber_), rho_(c.rho_), U_(c.U_), mu_(c.mu_), g_(c.g_), pAmbient_(c.pAmbient_), forces_(c.forces_), functions_(c.functions_), injectors_(c.injectors_), dispersionModel_(c.dispersionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()), stochasticCollisionModel_(c.stochasticCollisionModel_->clone()), surfaceFilmModel_(c.surfaceFilmModel_->clone()), UIntegrator_(c.UIntegrator_->clone()), UTrans_ ( new volVectorField::Internal ( IOobject ( this->name() + ":UTrans", this->db().time().timeName(), this->db(), IOobject::NO_READ, IOobject::NO_WRITE, false ), c.UTrans_() ) ), UCoeff_ ( new volScalarField::Internal ( IOobject ( name + ":UCoeff", this->db().time().timeName(), this->db(), IOobject::NO_READ, IOobject::NO_WRITE, false ), c.UCoeff_() ) ) {} template<class CloudType> Foam::MomentumCloud<CloudType>::MomentumCloud ( const fvMesh& mesh, const word& name, const MomentumCloud<CloudType>& c ) : CloudType(mesh, name, c), cloudCopyPtr_(nullptr), particleProperties_ ( IOobject ( name + "Properties", mesh.time().constant(), mesh, IOobject::NO_READ, IOobject::NO_WRITE, false ) ), outputProperties_ ( IOobject ( name + "OutputProperties", this->mesh().time().timeName(), "uniform"/cloud::prefix/name, this->mesh(), IOobject::NO_READ, IOobject::NO_WRITE, false ) ), solution_(mesh), constProps_(), subModelProperties_(dictionary::null), rndGen_(0), cellOccupancyPtr_(nullptr), cellLengthScale_(c.cellLengthScale_), pNumber_(c.pNumber_), rho_(c.rho_), U_(c.U_), mu_(c.mu_), g_(c.g_), pAmbient_(c.pAmbient_), forces_(*this, mesh), functions_(*this), injectors_(*this), dispersionModel_(nullptr), patchInteractionModel_(nullptr), stochasticCollisionModel_(nullptr), surfaceFilmModel_(nullptr), UIntegrator_(nullptr), UTrans_(nullptr), UCoeff_(nullptr) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class CloudType> Foam::MomentumCloud<CloudType>::~MomentumCloud() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> void Foam::MomentumCloud<CloudType>::setParcelThermoProperties ( parcelType& parcel, const scalar lagrangianDt ) { parcel.rho() = constProps_.rho0(); } template<class CloudType> void Foam::MomentumCloud<CloudType>::checkParcelProperties ( parcelType& parcel, const scalar lagrangianDt, const bool fullyDescribed ) { const scalar carrierDt = this->mesh().time().deltaTValue(); parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt; if (parcel.typeId() == -1) { parcel.typeId() = constProps_.parcelTypeId(); } } template<class CloudType> void Foam::MomentumCloud<CloudType>::storeState() { cloudCopyPtr_.reset ( static_cast<MomentumCloud<CloudType>*> ( clone(this->name() + "Copy").ptr() ) ); } template<class CloudType> void Foam::MomentumCloud<CloudType>::restoreState() { cloudReset(cloudCopyPtr_()); cloudCopyPtr_.clear(); } template<class CloudType> void Foam::MomentumCloud<CloudType>::resetSourceTerms() { UTransRef().field() = Zero; UCoeffRef().field() = 0.0; } template<class CloudType> template<class Type> void Foam::MomentumCloud<CloudType>::relax ( DimensionedField<Type, volMesh>& field, const DimensionedField<Type, volMesh>& field0, const word& name ) const { const scalar coeff = solution_.relaxCoeff(name); field = field0 + coeff*(field - field0); } template<class CloudType> template<class Type> void Foam::MomentumCloud<CloudType>::scale ( DimensionedField<Type, volMesh>& field, const word& name ) const { const scalar coeff = solution_.relaxCoeff(name); field *= coeff; } template<class CloudType> void Foam::MomentumCloud<CloudType>::relaxSources ( const MomentumCloud<CloudType>& cloudOldTime ) { this->relax(UTrans_(), cloudOldTime.UTrans_(), "U"); this->relax(UCoeff_(), cloudOldTime.UCoeff_(), "U"); } template<class CloudType> void Foam::MomentumCloud<CloudType>::scaleSources() { this->scale(UTrans_(), "U"); this->scale(UCoeff_(), "U"); } template<class CloudType> void Foam::MomentumCloud<CloudType>::preEvolve() { // force calculation of mesh dimensions - needed for parallel runs // with topology change due to lazy evaluation of valid mesh dimensions label nGeometricD = this->mesh().nGeometricD(); Info<< "\nSolving " << nGeometricD << "-D cloud " << this->name() << endl; this->dispersion().cacheFields(true); forces_.cacheFields(true); updateCellOccupancy(); pAmbient_ = constProps_.dict().template lookupOrDefault<scalar>("pAmbient", pAmbient_); functions_.preEvolve(); } template<class CloudType> void Foam::MomentumCloud<CloudType>::evolve() { if (solution_.canEvolve()) { typename parcelType::trackingData td(*this); solve(*this, td); } } template<class CloudType> template<class TrackCloudType> void Foam::MomentumCloud<CloudType>::motion ( TrackCloudType& cloud, typename parcelType::trackingData& td ) { CloudType::move(cloud, td, solution_.trackTime()); updateCellOccupancy(); } template<class CloudType> void Foam::MomentumCloud<CloudType>::patchData ( const parcelType& p, const polyPatch& pp, vector& nw, vector& Up ) const { p.patchData(nw, Up); Up /= p.mesh().time().deltaTValue(); // If this is a wall patch, then there may be a non-zero tangential velocity // component; the lid velocity in a lid-driven cavity case, for example. We // want the particle to interact with this velocity, so we look it up in the // velocity field and use it to set the wall-tangential component. if (!this->mesh().moving() && isA<wallPolyPatch>(pp)) { const label patchi = pp.index(); const label patchFacei = pp.whichFace(p.face()); // We only want to use the boundary condition value only if it is set // by the boundary condition. If the boundary values are extrapolated // (e.g., slip conditions) then they represent the motion of the fluid // just inside the domain rather than that of the wall itself. if (U_.boundaryField()[patchi].fixesValue()) { const vector Uw1 = U_.boundaryField()[patchi][patchFacei]; const vector& Uw0 = U_.oldTime().boundaryField()[patchi][patchFacei]; const scalar f = p.currentTimeFraction(); const vector Uw = Uw0 + f*(Uw1 - Uw0); const tensor nnw = nw*nw; Up = (nnw & Up) + Uw - (nnw & Uw); } } } template<class CloudType> void Foam::MomentumCloud<CloudType>::updateMesh() { updateCellOccupancy(); injectors_.updateMesh(); cellLengthScale_ = mag(cbrt(this->mesh().V())); } template<class CloudType> void Foam::MomentumCloud<CloudType>::autoMap(const mapPolyMesh& mapper) { Cloud<parcelType>::autoMap(mapper); updateMesh(); } template<class CloudType> void Foam::MomentumCloud<CloudType>::info() { vector linearMomentum = linearMomentumOfSystem(); reduce(linearMomentum, sumOp<vector>()); scalar linearKineticEnergy = linearKineticEnergyOfSystem(); reduce(linearKineticEnergy, sumOp<scalar>()); Info<< "Cloud: " << this->name() << nl << " Current number of parcels = " << returnReduce(this->size(), sumOp<label>()) << nl << " Current mass in system = " << returnReduce(massInSystem(), sumOp<scalar>()) << nl << " Linear momentum = " << linearMomentum << nl << " |Linear momentum| = " << mag(linearMomentum) << nl << " Linear kinetic energy = " << linearKineticEnergy << nl; injectors_.info(Info); this->surfaceFilm().info(Info); this->patchInteraction().info(Info); } // ************************************************************************* //
  • 关于k-w SST湍流模型边界条件设置的疑惑

    8
    8 帖子
    9k 浏览
    ShaneHEEES
    //k rho_*epsilon_/k_ //epsilon rho_*Cmu_*sqr(k_)/epsilon_ 为k_和epsilon_接近0,导致除法崩溃,所以使用bound()

    可以试试增大epsilon 减小k;连续性残差也偏大,可以试试fvSchemes散度项二阶换一阶。

  • 多孔介质捕捉边界

    2
    2 帖子
    825 浏览
    李东岳

    因为你用的是正方形网格,因此只能是这样的。

  • 6 帖子
    2k 浏览
    S

    确实您说的非常对,直接做blastfoam,总有种空中楼阁的黑盒子的感觉,那我去研究一下openfoam的映射算例,非常感谢

  • 时间步长对连续性方程的影响

    8
    8 帖子
    6k 浏览

    可以参考这一篇JCP 2018, Unified formulation of the momentum-weighted interpolation for collocated variable arrangements.

    image.png

  • 传热计算中物性参数分段线性插值问题

    8
    8 帖子
    7k 浏览
    L

    @王慧博 大佬您好,我最近也使用openfoam做超临界二氧化碳流动换热这块,和您出现了类似的问题,计算时连续性那块总是很差也很难收敛。然后我也尝试过使用定物性,计算则能很快的收敛,所以想向您请教下是不是buoyantPimpleFoam求解器本省对这种变物性问题不能很好的求解呢,或者目前有什么方法可以提高稳定性呢。

  • 动态接触角的问题

    36
    36 帖子
    28k 浏览
    B

    @姜磊 大佬 你有动态接触角的UDF了嘛 求大佬分享 2529693979@qq.com 万分感谢

  • 3 帖子
    1k 浏览
    G

    @tidedrinker 跪谢大佬!

  • 水槽中挡板绕流回流区计算不准

    9
    9 帖子
    4k 浏览

    @李东岳 实验里面的做法是入口固定流量,出口固定水位。我给的边界条件是入口variableheightflowrateinletvelocity,出口定流速/outletPhaseMeanVelocity

  • CFDEM运行过程中断,MPI_ABORT was invoked on rank 9

    4
    4 帖子
    2k 浏览

    @星星星星晴 好的,我检查一下,谢谢谢谢!

  • 请问这两种并行命令有区别么?

    4
    4 帖子
    3k 浏览

    回复一个远古的问题,留个纪念。

    根据最近上过的有关并行计算的课,现代CPU都是以ccNUMA作为一个单位。例如下面这台电脑有2个Socket,每个Socket有2个ccNUMA,每个ccNUMA包含18个核心,每个核心有2个线程(所谓的超线程)。

    为什么要分的这么仔细,原因之一就是这是因为现代CPU的高速缓存有部分(例如L3)是共享的,有部分是私有的(L1和L2)。访问缓存是有速度限制的,所以如果正确的分配核心的话,可以避免'交通拥挤‘。而且如果数据是储存在另外一个ccNUMA对应的缓存中的话,额外的访问延迟也是导致计算速度下降的原因之一。这点在OpenMP中格外明显和重要。至于MPI的话,MPI和OpenMP有本质上的差别,并且MPI可能涉及到多个Node间的网络延迟,所以这方面更加复杂。

    Anyway,至少在一个Node中,不要使用超线程的线程,就使用物理核心。如果有条件可以在BIOS中关闭超线程。如果没有条件可以通过likwid找到那些Thread归属于什么位置。然后通过taskset进行固定。likwid中有个程序叫做likwid-topology,从此可以得到当前Node中的CPU的拓扑结构。如下面的内容。

    多个Node暂时没有经验。但是可以通过profile对使用某些线程进行限制,我当前是没有经验的。

    至于是不是对于计算速度有绝对的提升,这个我没有结论,但是如果你需要考虑有关性能的方向的话,这种控制变量也是必要的。

    -------------------------------------------------------------------------------- CPU name: Intel(R) Xeon(R) Platinum 8360Y CPU @ 2.40GHz CPU type: Intel Icelake SP processor CPU stepping: 6 ******************************************************************************** Hardware Thread Topology ******************************************************************************** Sockets: 2 Cores per socket: 36 Threads per core: 2 -------------------------------------------------------------------------------- HWThread Thread Core Die Socket Available 0 0 0 0 0 * 1 0 1 0 0 * 2 0 2 0 0 * 3 0 3 0 0 * 4 0 4 0 0 * 5 0 5 0 0 * 6 0 6 0 0 * 7 0 7 0 0 * 8 0 8 0 0 * 9 0 9 0 0 * 10 0 10 0 0 * 11 0 11 0 0 * 12 0 12 0 0 * 13 0 13 0 0 * 14 0 14 0 0 * 15 0 15 0 0 * 16 0 16 0 0 * 17 0 17 0 0 * 18 0 18 0 0 * 19 0 19 0 0 * 20 0 20 0 0 * 21 0 21 0 0 * 22 0 22 0 0 * 23 0 23 0 0 * 24 0 24 0 0 * 25 0 25 0 0 * 26 0 26 0 0 * 27 0 27 0 0 * 28 0 28 0 0 * 29 0 29 0 0 * 30 0 30 0 0 * 31 0 31 0 0 * 32 0 32 0 0 * 33 0 33 0 0 * 34 0 34 0 0 * 35 0 35 0 0 * 36 0 36 0 1 * 37 0 37 0 1 * 38 0 38 0 1 * 39 0 39 0 1 * 40 0 40 0 1 * 41 0 41 0 1 * 42 0 42 0 1 * 43 0 43 0 1 * 44 0 44 0 1 * 45 0 45 0 1 * 46 0 46 0 1 * 47 0 47 0 1 * 48 0 48 0 1 * 49 0 49 0 1 * 50 0 50 0 1 * 51 0 51 0 1 * 52 0 52 0 1 * 53 0 53 0 1 * 54 0 54 0 1 * 55 0 55 0 1 * 56 0 56 0 1 * 57 0 57 0 1 * 58 0 58 0 1 * 59 0 59 0 1 * 60 0 60 0 1 * 61 0 61 0 1 * 62 0 62 0 1 * 63 0 63 0 1 * 64 0 64 0 1 * 65 0 65 0 1 * 66 0 66 0 1 * 67 0 67 0 1 * 68 0 68 0 1 * 69 0 69 0 1 * 70 0 70 0 1 * 71 0 71 0 1 * 72 1 0 0 0 * 73 1 1 0 0 * 74 1 2 0 0 * 75 1 3 0 0 * 76 1 4 0 0 * 77 1 5 0 0 * 78 1 6 0 0 * 79 1 7 0 0 * 80 1 8 0 0 * 81 1 9 0 0 * 82 1 10 0 0 * 83 1 11 0 0 * 84 1 12 0 0 * 85 1 13 0 0 * 86 1 14 0 0 * 87 1 15 0 0 * 88 1 16 0 0 * 89 1 17 0 0 * 90 1 18 0 0 * 91 1 19 0 0 * 92 1 20 0 0 * 93 1 21 0 0 * 94 1 22 0 0 * 95 1 23 0 0 * 96 1 24 0 0 * 97 1 25 0 0 * 98 1 26 0 0 * 99 1 27 0 0 * 100 1 28 0 0 * 101 1 29 0 0 * 102 1 30 0 0 * 103 1 31 0 0 * 104 1 32 0 0 * 105 1 33 0 0 * 106 1 34 0 0 * 107 1 35 0 0 * 108 1 36 0 1 * 109 1 37 0 1 * 110 1 38 0 1 * 111 1 39 0 1 * 112 1 40 0 1 * 113 1 41 0 1 * 114 1 42 0 1 * 115 1 43 0 1 * 116 1 44 0 1 * 117 1 45 0 1 * 118 1 46 0 1 * 119 1 47 0 1 * 120 1 48 0 1 * 121 1 49 0 1 * 122 1 50 0 1 * 123 1 51 0 1 * 124 1 52 0 1 * 125 1 53 0 1 * 126 1 54 0 1 * 127 1 55 0 1 * 128 1 56 0 1 * 129 1 57 0 1 * 130 1 58 0 1 * 131 1 59 0 1 * 132 1 60 0 1 * 133 1 61 0 1 * 134 1 62 0 1 * 135 1 63 0 1 * 136 1 64 0 1 * 137 1 65 0 1 * 138 1 66 0 1 * 139 1 67 0 1 * 140 1 68 0 1 * 141 1 69 0 1 * 142 1 70 0 1 * 143 1 71 0 1 * -------------------------------------------------------------------------------- Socket 0: ( 0 72 1 73 2 74 3 75 4 76 5 77 6 78 7 79 8 80 9 81 10 82 11 83 12 84 13 85 14 86 15 87 16 88 17 89 18 90 19 91 20 92 21 93 22 94 23 95 24 96 25 97 26 98 27 99 28 100 29 101 30 102 31 103 32 104 33 105 34 106 35 107 ) Socket 1: ( 36 108 37 109 38 110 39 111 40 112 41 113 42 114 43 115 44 116 45 117 46 118 47 119 48 120 49 121 50 122 51 123 52 124 53 125 54 126 55 127 56 128 57 129 58 130 59 131 60 132 61 133 62 134 63 135 64 136 65 137 66 138 67 139 68 140 69 141 70 142 71 143 ) -------------------------------------------------------------------------------- ******************************************************************************** Cache Topology ******************************************************************************** Level: 1 Size: 48 kB Cache groups: ( 0 72 ) ( 1 73 ) ( 2 74 ) ( 3 75 ) ( 4 76 ) ( 5 77 ) ( 6 78 ) ( 7 79 ) ( 8 80 ) ( 9 81 ) ( 10 82 ) ( 11 83 ) ( 12 84 ) ( 13 85 ) ( 14 86 ) ( 15 87 ) ( 16 88 ) ( 17 89 ) ( 18 90 ) ( 19 91 ) ( 20 92 ) ( 21 93 ) ( 22 94 ) ( 23 95 ) ( 24 96 ) ( 25 97 ) ( 26 98 ) ( 27 99 ) ( 28 100 ) ( 29 101 ) ( 30 102 ) ( 31 103 ) ( 32 104 ) ( 33 105 ) ( 34 106 ) ( 35 107 ) ( 36 108 ) ( 37 109 ) ( 38 110 ) ( 39 111 ) ( 40 112 ) ( 41 113 ) ( 42 114 ) ( 43 115 ) ( 44 116 ) ( 45 117 ) ( 46 118 ) ( 47 119 ) ( 48 120 ) ( 49 121 ) ( 50 122 ) ( 51 123 ) ( 52 124 ) ( 53 125 ) ( 54 126 ) ( 55 127 ) ( 56 128 ) ( 57 129 ) ( 58 130 ) ( 59 131 ) ( 60 132 ) ( 61 133 ) ( 62 134 ) ( 63 135 ) ( 64 136 ) ( 65 137 ) ( 66 138 ) ( 67 139 ) ( 68 140 ) ( 69 141 ) ( 70 142 ) ( 71 143 ) -------------------------------------------------------------------------------- Level: 2 Size: 1.25 MB Cache groups: ( 0 72 ) ( 1 73 ) ( 2 74 ) ( 3 75 ) ( 4 76 ) ( 5 77 ) ( 6 78 ) ( 7 79 ) ( 8 80 ) ( 9 81 ) ( 10 82 ) ( 11 83 ) ( 12 84 ) ( 13 85 ) ( 14 86 ) ( 15 87 ) ( 16 88 ) ( 17 89 ) ( 18 90 ) ( 19 91 ) ( 20 92 ) ( 21 93 ) ( 22 94 ) ( 23 95 ) ( 24 96 ) ( 25 97 ) ( 26 98 ) ( 27 99 ) ( 28 100 ) ( 29 101 ) ( 30 102 ) ( 31 103 ) ( 32 104 ) ( 33 105 ) ( 34 106 ) ( 35 107 ) ( 36 108 ) ( 37 109 ) ( 38 110 ) ( 39 111 ) ( 40 112 ) ( 41 113 ) ( 42 114 ) ( 43 115 ) ( 44 116 ) ( 45 117 ) ( 46 118 ) ( 47 119 ) ( 48 120 ) ( 49 121 ) ( 50 122 ) ( 51 123 ) ( 52 124 ) ( 53 125 ) ( 54 126 ) ( 55 127 ) ( 56 128 ) ( 57 129 ) ( 58 130 ) ( 59 131 ) ( 60 132 ) ( 61 133 ) ( 62 134 ) ( 63 135 ) ( 64 136 ) ( 65 137 ) ( 66 138 ) ( 67 139 ) ( 68 140 ) ( 69 141 ) ( 70 142 ) ( 71 143 ) -------------------------------------------------------------------------------- Level: 3 Size: 54 MB Cache groups: ( 0 72 1 73 2 74 3 75 4 76 5 77 6 78 7 79 8 80 9 81 10 82 11 83 12 84 13 85 14 86 15 87 16 88 17 89 18 90 19 91 20 92 21 93 22 94 23 95 24 96 25 97 26 98 27 99 28 100 29 101 30 102 31 103 32 104 33 105 34 106 35 107 ) ( 36 108 37 109 38 110 39 111 40 112 41 113 42 114 43 115 44 116 45 117 46 118 47 119 48 120 49 121 50 122 51 123 52 124 53 125 54 126 55 127 56 128 57 129 58 130 59 131 60 132 61 133 62 134 63 135 64 136 65 137 66 138 67 139 68 140 69 141 70 142 71 143 ) -------------------------------------------------------------------------------- ******************************************************************************** NUMA Topology ******************************************************************************** NUMA domains: 4 -------------------------------------------------------------------------------- Domain: 0 Processors: ( 0 72 1 73 2 74 3 75 4 76 5 77 6 78 7 79 8 80 9 81 10 82 11 83 12 84 13 85 14 86 15 87 16 88 17 89 ) Distances: 10 11 20 20 Free memory: 53444.9 MB Total memory: 64038.5 MB -------------------------------------------------------------------------------- Domain: 1 Processors: ( 18 90 19 91 20 92 21 93 22 94 23 95 24 96 25 97 26 98 27 99 28 100 29 101 30 102 31 103 32 104 33 105 34 106 35 107 ) Distances: 11 10 20 20 Free memory: 52998.7 MB Total memory: 64504.1 MB -------------------------------------------------------------------------------- Domain: 2 Processors: ( 36 108 37 109 38 110 39 111 40 112 41 113 42 114 43 115 44 116 45 117 46 118 47 119 48 120 49 121 50 122 51 123 52 124 53 125 ) Distances: 20 20 10 11 Free memory: 57461.9 MB Total memory: 64504.1 MB -------------------------------------------------------------------------------- Domain: 3 Processors: ( 54 126 55 127 56 128 57 129 58 130 59 131 60 132 61 133 62 134 63 135 64 136 65 137 66 138 67 139 68 140 69 141 70 142 71 143 ) Distances: 20 20 11 10 Free memory: 35591.3 MB Total memory: 64450.5 MB --------------------------------------------------------------------------------
  • openfoam内部速度为0是为什么阿?

    9
    9 帖子
    3k 浏览
    C

    @学流体的小明 非常感谢,我去试试

  • 4 帖子
    2k 浏览

    @李东岳 好的谢谢老师:ok3: