
[Sponsors] 
May 29, 2017, 04:00 
Immersed Boundary Method

#1 
Member
Vu
Join Date: Nov 2016
Posts: 41
Rep Power: 5 
Hi everyone,
I'm trying to simulate a channel flow with cyclic boundary condition. First, i was able to add an extra vector to the momentum equation in order to keep a constant pressure gradient along the channel. Now i want to keep the cyclic boundary condition and add a cylinder inside the channel to see how the vortex distribute and i was trying to define the cylinder by using Immersed Boundary Method. So i made a few adjustment in the tutorial cylinderInChannelIcoIbFoam which is available in foamextend 3.2. However i have faced this error message when running icoIbFoam. Code:
Create time Create mesh for time = 0 Create immersed boundary cell mask Create immersed boundary face mask Found immersed boundary patch 0 named ibCylinder External flow Number of IB cells: 39 Reading field p Reading field U Calculating potential flow > FOAM FATAL ERROR: Can't find nearest triSurface point for cell 1800, (0.98 0.48 0.05)Hit data = 0 (0.0528086 0.243847 0.05) 1 From function immersedBoundaryFvPatch::makeIbPointsAndNormals() const in file immersedBoundaryFvPatch/immersedBoundaryFvPatch.C at line 1035. FOAM aborting Aborted (core dumped) i would very appreciate any of your help to solve this error. 

May 31, 2017, 03:58 

#2 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,859
Rep Power: 29 
You probably have a piece of STL boundary outside of your mesh.
Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

May 31, 2017, 10:45 

#3 
Member
Vu
Join Date: Nov 2016
Posts: 41
Rep Power: 5 
Dear prof Jasak,
Thank you for your reply. However, all i did is to change the boundary condition of inlet and outlet to cyclic type and did not adjust the STL mesh. I've read through the immersedBoundaryFvPatch.C and printed out all the ibCells to check. By that way, I figured out within the list there were two invalid cells at the topleft corner and topright corner, since they are quite far from the cylinder surface (named 1800 and 1874). Therefore, i guess the problem is probably the cyclic boundary condition that made the code confuse when checking immersed boundary cells. I also tried hiding these following lines of the immersedBoundaryFvPatch.C (from line 420 to 467) and printed out ibCells again and this time the two cells above were gone. Code:
forAll (gE.boundaryField(), patchI) { if (gE.boundaryField()[patchI].coupled()) { scalarField gammaExtOwn = gE.boundaryField()[patchI].patchInternalField(); scalarField gammaExtNei = gE.boundaryField()[patchI].patchNeighbourField(); const unallocLabelList& fCells = mesh_.boundary()[patchI].faceCells(); forAll (gammaExtOwn, faceI) { if ( mag(gammaExtNei[faceI]  gammaExtOwn[faceI]) > SMALL ) { if (gammaExtOwn[faceI] > SMALL) { if (!ibCellSet.found(fCells[faceI])) { ibCellSet.insert(fCells[faceI]); } } else if (2*gammaExtOwn.size() == fCells.size()) { if ( !ibCellSet.found ( fCells[gammaExtOwn.size() + faceI] ) ) { ibCellSet.insert ( fCells[gammaExtOwn.size() + faceI] ); } } } } } } So professor, could you give me some advice? Vu 

July 12, 2017, 23:18 

#4 
Member
Vu
Join Date: Nov 2016
Posts: 41
Rep Power: 5 
Dear prof Jasak,
It's been a while and i'm still struggling with applying cyclic boundary condition to immersed boundary solver. I have some ideas of how the code works now. In the makeIbCells() function, there are 2 forAll loops. The first one is used to check interior ibCells and the second is to check on boundary. If the boundary is coupled, the code will take gamma values of patchInternalField and patchNeighbourField into account. The problem is the gamma values returned by gE.boundaryField().patchNeighbourField() is always wrong. Specifically, In the cylinderInChannelIcoIbFoam tutorials, the cylinder is totally located within internalField, so the gamma values at centroids of all boundaries's cell must be equal to 1. However, at the second forAll loops, i printed out the gamma values which is assigned to gammaExtOwn and gammaExtNei: Code:
forAll (gE.boundaryField(), patchI) { if (gE.boundaryField()[patchI].coupled()) { scalarField gammaExtOwn =gE.boundaryField()[patchI].patchInternalField(); Pout<< "gamma values at owner cells: " << gammaExtOwn << endl; // Added scalarField gammaExtNei =gE.boundaryField()[patchI].patchNeighbourField(); Pout<< "gamma values at neighbour cells: " << gammaExtNei << endl; // Added const unallocLabelList& fCells = mesh_.boundary()[patchI].faceCells(); ... Code:
gamma values at owner cells: 25{1} gamma values at neighbour cells: 25 ( 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.004 ) gamma values at owner cells: 25{1} gamma values at neighbour cells: 25 ( 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 ) 

May 3, 2018, 08:17 

#5 
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 4 
Hello Foamers,
May i get your help? Indeed, I need to simulate 2D oscillating cylinder with immersed boundary Mesh. Up to date, I have been able to write simple harmonic equation of motion in C++ (x''+w^2x=0). But the challenging task now is to map a 2d cylinder within Open Foam that will be oscillating and again to mesh it is with IB not body fitted meshes. Can you help to know through which way, I will be able to make that solver? Regard! 

May 3, 2018, 13:44 

#6 
Member
Vu
Join Date: Nov 2016
Posts: 41
Rep Power: 5 
Hi Ben,
Have you gone through the movingCylinderInChannelIco tutorial? I think to make the immersed cylinder oscillate, you only need to define the motion in dynamicMeshDict the same way as you do with a moving body fitted cylinder 

May 5, 2018, 11:24 

#7  
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 4 
Quote:
There is no other way I can edit an existing solver like pimpleDyMFoam and get immersed boundary meshes. Just guide me! Regard! 

May 23, 2018, 13:51 
Forces coefficients

#8 
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 4 
Hello,
I wanted to plot forces coefficients for a movingcylinderInChannel tutorial. Can you help? how should my controldict look like? I would appreciate your help. Thank you! 

May 23, 2018, 22:47 

#9 
Member
Vu
Join Date: Nov 2016
Posts: 41
Rep Power: 5 
You can simply use functionObjects, add these lines to the end of controlDict
functions ( forces { type immersedBoundaryForces; functionObjectLibs ("libimmersedBoundaryForceFunctionObject.so"); outputControl timeStep; outputInterval 1; patches ( nameOfyourpatch); pName p; UName U; rhoName rhoInf; rhoInf 1; log true; CofR ( 0 0 0 ); Aref 0.05; //Your cylinder's diameter if 2D and cylinder's surface area if 3D Uref 1; // Inlet velocity } ); just take a look at the controlDict of the movingCylinderInChannel tutorials and do the exact same thing! Hope this can help 

May 24, 2018, 01:51 

#10  
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 4 
Quote:
I thank you for your quick feedback. However, i wanted the coefficients(drag coefficients and lift coeff.). Can you help on that? or it is done in the same way? Another point, i want to simulate similar cylinder (D=0.05m) but at different Reynolds number. Can you help to know the Reynold used in that tutorial and how i can modify it. I would appreciate. Regard! 

July 9, 2018, 10:47 

#11 
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 4 
Hello foamers,
I was running the tutorial in Foam extent 4.0(movingcylinderInchannel) but failed to refine mesh in the vicinity of the cylinder. Can any one help to know how I can refine the mesh. Thank you! 

July 13, 2018, 09:36 

#12 
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 4 
Hello
I would like to ask about convergence of a simulation in foam ext 4.0 Indeed, i am running a case following a tutorial of immersed boundary(movingcylinderInchannel), using IcoDyMIbFOAM, I would like to ask about its convergence, Does it converge, according to you what should I do to get it converged? You may refer to the attached picture of residuals of my case! Regard! .................................................. ...................................... /** C++ **\  =========    \\ / F ield  foamextend: Open Source CFD   \\ / O peration  Version: 3.2   \\ / A nd  Web: http://www.foamextend.org   \\/ M anipulation   \**/ FoamFile { version 2.0; format ascii; class dictionary; object fvSolution; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // solvers { p { solver amgSolver; cycle Wcycle; policy PAMG; nPreSweeps 2; nPostSweeps 2; groupSize 4; minCoarseEqns 4; nMaxLevels 100; scale on; smoother symGaussSeidel; minIter 1; maxIter 100; tolerance 1e7; relTol 0.01; } pFinal { solver amgSolver; cycle Wcycle; policy PAMG; nPreSweeps 2; nPostSweeps 2; groupSize 4; minCoarseEqns 4; nMaxLevels 100; scale on; smoother symGaussSeidel; minIter 1; maxIter 100; tolerance 1e7; relTol 0.00; } U { solver BiCGStab; preconditioner ILU0; minIter 1; maxIter 1000; tolerance 1e08; relTol 0; } } SIMPLE { nNonOrthogonalCorrectors 5; pRefPoint (0 0.45 0.05); pRefValue 0; } PIMPLE { nOuterCorrectors 1; nCorrectors 4; nNonOrthogonalCorrectors 0; pRefPoint (0 0.45 0.05); pRefValue 0; } // ************************************************** *********************** // and FoamFile { version 2.0; format ascii; class dictionary; location "system"; object controlDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // application icoDyMIbFoam; startFrom latestTime; startTime 0; stopAt endTime; endTime 40; deltaT 0.02; writeControl adjustableRunTime; writeInterval 0.5; purgeWrite 0; writeFormat binary; writePrecision 6; writeCompression uncompressed; timeFormat general; timePrecision 6; runTimeModifiable true; adjustTimeStep yes; maxCo 0.5; libs ( "libimmersedBoundary.so" "libimmersedBoundaryDynamicFvMesh.so" ); functions ( forces { type immersedBoundaryForces; functionObjectLibs ("libimmersedBoundaryForceFunctionObject.so"); outputControl timeStep; outputInterval 1; patches ( ibCylinder ); pName p; UName U; rhoName rhoInf; rhoInf 1; log true; CofR ( 0 0 0 ); Aref 0.05; Uref 20; } ); // ************************************************** *********************** // 

Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Wind turbine simulation  Saturn  CFX  58  July 3, 2020 01:13 
implementation of the Immersed Boundary Method  mi_cfd  Main CFD Forum  19  April 24, 2019 01:24 
3D Windturbine simulation in SU2  k.vimalakanthan  SU2  14  February 8, 2019 14:43 
Question about adaptive timestepping  Guille1811  CFX  25  November 12, 2017 17:38 
Error  Solar absorber  Solar Thermal Radiation  MichaelK  CFX  12  September 1, 2016 05:15 