@李东岳 这台电脑的CPU有点年头了,虽然支持4通道,但是插了两条内存。
huiCfd
帖子
-
-
CPU型号: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz 系统:Linux mint 19.3 版本:openfoam-6 # cores Wall time (s): ------------------------ 8 552.63 4 623.67 2 814.52 1 1419.05
-
@东岳 感谢东岳老师回复,请问应该用何种循环 才能在并行时 对所有的cell进行计算呢?
因为并行计算时,函数只在第一个processor里面的domain进行了循环,而所求观测点不在第一个processor的domain里,所以该函数无法返回符合要求的速度。如果要让该函数在其他proessor下也进行循环的话我应该如何修改?或者我应该看哪方面的资料来解决这个问题。
谢谢 -
processor零,不是o。因为字体原因,0和o看起来很像。
-
Hello,各位大神,
我在用我自己写的一个求解器并行计算时出现了一个奇怪的问题。这个问题只有在并行计算的时候才会出来,当不并行时没事。问题的具体描述如下:
在我的solver中有一个名为 updateVelocity 的成员函数来获取计算域中某观察点(这个观察点的位置可能会随着时间改变)的速度。
具体如下:while (runTime.loop()) { Info << "Time = " << runTime.timeName() << nl << endl; #include "CourantNo.H" // Pressure-velocity PISO corrector { #include "UEqn.H" // --- PISO loop while (piso.correct()) { #include "pEqn.H" } } laminarTransport.correct(); turbulence->correct(); //>>>>>>>>>>>>>Below>>>>>>> Nettings.updateVelocity(U,mesh); //<<<<<<<<<<<<<Above<<<<<< runTime.write(); Info << "ExecutionTime = " << runTime.elapsedCpuTime() << " s" << " ClockTime = " << runTime.elapsedClockTime() << " s" << nl << endl; } Info << "End\n" << endl; return 0; }
这个函数的源代码如下,具体实现形式就是判断每个cell的中心到观察点的距离,然后取出距离观察点距离最近的cell的速度
void Foam::netPanel::updateVelocity( const volVectorField &U, const fvMesh &mesh) { const vectorField ¢res(mesh.C()); List<vector> fluidVelocities(structuralElements_memb.size(), vector::zero); Info << "In updateVelocity, number of mesh is " << centres.size() << endl; Info << "In updateVelocity, number of U is " << U.size() << endl; scalar maxDistance(1); forAll(EPcenter, Elemi) { maxDistance = 1; vector nearestCell(vector::zero); scalar loops(0); forAll(centres, cellI) // loop through all the cells, { scalar k1(calcDist(centres[cellI], EPcenter[Elemi])); if (k1 < maxDistance) { maxDistance = k1; fluidVelocities[Elemi] = U[cellI]; nearestCell = centres[cellI]; loops += 1; Info << "After " << loops << " times of loop, the nearest cell is " << nearestCell << "to point " << EPcenter << "\n" << endl; } } } fluidVelocity_memb = fluidVelocities; // only assige onece Info << "the velocity on nodes are " << fluidVelocity_memb << endl; }
就是这样的一个简单的函数,但是在并行时却出现了问题。
首先我们来看串行计算的情况:Starting time loop Time = 0.01 Courant Number mean: 0.000565 max: 0.0904 smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 2.4007e-06, No Iterations 1 smoothSolver: Solving for Uy, Initial residual = 0.891308, Final residual = 1.23902e-06, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 0.895257, Final residual = 1.31102e-06, No Iterations 1 GAMG: Solving for p, Initial residual = 1, Final residual = 8.40918e-07, No Iterations 35 time step continuity errors : sum local = 9.50237e-10, global = 1.27782e-10, cumulative = 1.27782e-10 smoothSolver: Solving for epsilon, Initial residual = 1, Final residual = 0.00445555, No Iterations 1 smoothSolver: Solving for k, Initial residual = 1, Final residual = 0.004493, No Iterations 1 In updateVelocity, number of mesh is 184320 In updateVelocity, number of U is 184320 After 1 times of loop, the nearest cell is (-0.49375 -0.21875 -0.39375)to point (0 0.05 -0.1) ... ... After 45 times of loop, the nearest cell is (-0.00625 0.05625 -0.20625)to point (0 0.05 -0.2) the velocity on nodes are 4((0.226059 -2.8946e-08 -3.59708e-08) (0.226059 3.97379e-08 -4.07855e-08) (0.226059 2.65165e-08 -2.22689e-08) (0.226059 -4.12251e-08 -1.8172e-08)) ExecutionTime = 2.31 s ClockTime = 2 s
计算的结果没有任何问题,上面的updateVelocity函数也能够顺利的找到4个特定观察点的速度。
但是问题来啦,如果并行计算的话,updateVelocity就没法找到这4个特定观察点的速度了。
Starting time loop Time = 0.01 Current Number means: 0.000565 max: 0.0904 smoothSolver: Solving for Ux, Initial residual = 1, Final residual = 2.4007e-06, No Iterations 1 smoothSolver: Solving for Uy, Initial residual = 0.892185, Final residual = 1.24606e-06, No Iterations 1 smoothSolver: Solving for Uz, Initial residual = 0.895991, Final residual = 1.31577e-06, No Iterations 1 GAMG: Solving for p, Initial residual = 1, Final residual = 9.93486e-07, No Iterations 34 time step continuity errors : sum local = 1.12264e-09, global = -1.18173e-10, cumulative = -1.18173e-10 smoothSolver: Solving for epsilon, Initial residual = 1, Final residual = 0.0107252, No Iterations 1 smoothSolver: Solving for k, Initial residual = 1, Final residual = 0.0106817, No Iterations 1 In updateVelocity, number of mesh is 23177 In updateVelocity, number of U is 23177 the velocity on nodes are 4{(0 0 0)} ExecutionTime = 0.57 s ClockTime = 1 s
并行和串行用的是同统一套网格,并行是用 scotch方法分成了八个subdomains
值得注意的是:
在串行计算中:In updateVelocity, number of mesh is 184320
在并行计算中:In updateVelocity, number of mesh is 23177
其中23177就是在processor0中的cell数,下面的是在processor0内的U文件FoamFile { version 2.0; format ascii; class volVectorField; location "0.1"; object U; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -1 0 0 0 0]; internalField nonuniform List<vector> 23177 ( (0.225112 5.13224e-05 2.5452e-05)
也就是说,在并行时这个函数只读入梁processor0里面的速度和网格,其他processor1、2、3... 均没有放进来。
请问各位大神有没有人遇到过类似的情况?
-
问题解决了。将1.0 改为dimless,就可以啦。
具体可以参考这里 -
@东岳 请问是指的openfoam 的编译问题吗?我注意到在程序开始的时候有一个warning,师兄说一般warning都没啥事。但是我看这个warning也是跟IO的控制相关的。感觉有可能在这里就有问题了。
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time --> FOAM Warning : From function static Foam::IOstreamOption::compressionType Foam::IOstreamOption::compressionEnum(const Foam::word&) in file db/IOstreams/IOstreams/IOstreamOption.C at line 86 Unknown compression specifier 'uncompressed', assuming no compression Create mesh for time = 0 PISO: Operating solver in PISO mode
-
各位大神好,
在运行我自己写的solver时,遇到了一个关于读取文件的问题。我需要在一开始的creatField 时,根据我具体的研究对象,写一个名字为 porosityField的volScalarField到"0" 文件夹。我的具体代码如下:
Info<< "Before read porosity field " << "\n" << endl; volScalarField porosityField ( IOobject ( "porosityField", runTime.timeName(), mesh, IOobject::READ_IF_PRESENT, //NO_READ, IOobject::AUTO_WRITE ), mesh, 1.0 ); Info<< "After read porosity field " << "\n" << endl; //- update the porosity field porousZones.updatePoroField(porosityField, mesh); //- write the porosity field porosityField.write();
当运行的时候出现了如下的错误:
Before read porosity field --> FOAM FATAL ERROR: cannot find file "/home/hui/OpenFOAM/hui-v1906/run/Te1/0/porosityField" From function virtual Foam::autoPtr<Foam::ISstream> Foam::fileOperations::uncollatedFileOperation::readStream(Foam::regIOobject&, const Foam::fileName&, const Foam::word&, bool) const in file global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C at line 548. FOAM exiting
根据错误信息可以看出,这一行“Info<< "After read porosity field " << "\n" << endl;” 还没有运行到。所以就是这个读入这个文件的错误,我将 IOobject::READ_IF_PRESENT, 改为IOobject::NO_READ 后再次尝试,但是给出的是同样的错误信息。另外mesh后面的那个1 .0是默认值,去掉后再编译运行也是跟上面同样错误信息。
然而根据这一页的openfoamwiki , 我这样生成的volScalarField 应该没有问题。而且如果用READ_IF_PRESENT 或者NO_READ ,不应该给出找不到文件的错误提示。
- MUST_READ – The object must be read from Istream on construction. An error message is produced if Istream does not exist or can't be read.
- READ_IF_PRESENT – It reads the object from Istream if Istream exists, otherwise doesn't. An error message is produced only if Istream exists but can't be read.
- NO_READ – Don't read the object.
不知道大家有没有类似的经验,帮忙解决一下。
在此提前感谢! -
@nbyjn hello,我最近也在做这样一件事,将参数传入到求解器。 我想将一个矩阵[100*3]左右的数据传入,不知道您这里可以给我一些提示吗?
-
@wwzhao 非常感谢指点迷津!
-
@huiCfd 可能这个适用于of1906
-
@wwzhao
成功了啊! 非常感谢。。
是不可以总结如下经验:- 自己编写的类在编译时一定要以lib开头,
- 然后在编译主程序时,$(FOAM_USER_LIBBIN)后面不能有换行符,
- -l之后直接跟自己编译的东西但是要去掉lib
-
@wwzhao 是的,去掉何不去掉都试过了,
去掉后显示的错误是-lm -o /home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam /usr/bin/ld: cannot find -llibnetPanel collect2: error: ld returned 1 exit status /opt/OpenFOAM/OpenFOAM-v1906/wmake/makefiles/general:140: recipe for target '/home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam' failed make: *** [/home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam] Error 1
没去掉的话跟原来的错误一样,都是undefined reference
-
@wwzhao 不行。。
-
@wwzhao
定义也是有的。如下Foam::netPanel::netPanel ( const dictionary& netDict ) : // initial components netDict_(netDict), porousPropertiesDict_(netDict_.subDict("porousProperties")), porosity_(readScalar(porousPropertiesDict_.lookup("porosity"))), thickness_(readScalar(porousPropertiesDict_.lookup("halfthickness"))) // D_(readVector(porousPropertiesDict_.lookup("D"))), // initial as zeros // F_(readVector(porousPropertiesDict_.lookup("D"))) // initial as zeros { dimensionedVector D_(porousPropertiesDict_.lookup("D")); dimensionedVector F_(porousPropertiesDict_.lookup("F")); }
-
@huiCfd
这个函数后面的const 是用来保护类的成员数据不发生改变。 -
@wwzhao 赵教授,这两个函数我记得定义了,
// Constructors netPanel ( const dictionary& netDict ); //- Destructor ~netPanel();
但是我有一点不太明白,为什么有的函数后面有一个const,有的没有。例如:
这个虚函数是void funname() const;void addResistance ( fvVectorMatrix& UEqn, const volScalarField& nu, const fvMesh& mesh, const matrix& structuralPositions, const matrix& structuralElements )const;
而这个函数是 bool funname(); 就没有const了。
bool isInPorousZone ( const point x, const volVectorField& structuralPositions, const vector& structuralElementi );
const 在括号里面我知道是可以保证传入的参数不变,但是在外边是啥意思啊?
-
@东岳 感谢东岳老师回复,我又看了一下错误提示,出现问题的都是我写的虚函数。
-
我在想是不是 我的这个option里买有格式错误。
我试过将EXE_LIBS = \ -L$(FOAM_USER_LIBBIN)\ -lnetPanel \
改为
EXE_LIBS = \ -L$(FOAM_USER_LIBBIN) -lnetPanel \
结果感觉更错啦
-lm -o /home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam /usr/bin/ld: cannot find -lnetPanel collect2: error: ld returned 1 exit status /opt/OpenFOAM/OpenFOAM-v1906/wmake/makefiles/general:140: recipe for target '/home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam' failed make: *** [/home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam] Error 1
-
@yfclark
这个function, 我已经写到我的class中了,但是问题是在编译求解器时遇到问题“undefined reference”void Foam::netPanel::addResistance ( fvVectorMatrix& UEqn, const volScalarField& nu, const fvMesh& mesh_, const volVectorField& structuralPositions, const volVectorField& structuralElements ) { const vectorField& centres(mesh_.C()); forAll(structuralElements,Elementi) { dimensionedTensor d_(tensor::zero); dimensionedTensor f_(tensor::zero); transformCoeffs(D_,d_,structuralPositions,structuralElements[Elementi]); transformCoeffs(F_,f_,structuralPositions,structuralElements[Elementi]); tensor& dvalue = d_.value(); tensor& fvalue = f_.value(); const scalarField V = mesh_.V(); vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); forAll(centres, cellI) { if(isInPorousZone(centres[cellI],structuralPositions,structuralElements[Elementi])) { tensor dragCoeff = nu[cellI]*dvalue + 0.5*mag(U[cellI])*fvalue; Usource[cellI] -=V[cellI]*dragCoeff & (U[cellI] ); } } } }
-
@yfclark 在 编译自己的求解器遇到问题“undefined reference” 中说:
编译过了只是说明你骗过了编译器不代表程序没有问题,你说的可以直接添加源项解决,通过访问mesh的cells或者face解决
那个netpanel的class的作用就是找到特定的mesh,并在cells决添加源项。
-
- wclean/ wmake 已经很多次了,每次都是自己写的class可以先编译成功,并生成netPanel.so 这个lib。但是dynaPorousNetFoam.C 就编译出现问题。
- 如果自己写的class有问题的话,是不应该在第一步编译的时候就会出现问题?
- 因为研究的对象不是充满整个计算域,只有特定的范围内的网格才有源项。 又因为研究对象有大变形,不同时间对应不同的网格,所以不能直接在方程中添加源项。
- 所以我自己写的class就是根据结构的空间位置,找出对应的网格,并在这些网格中添加源项。
-
Hello,各位大神,
我在编译自己一个求解器的过程中出现了如下的问题:提示说有用undefined reference.
-lincompressibleTransportModels -lOpenFOAM -ldl \ -lm -o /home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam Make/linux64GccDPInt32Opt/dynaPorousNetFoam.o: In function `main': dynaPorousNetFoam.C:(.text.startup+0x1408): undefined reference to `Foam::netPanel::~netPanel()' dynaPorousNetFoam.C:(.text.startup+0x1f01): undefined reference to `Foam::netPanel::netPanel(Foam::dictionary const&)' ...... ...... dynaPorousNetFoam.C:(.text.startup+0x68c5): undefined reference to `Foam::netPanel::~netPanel()' collect2: error: ld returned 1 exit status /opt/OpenFOAM/OpenFOAM-v1906/wmake/makefiles/general:140: recipe for target '/home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam' failed make: *** [/home/hui/OpenFOAM/hui-v1906/platforms/linux64GccDPInt32Opt/bin/dynaPorousNetFoam] Error 1
下面说一下我编译的程序结构,我的dynaForousNetFoam 求解器是基于PisoFOAM 进行简单修改后编译的。这个新的求解器调用了我自己写的一个class创建了porousZones 对象,并利用相关的成员函数对U 方程进行修改。
这个class 名是netpanel,并且这个类可以单独用wmake编译成功,结果如下:. ├── platforms │ └── linux64GccDPInt32Opt │ ├── bin │ └── lib │ └── netPanel.so └── run
我求解器中部分相关的代码:
... netPanel porousZones(netDict); // constrcut net panel porousZones.updatePoroField(porosityField, mesh, structuralPositions,structuralElements); //- write the porosity field porosityField.write(); ... // add source term to U equation porousZones.addResistance(UEqn,nu,mesh,structuralPositions,structuralElements); ...
下面是我在编译dynaForousNetFoam 时用的file 和options 文件。从option中可以看出我在编译dynaForousNetFoam的时候已经链接到我之前写的那个class了,但是编译还是不通过。
File:dynaPorousNetFoam.C EXE = $(FOAM_USER_APPBIN)/dynaPorousNetFoam
Option:
EXE_INC = \ -I./Netpanels/lnInclude \ -I$ (LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel EXE_LIBS = \ -L$(FOAM_USER_LIBBIN)\ -lnetPanel \ -lfiniteVolume \ -lfvOptions \ -lmeshTools \ -lsampling \ -lturbulenceModels \ -lincompressibleTurbulenceModels \ -lincompressibleTransportModels
所以有没有大神能够帮忙指点一下?
-
@Hungryandfool 可以啊,欢迎交流 可以加我微信chenghui62000
-
@Hungryandfool 你要用reef3D 的话得去NTNU跟着Hans才行,要不然自己搞不定的。我主要做结构的 波浪方面我懂得不多,但是我们组做这块的人倒是有几个挺厉害的,我有问题都问他们。
-
@Hungryandfool Reef3D 时NTNU的一个德国人弄得,功能强看起来挺多,但是外部人员很难使用
-
最近我也在看笔记本打算买个新的。。我觉得可能联想的Y700-i78750h+1050ti或者dellG5-i78750h+1050ti
-
@孟豪龙 我最近也在看这个电脑。。不确定散热能不能跟上。毕竟只有一根半的热管
-
首先,把计算域特点介绍一下:本算例是为比较圆柱绕流问题与三维螺旋结构绕流的不同。
本研究中的三维螺旋结构是由三个圆螺旋拉伸形成的结构,有点类似于麻花(但是麻花是两个圆柱缠绕的):
将流体域与该结构做一个布尔运算,得到的流体域的结构如下图所示:
其中左侧为速度入口,使用的是LES模型要求壁面的Y+=1
————————————————分界线——————————————————
圆柱绕流的网格画分比较简单,可以通过O型网格得到较好的结果。
但是对于新结构的网格可能不太适合,不能一通到底的使用O型剖分。
下面是我尝试用workbench 中的Meshing画分的网格的俯视图:利用的是sweep方法。
现在想利用ICEM来画分,是想能得到更好的网格?请问大家有没有什么想法
200万网格并行算力测试(OpenFOAM版本)
200万网格并行算力测试(OpenFOAM版本)
并行时函数只能在processor0执行
并行时函数只能在processor0执行
并行时函数只能在processor0执行
关于读取文件的错误
关于读取文件的错误
关于读取文件的错误
关于OpenFOAM的输入输出
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
编译自己的求解器遇到问题“undefined reference”
interPlicFoam
interPlicFoam
interPlicFoam
CFDer,你们的工作用笔记本电脑是哪款?
CFDer,你们的工作用笔记本电脑是哪款?
请教一个有关外流域网格划分的问题