|
[Sponsors] |
Looping over all cells in DEFINE_INIT function |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 31, 2018, 05:04 |
Looping over all cells in DEFINE_INIT function
|
#1 |
New Member
asdf
Join Date: Aug 2018
Posts: 7
Rep Power: 7 |
Hello all,
I am doing desorption of hydrogen in hydrogen tank and i'm new to this area. Initially, metal hydride is stored in a porous zone (zone ID of 7). Its initial density is 5369 kg/m3 and becomes 5300 kg/m3 when hydrogen is fully discharged. So, I set an initializing function with define_init function, such as http://imgdb.kr/eaWa (It's a safe site, no ad) UDMI(c,t,0) is the density UDMI(c,t,1) is hydrogen to metal ratio (a.k.a HM ratio) UDMI(c,t,2) is equilibrium pressure. I think UDMI 1 and 2 are not really wrong, but UDMI(c,t,0) has a problem I guess. I realized that initial density is not 5369 everywhere in the porous zone. For example, this is the contour of 0.02 seconds after initializing. This is from CFD-Post program. http://imgdb.kr/eaWb You can see that most areas are 5369 kg/m3, but it decreases when it is closer to the side of the wall, which I did not expect. The contour is supposed to look like this, which is from a literature. http://imgdb.kr/eaWd Actually, if I draw contours on the fluent itself from 'postprocessing' tab, the contour looks same as that from the literature, but contour from the CFD-Post seems to be different. And I believe it's not 5369 everywhere because I get a weird result after around 1000 seconds. Please can anyone give me some guidelines? Thanks... |
|
August 31, 2018, 06:15 |
|
#2 |
Senior Member
|
That is because you set values for those cells but not the boundary faces. It is up to the post-processing tools how those parts near the boundary are displayed. In your case I think cfd-post treat the value near the boundary as zero while fluent treats the boundary as zero-gradient. It is just a visual display, do not be panic if you only use the values stored in the cells during your calculation.
|
|
August 31, 2018, 06:27 |
|
#3 | |
New Member
asdf
Join Date: Aug 2018
Posts: 7
Rep Power: 7 |
Quote:
I guess I am having an error somewhere else.... |
||
August 31, 2018, 06:47 |
|
#4 | |
New Member
asdf
Join Date: Aug 2018
Posts: 7
Rep Power: 7 |
Quote:
http://imgdb.kr/eaWZ Should I loop over faces as well?? |
||
August 31, 2018, 10:31 |
|
#5 |
Senior Member
|
It is no harm to do so. Some boundary types do not store density values so you have to check whether the memory for storage is allocated. Note that the visualization takes boundary into consideration while you only set the cell values so that the visualization alone is not a good indication whether your cell values have the same value.
|
|
August 31, 2018, 12:29 |
|
#6 | |
New Member
asdf
Join Date: Aug 2018
Posts: 7
Rep Power: 7 |
Quote:
I'm a bit confused because I am new to fluent.... Basically, I know what nodes, faces, cells, domains, etc. are, but since I am saving a value of 5369 kg/m3 all over the cell threads in that porous zone, I do not understand why the value decreases when it gets closer to the tank walls. Since I'm looping all over cells, doesn't it mean the value will be constant anywhere within the zone I set? http://imgdb.kr/eb4e I still don't understand why there is variation near the cell walls. The image is supposed to be orange everywhere. Also, I don't think it's a matter of how CFD-Post shows. I mean the value actually varies when I check with charts. So is the only way to solve this looping over all faces of boundary walls as well? I am currently looping over cell threads only, but I thought this automatically includes faces in cells. |
||
August 31, 2018, 20:39 |
|
#7 |
Senior Member
|
The charts is no more accurate than the contour, and is not reliable. The data are all stored in cell centers, but in most cases the visualization uses node values. So the node values must be interpolated from cell-center values and, for nodes located at the boundary, from boundary face center values. While a specific tool like FLUENT may not store the boundary face center value at all (a typical case is symmetric boundary condition) and infer the value from boundary condition when needed, a general tool like CFD-Post might just assign some default value like zero when there is not data available in those boundary face centers. It is simply a misleading appearance, not that the cell-center value near the boundary is smaller than those far away from the boundary.
|
|
September 1, 2018, 01:59 |
|
#8 | |
New Member
asdf
Join Date: Aug 2018
Posts: 7
Rep Power: 7 |
Quote:
I added loops of faces as well and everything worked fine....... Since the reaction occurs inside the tank in reality, I thought I had to deal with cells only, because I thought if I do with faces as well, it could mean the reaction happens at the outside wall of the tank. Well, since it's working so great, I thank to you. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
whats the cause of error? | immortality | OpenFOAM Running, Solving & CFD | 13 | March 24, 2021 07:15 |
Problem with divergence | TDK | FLUENT | 13 | December 14, 2018 06:00 |
[blockMesh] non-orthogonal faces and incorrect orientation? | nennbs | OpenFOAM Meshing & Mesh Conversion | 7 | April 17, 2013 05:42 |
[snappyHexMesh] snappyHexMesh won't work - zeros everywhere! | sc298 | OpenFOAM Meshing & Mesh Conversion | 2 | March 27, 2011 21:11 |
Problem with compile the setParabolicInlet | ivanyao | OpenFOAM Running, Solving & CFD | 6 | September 5, 2008 20:50 |