
Palabos进阶学习
学习适合publish research级别的palabos算法知识。
方雨岚(Yulan Fang)
这个作者很懒,什么都没留下…
展开
-
palabos源码:reduceImmersedForce
我们可以通过instantiateImmersedWallDataWithIndexedTagging生成贴上不同tag的固体物,这样根据不同的tag可以通过reduceImmersedForce计算其受力。其原理也很简单,就是通过对比vertices的flag,然后从g里面累计得到力。template<typename T>ReduceImmersedForce3D<T>::ReduceImmersedForce3D(int reductionFlag_) : sum原创 2021-04-15 02:02:12 · 268 阅读 · 0 评论 -
Palabos源码:Palabos里处理particles撞到壁面的情况
在particlesInCone这个算例里面,作者是将particles设定在了壁面上,由于这个算例存在particles之间的力,所以流场的particles接触壁面后就会被反弹开来。这样做的确有效果,但我觉得可能会影响到后续计算流场内concentration。实际上在ProcessingFunctional3D里面有PushParticlesAwayFromWall3D,可以将靠近壁面的particles推回流域中。/// Find particles close to a wall and ch原创 2021-04-13 20:53:30 · 332 阅读 · 0 评论 -
Palabos源码:vectorFunction3D.h
DiscreteRotationalVelocityFunction3D,ExactRotationalVelocityFunction3D,DiscreteRotationalPositionFunction3D需要角速度和旋转轴上点作为输入,其作用如同他们的命名一样。IncreasingDiscreteRotationalVelocityFunction3D,IncreasingDiscreteRotationalPositionFunction3D,IncreasingExactRotational原创 2021-04-12 02:01:27 · 275 阅读 · 0 评论 -
Palabos源码:自由面模型的体积力是如何实现的
源码位置:src/multiphysics/bodyforce3Dtemplate<typename T, template<typename U> class Descriptor>AddConstForceToMomentum3D<T,Descriptor>::AddConstForceToMomentum3D(Array<T,3> const& force_) : force(force_){ }可以看出体积力是通过一个AddC原创 2021-04-11 09:45:00 · 309 阅读 · 0 评论 -
Palabos源码: computeEquilibria
template<typename T, template<typename U> class Descriptor> void Dynamics<T,Descriptor>::computeEquilibria ( Array<T,Descriptor<T>::q>& fEq, T rhoBar, Array<T,Descriptor<T>::d> const& j, T jSqr, T原创 2021-04-10 22:40:31 · 181 阅读 · 0 评论 -
Palabos程序代码解读 | particlesInCone
已摘取核心部分,待明日有空继续解释。定义部分Box3D injectionDomain;plint startParticleIter = 1200; // Start iterating the particles after this iteration.T particleProbabilityPerCell = 4.e-6; // Per-cell rate of particle injection.T fluidCompliance = 6.e-5; // T原创 2021-04-10 22:31:43 · 563 阅读 · 0 评论 -
Palabos程序代码解读 | particle应用externalFlowAroundObstacle.cpp | 如何绘制流线图
externalFlowAroundObstacle.cpp这个算例里,particle是不影响流体的,文中注释表明该算例的particles仅仅是可视化的作用,用于绘制流线图。主要内容为:使用的是DenseParticleField3D。 typedef DenseParticleField3D<T,DESCRIPTOR> ParticleFieldT;定义参数。 int particleTimeFactor; // If the part原创 2021-04-10 21:11:52 · 526 阅读 · 0 评论 -
Palabos源码:src/particles
文章目录particle3D.h/hhclass Particle3dPointParticle3DNormedVelocityParticle3D, RestParticle3D, VerletParticle3DparticleIdentifiers3D.h/hhparticleField3D.h/hhclass ParticleField3DDenseParticleField3D,LightParticleDataTransfer3D,等multiParticleField3DparticlePro原创 2021-04-10 19:15:13 · 779 阅读 · 0 评论 -
Palabos流固耦合算法Multi-Direct Forcing Scheme IB-LBM应用在鱼的流动上实例
硕士毕业(大概明年中旬)前我尽量做到开源代码。原创 2021-04-04 04:41:07 · 1776 阅读 · 9 评论 -
Palabos论坛笔记:升力系数的计算
地址:https://palabos-forum.unige.ch/t/lift-coefficient-of-a-wing/2445提问者表示自己通过IBM方法计算一个翼的升力系数,并且使用如下代码:forceConversion = param.rho * (param.dxFinest * param.dxFinest * param.dxFinest * param.dxFinest) / (param.dtFinest * param.dtFinest);force = -reduceImm原创 2021-03-09 02:34:28 · 1582 阅读 · 2 评论 -
Palabos论坛笔记:输出涡粘性系数
地址:https://palabos-forum.unige.ch/t/export-the-eddy-viscosity-of-smagorinsky-les-model/2117提问者使用了computeKinematicViscosity(lattice),但只会返回常数运动粘度,也试着使用computeOmega(lattice),但只返回了与运动粘度有关的omega。回答:palabos此时(指2017年)没有现成的功能,投机取巧一点可以去 src/dataProcessors/dataAn原创 2021-03-09 01:43:47 · 648 阅读 · 0 评论 -
数据处理器的执行和集成机制:applyProcessingFunctional
源码位置:/src/atomicBlock/dataProcessorWrapper3D.hh首先就为我们展示了applyProcessingFunctional。template<typename T, template<typename U> class Descriptor>void applyProcessingFunctional ( LatticeBoxProcessingFunctional3D<T,Descriptor>* func原创 2020-12-27 03:57:02 · 586 阅读 · 3 评论 -
addNaiveForce和addGuoForce的源码位置
/src/latticeBoltzmann/externalForceTemplates3D.h以addNaiveForce为例,我们可以看到palabos是如何将外力场的3个分量分别施加到相应的18的方向的分布函数f’s上。static void addNaiveForce( Array<T,descriptors::ForcedD3Q19Descriptor<T>::q>& f, T* externalS原创 2020-12-27 03:43:54 · 316 阅读 · 0 评论 -
Palabos源码:momentTemplates3D
这是比较底层的代码,基本上我们在palabos的各种操作都是基于数据处理器上的,而数据处理器则是通过各种方式调用这些底层的代码进行基于分布函数f的运算。以D3Q19为例,介绍一些常见的功能。typedef descriptors::D3Q19DescriptorBase Descriptor;get_rhoBarT rhoBar = f[0] + f[1] + f[2] + f[3] + f[4] + f[5] + f[6] + f[7] + f[8]原创 2020-12-22 23:33:23 · 258 阅读 · 0 评论 -
Palabos的数据处理器
Palabos算例涉及大量数据处理器,我稍作整理,因博客不便于ctrl+f检索,我将其解读写在pdf文件上,上传至github供大家参考。我以movingWall为例演示一下如何使用这本工具书,在算例中有这两个重点数据处理器:std::vector<MultiBlock3D*> rhoBarJarg;rhoBarJarg.push_back(lattice);rhoBarJarg.push_back(rhoBar);rhoBarJarg.push_back(j);integrateP原创 2020-12-21 16:50:53 · 508 阅读 · 2 评论 -
Multi-direct forcing scheme IBM关于液体部分速度更新实现细节
文章目录编程细节关于Palabos源码2020 Palabos Summer School的pptRBC那篇论文Note编程细节在每次IBM迭代过程中,force spreading后得到流体上的力,该力在这层迭代中,会被用到流体速度的更新。这里我们可以先提取出速度的三个分量,按公式上所述更新该速度,此刻我们仅仅是得到速度数值。接下来根据旧的速度和新的速度分别计算其平衡分布Feq,以D3Q19为例我们得到两份19个平衡分布。最后是访问该格点的分布函数,该分布函数减去旧速度的Feq,然后加上新速度的原创 2020-11-29 05:22:46 · 746 阅读 · 0 评论 -
Palabos: 关于rho和rhoBar的探讨
提问者Arpon表示在AdvectionDiffusionDynamics代码里,他感到困惑,因为rhoBar是f’s之和,rho为rhoBar+1,他在文献里看BGK equilibrium项应该是这样的:fieq = ti * rhoBar * (1 + (u*vi)/cs2)然而代码里却是这样的:fieq = ti * (rhoBar + (rho * u*vi)/cs2)jonas1回复:在Palabos的定义中fibar = fi-ti,目的是为了精确度,同样的,Palabos定义的f原创 2020-11-27 01:41:35 · 484 阅读 · 3 评论 -
Palabos论坛笔记:如果你想写自己的BounceBack Dynamics
Author: jlattHi,Bounce-Back is implemented through the class “BounceBack”, which isdeclared in src/core/dynamics.h and implemented insrc/core/dynamics.hh . The easiest way to implement your own versionof bounce-back is to copy this code (both the dec.原创 2020-11-27 01:14:09 · 408 阅读 · 0 评论 -
Palabos论坛笔记:像多孔介质一样在一片随机区域随机生成一些反弹格式的点
Author: orestis Hello,the get(iX,iY) method returns a cell. A cell is made of differentthings. Among them the f_i’s are stored there. I guess that what youwant to do is to assign a random number to each f_i. TO access themyou have to use the brackets .原创 2020-11-27 00:59:48 · 402 阅读 · 0 评论 -
Palabos论坛笔记:关于数据处理器BoxProcessingFunctional3D
Author: jonas1A BoxProcessingFunctional3D_L is intended to act on asingle lattice, while a BoxProcessingFunctional3D_LL acts at the sametime on two lattices, for example to transfer information from onelattice to the other. As examples that are potent.原创 2020-11-26 23:32:31 · 292 阅读 · 0 评论 -
Palabos算例解读:cavity3d.cpp From /codesByTopic/externalMacroscopicVariables/
我们要想做理想的LBM模拟,往往中间涉及到很多其他操作,比如外部变量,耦合等等,这个算例提供了很好的展示。从int main看起,定义了变量,lattice1,lattice2,边界条件后,通过cavitySetup将其初始化。接下来定义了lattice2RhoBarJparam,显然它就是我们可以操作的地方。MultiScalarField3D<T> rhoBar(lattice2); MultiTensorField3D<T,3> j(lattice2);原创 2020-11-25 18:54:06 · 622 阅读 · 0 评论 -
Palabos源码:为什么define系列只作用在边界上呢
/** This method does nothing by default, unless overloaded in * a deriving class. This is OK, because it's the behavior * users will expect: if they use "defineSomething" on a cell, * they want it to define the boundary condition on boundary * node原创 2020-11-25 08:26:42 · 267 阅读 · 0 评论 -
Palabos源码:computeEquilibrium(iPop, rhoBar, j, jSqr)的过程
之前我提到过这个computeEquilibrium可以用来修改cell内部属性,它的调用平平无奇cell[iPop]=cell.getDynamics().computeEquilibrium(iPop, rhoBar, j, jSqr);应当会先来到这里:(basicDynamics/externalForceDynamics.h)virtual T computeEquilibrium(plint iPop, T rhoBar, Array<T,Descriptor<T>::原创 2020-11-25 05:11:26 · 512 阅读 · 0 评论 -
Palabos源码:ForcedD3Q19Descriptor
文章目录latticeTemplates3D.hexternalForceTemplates3D.h(主体部分)nearestNeighborLattices3D.hhnearestNeighborLattices3D.hlatticeTemplates3D.h在src/latticeBoltzmann/latticeTemplates3D.h这部分来源于latticeTemplates3D.h文件,可以预见主要是在lattice上的操作template<typename T>stru原创 2020-11-25 04:40:43 · 519 阅读 · 0 评论 -
Palabos源码:computeVelocity和get_rhoBar_j等
computeVelocity(cell, u)computeVelocityExternal(cell, rhoBar, j, u);调查一下如上的代码是如何通过cell返回速度Array<T,Descriptor<T>::d> u。cell.h这是cell.h里面关于计算cell的速度的代码void computeVelocity(Array<T,Descriptor<T>::d>& u) const { PLB_PRECON原创 2020-11-24 22:57:13 · 555 阅读 · 0 评论 -
Palabos源码:collideAndStream
几乎每个算例里都会有这一行代码,它背后的源代码如下:/** This operation is more efficient than a successive application of * collide(int,int,int,int,int,int) and stream(int,int,int,int,int,int), * because memory is traversed only once instead of twice. */template<typename T,原创 2020-11-24 06:13:36 · 469 阅读 · 2 评论 -
Palabos源码:integrateProcessingFunctional和BoxRhoBarJfunctional3D和ExternalRhoJcollideAndStream3D
integrateProcessingFunctional( new ExternalRhoJcollideAndStream3D<T,DESCRIPTOR>(), lattice->getBoundingBox(), rhoBarJarg, 0);integrateProcessingFunctional( new BoxRhoBarJfunctional3D<T,DESCRIPTOR>(),原创 2020-11-24 05:17:41 · 383 阅读 · 0 评论 -
Palabos源码—core/cell
今天简短地介绍一下cell。cell在palabos程序中,承担着存储分布函数和一个指针的任务。D3Q19为例,cell里面的q即为19,指针会指向dynamics,前文已述dynamics和选择碰撞的格式有关。指针的作用还体现在可以用于空间相关的边界条件或施加不均匀的体积力。当你生成cell之后,一般不可以直接使用它,你需要先使用attributeDynamics()。源代码注释里提到不要用这种方法,而是去BlockLattice里用。/// You can't use this method.原创 2020-11-23 19:54:47 · 443 阅读 · 1 评论 -
A short review of how to change the properties of lattice node
This post was written in English because my workstation(contains source codes) was not installed with any Chinese input method. In the next few days I’ll install one.Cell LocationBy the code below you can reach to the cell of the location you want as “ce原创 2020-10-04 06:39:50 · 563 阅读 · 4 评论 -
The way to write your data processor in parallelism
Author: jonas1From :https://palabos-forum.unige.ch/t/data-processor-for-non-local-operation/1075/2This example shows how to exchange the density and velocity of two blocklattices.template<typename T, template class Descriptor>class SetToLocalEqui转载 2020-09-27 20:01:40 · 178 阅读 · 0 评论 -
Palabos Multi-direct forcing scheme IBM RBC论文和代码叙述(不涉及FEM方面)
概览在之前的浸入边界法文章中,我主要介绍的是Inamuro的IBM算法,近期科研进展涉及到提高IBM算法精度,加之Palabos本身自带Multi-direct forcing scheme,便以此作为较好的一个参考。论文Bridging the computational gap between mesoscopic and continuum modeling ofred blood cells for fully resolved blood flow在我之前的博文里,IBM算法就是以这篇文原创 2020-09-12 08:05:15 · 860 阅读 · 0 评论 -
Palabos V2.1更新Deformable RBC体验
前几天听说Palabos更新到2.1版本,问了一下果然出了RBC相关的模拟,令人意外的是这次更新还添加了GPU加速的部分。因期待许久迫不及待,便抽出时间,抢先体验一下该算例的效果。本次算例体验运行于Ubuntu 18.04系统,未使用gpu运算。程序目录showcase/bloodFlowDefoBodies总体的运行步骤Step1: cmake编译Step2: 生成CPs文件夹,或者提供initialPlacing.pos文件Step3: 运行对应的血液流体程序(即判断是shear还是poi原创 2020-06-24 07:47:26 · 654 阅读 · 0 评论 -
Palabos源码学习 | 浸入边界法 | 论文公式对应源码讲解
Conbined multi-direct forcing method and IBM算法概览截图源自论文:Bridging the computational gap between mesoscopic and continuum modeling ofred blood cells for fully resolved blood flow其算法是IBM的一个版本,Multi-di...原创 2020-04-16 00:11:47 · 2415 阅读 · 0 评论 -
Palabos 源码学习 | Construct构造物体
Construct语句出自源码triangleSetGenerator.h这些代码的作用顾名思义。> template<typename T> > TriangleSet<T> constructEllipsoid(Array<T,3>> const& center, T a, T b, T c, plint min...原创 2020-04-15 14:49:26 · 567 阅读 · 0 评论 -
Palabos 源码解读 | 浸入边界法Immersed Boundary Method
边界力的计算> template<typename T> void> ComputeImmersedBoundaryForce3D<T>::processGenericBlocks (> Box3D domain, std::vector<AtomicBlock3D*> blocks ) {> PLB_P...原创 2020-04-05 01:10:28 · 5576 阅读 · 2 评论 -
Palabos程序示例 | boolMask应用 | 如何导入通过二值化图片制作的3D数据至流场
最终效果图片预处理PS类软件这里生成的画布为90×270,在中间输入文字后,保存为3D.png。Matlab关键代码节选因为在Palabos里,它的数据读取方式如同下面的形式:% for X→Xlength{% for Y→Ylength{% for Z→Zlength{% write to(nx,ny,nz);% }}}所以我们...原创 2020-03-26 22:10:40 · 984 阅读 · 1 评论 -
Palabos程序代码解读(Code Explanation) | 浸入边界法 | Moving Wall
今日看了一天Movingwall算例,又去看了很多关于lbm,ibm的论文,基本上是没有什么畏难情绪,只是该死的无从下手。Movingwall算例80%内容都比较好懂,剩下20%的确是不知所云,但也不影响应用。movingwall里应用的ibm算法似乎并不健全,与我们预想的ibm方法不太一样,当然也因此更容易理解。待有时间来此写一下代码解析。...原创 2020-03-23 05:48:50 · 4601 阅读 · 8 评论