|
[Sponsors] |
June 18, 2024, 04:19 |
applying a source term to internal face
|
#1 |
Member
Eric Segalerba
Join Date: Dec 2021
Location: Italy
Posts: 31
Rep Power: 5 |
Hi everyone,
I'm struggling with a problem; I'm trying to add a class to a solver which can identify the faces belonging to the interface between two phases (of a field alpha) and apply there a source term I already programmed for other applications. I've been able to identify and count the interface cells but I can't figure out how to select the contact faces. Thank you in advance for you help, best, Eric |
|
June 18, 2024, 15:42 |
|
#2 |
New Member
sebastiaan bors
Join Date: Mar 2018
Posts: 7
Rep Power: 8 |
Hey Eric,
Could you elaborate a little more on what you need to achieve? If I understood correctly you would like to introduce a source term for some field based on some property of the alpha interface? As far as I know there is not an explicit way to do this if you require the surface of the interface to be exact and sharp without using an interpolation method similar to those from the postprocessing utilities (you might be able to adapt one of these). For example: the adIsoVector method does utilise an explicit isosurface advection method for propagating the alpha interface but these isosurfaces are chosen for an alpha value based on the local alpha gradient and values, so not necessarily for alpha = 0.5. Assuming that any source term in the cell will add to the cell average it is unclear to me how this would need to work in combination with an exact interface formulation. This may just be ignorance on my part, as it is not my expertise. |
|
June 19, 2024, 04:48 |
|
#3 |
Member
Eric Segalerba
Join Date: Dec 2021
Location: Italy
Posts: 31
Rep Power: 5 |
Hi Sebastiaan,
I don't care too much of following exaclty the interface, it's good enough to apply the source term on the faces of the cells involved! I want to add a source term which imposes a temperature on those faces (using an analytical rule to evaluate the right temperature). My interface is defined from cell's boundaries and values are 0 or 1 without intermediate values in between. I attach a figure to try to make my purpose clearer! Thank you! |
|
June 19, 2024, 05:08 |
|
#4 |
New Member
sebastiaan bors
Join Date: Mar 2018
Posts: 7
Rep Power: 8 |
There ways to introduce some additional interface compression however (as far as I am aware) you would still expect some values between 1 and 0 for the alpha field depending on your resolution. It is of course possible to manipulate the field in an runtime function or in your own solver to achieve a strict binary, although I am not sure whether this would be advisable from a stability standpoint. If you write something to achieve this binary interface it would not be too hard to loop over face neighbours in order to identify your interface faces. Having said that, I am still a bit confused on what exactly you are trying to achieve. If you impose an interface flux I would expect the fluid interface to be more accurate than effectively “snapping” the fluid interface to the cell faces and thereby changing the surface area and local gradient. If you intend to impose a scalar field value then wouldn’t you this at the cell centres, or interpolate the interface value to the cell centres?
Last edited by Sebastiaan; June 19, 2024 at 05:09. Reason: spelling |
|
June 19, 2024, 05:17 |
|
#5 |
Member
Eric Segalerba
Join Date: Dec 2021
Location: Italy
Posts: 31
Rep Power: 5 |
You're right, I didn't specify that this is an iterative process. Each run has a fixed value of the interface.
Alpha is a term to switch between solid and fluid region and each run has a fixedd value before updating it with the outcome of the previous iteration. I need the to identify the interface face because I need to evaluate the distance from face center to cell center and to apply a scalar value at the face (as if it was a boundary condition)! |
|
June 19, 2024, 05:25 |
|
#6 |
New Member
sebastiaan bors
Join Date: Mar 2018
Posts: 7
Rep Power: 8 |
Ah, that makes a lot more sense. Have you programmed a in openfoam before? You can loop over the faces and obtain the field values on both sides or the interpolated face values which would also indicate whether they are on a boundary. If not I might be able to help there but i'll need to find some time after work. I must admit being curious what kind of problem you are trying to solve that requires this approuch.
|
|
June 19, 2024, 05:41 |
|
#7 |
Member
Eric Segalerba
Join Date: Dec 2021
Location: Italy
Posts: 31
Rep Power: 5 |
That would be great! I programmed a little in OpenFOAM but I still have a lot to learn ahah. I can share what I have done so far to have a sort of template to work on!
The purpose is to apply a temperature bc (with a particular expression to estimate the right value) on the interface between fluid and solid in a topological optimization process using the adjoint! Anyway, I would really appreciate any kind of help! Thank you |
|
June 19, 2024, 05:44 |
|
#8 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
What do you do when the interface coincides with a processor boundary? |
||
June 19, 2024, 05:47 |
|
#9 |
Member
Eric Segalerba
Join Date: Dec 2021
Location: Italy
Posts: 31
Rep Power: 5 |
Actually I didn't think on how to handle such a situation. I don't know what should I do in that case. Can you give me any suggestion?
|
|
June 19, 2024, 07:04 |
|
#10 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40 |
Quote:
In any case, you will need to detect the interface faces across processor boundaries. The code in planeToFaceZone :: combine() will give you some ideas. https://develop.openfoam.com/Develop...neToFaceZone.C Obviously you need your own detection mechanism (not a plane), but the face sync handling is what you'd need to transmit the information across and ensure the everything is parallel consistent. The thresholdCellFaces class might also give some ideas. |
||
June 19, 2024, 09:12 |
|
#11 |
Member
Eric Segalerba
Join Date: Dec 2021
Location: Italy
Posts: 31
Rep Power: 5 |
Ok I get it, you're right, probably assigning the value to the cells could make that easier but I need to figure out how to modify face value to be correct once assigned in the cell!
Thank you for the advice! |
|
Tags |
classes, face selection, programming |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam for OpenFOAM 4.0 | mnikku | OpenFOAM Community Contributions | 80 | May 17, 2022 09:06 |
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 | ordinary | OpenFOAM Installation | 19 | September 3, 2019 19:13 |
what is swap4foam ?? | AB08 | OpenFOAM | 28 | February 2, 2016 02:22 |
[Other] How to use finite area method in official OpenFOAM 2.2.0? | Detian Liu | OpenFOAM Meshing & Mesh Conversion | 4 | November 3, 2015 04:04 |
fluent add additional zones for the mesh file | SSL | FLUENT | 2 | January 26, 2008 12:55 |