Skip to content

Re: External flow in openLB – doubts


Before using setNx(), I thought of trying setOffset() as it is…but I get a runtime error(segmentation fault)! I have not used blockGeometry.reInit() – I think setOffset() itself does that. Am I correct? The only lines I added were the following.rnrn

rnrn nx1=blockGeometry.getNx();rn ny1=blockGeometry.getNy();rn nz1=blockGeometry.getNz();rncout<<””n Before offset, nx=””<<nx1<<””, ny=””<<ny1<<””and nz=””<<nz1<<endl;rnoffset1 = int((nx1 + ny1 + nz1)/6);rncout<<””Changing offset of “”<<blockGeometry.getOffset()<<”” to “”<<offset1<<endl;rnblockGeometry.setOffset(offset1);rnrnif (singleton::mpi().isMainProcessor()) {rn clout << “”Nx=”” << blockGeometry.getNx() << “”; Ny=”” << blockGeometry.getNy() << “”; Nz=”” <<blockGeometry.getNz() << endl;rn }rnrn /// THIS PART RESULTS IN A SEGMENTATION FAULT !!rn for (int iY = 1; iY < blockGeometry.getNy() – 1; iY++) {rn for (int iZ = 1; iZ < blockGeometry.getNz() – 1; iZ++) {rn blockGeometry.setMaterial(0, iY, iZ, 3);rn }rn }rnrn

rnrnAnd this is the outputrnrnBefore offset, nx=252, ny=106and nz=245rnChanging offset of 0 to 100rn[main] Nx=252; Ny=106; Nz=245rnSegmentation fault (core dumped)rnrnIf I don’t get setOffset to work, I will change to Xp, Xn etc just like you suggested. But what am I doing wrong with setOffset() now?? 😐 rnrn