CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Initial Condition for alpha (VOF) using funkySetFields/swak4Foam (https://www.cfd-online.com/Forums/openfoam-solving/121451-initial-condition-alpha-vof-using-funkysetfields-swak4foam.html)

shildenbrand July 29, 2013 07:04

Initial Condition for alpha (VOF) using funkySetFields/swak4Foam
 
Hi all,

I have following problem:
I want to simulate how a liquid runs out of a (car) door sill. The door sill is kind of box-shaped, but unfortunately only kind of: The left and the right side have different heights, the left side and right side are not perpendicular to the bottom, with each side being differently. Unfortunately I am not allowed to post picture here.

The door sill itself is located in a larger box which is my computational area.

I now want to impose a initial condition for alphawater such that the door sill is filled to a certain percentage with my liquid.

Basically I need to know which cell is inside the door sill and which cell is outside.

I generate my mesh using snappyHexMesh and reading in STL data.

With funkySetFields I can make a logical expression in the form of "(pos().x > 1.487) && (pos().x < 3.052)" [...] but that is not sufficient.

Any ideas anyone?

Thanks,
Stefan

gschaider July 29, 2013 13:14

Quote:

Originally Posted by shildenbrand (Post 442562)
Hi all,

I have following problem:
I want to simulate how a liquid runs out of a (car) door sill. The door sill is kind of box-shaped, but unfortunately only kind of: The left and the right side have different heights, the left side and right side are not perpendicular to the bottom, with each side being differently. Unfortunately I am not allowed to post picture here.

The door sill itself is located in a larger box which is my computational area.

I now want to impose a initial condition for alphawater such that the door sill is filled to a certain percentage with my liquid.

Basically I need to know which cell is inside the door sill and which cell is outside.

I generate my mesh using snappyHexMesh and reading in STL data.

With funkySetFields I can make a logical expression in the form of "(pos().x > 1.487) && (pos().x < 3.052)" [...] but that is not sufficient.

Any ideas anyone?

Thanks,
Stefan

Sorry. Without even a sketch it's hard to understand what you're saying.

And in case of "I am not allowed to post of picture here" consider getting a support contract with someone who can help you. The topic (car) and the town (Stuttgart) suggest that you're not working for someone who can't afford it

shildenbrand July 29, 2013 13:37

1 Attachment(s)
Quote:

Originally Posted by gschaider (Post 442640)
Sorry. Without even a sketch it's hard to understand what you're saying.

And in case of "I am not allowed to post of picture here" consider getting a support contract with someone who can help you. The topic (car) and the town (Stuttgart) suggest that you're not working for someone who can't afford it

Ok you're right. Without a sketch - hard to understand. So I tried this sketch (cut through the configuration):Attachment 23867

And by the way - no- I am not working for the company you are assuming, neither directly nor doing project work for them.

akidess July 30, 2013 04:19

Much better. Is the outer basin essential, or could you just drain into "infinity" instead?

shildenbrand July 30, 2013 04:33

Hi Anton,


for the first period of the process (which is the draining part) it is not necessary, for the second period (when the last drops come out) I need at least the bottom side.

Stefan

akidess July 30, 2013 04:40

An idea might be to just have the door sill alone and initialize it, and then use mapfields to a domain containing the outer box.

shildenbrand July 30, 2013 04:59

Quote:

Originally Posted by akidess (Post 442747)
An idea might be to just have the door sill alone and initialize it, and then use mapfields to a domain containing the outer box.

I thought about that, too, but the problem is that the door sill has many holes and gaps. If I tried to mesh it separately, I'd have to close all holes.
I think about it again - thanks for your idea!

gschaider July 30, 2013 06:56

Quote:

Originally Posted by shildenbrand (Post 442750)
I thought about that, too, but the problem is that the door sill has many holes and gaps. If I tried to mesh it separately, I'd have to close all holes.
I think about it again - thanks for your idea!

Is there a way to mark the "inner" region in the mesher and then write it out as a cellZone/cellSet? Because then setting the liquid only inside would be as simple as "(zone(inner) && pos().z<maxZ && pos().z>minZ) ? 1 : 0"

shildenbrand July 30, 2013 10:09

I have tried the following:

Wrap the door sill only with large meshsize (-> holes get closed), use convex hull (-> really big holes get closed). This gave me a coarse closed volume, which I could use in snappyHexMesh.

Next steps:
- funkySetFields (as before, only looking at the z-axis)
- mapFields to my "old" fine case

When looking now at my initial solution at t=0 I am quiet happy with the result.
However, my computation now diverges quickly (which did not happen before - my previous initialization were two approximated boxes with different height).

@Bernhard: I have found no way to generate a cellset of the inside of the door sill - so far I tried only opensource-software to prepare the surfaces and SHM to generate a volume mesh.


Thanks for you answers, I have now a better initial condition - although a different new problem :confused:

gschaider July 30, 2013 13:01

Quote:

Originally Posted by shildenbrand (Post 442841)
@Bernhard: I have found no way to generate a cellset of the inside of the door sill - so far I tried only opensource-software to prepare the surfaces and SHM to generate a volume mesh.

SHM has the ability to generate cellZones. See the snappyHeater (or so) tutorial

shildenbrand August 2, 2013 05:08

Hi all,

just a quick update:

I've played around with cellSets (separately or within SHM) but none of this seems to work in my case. The (as of today) best way to generate an initial condition for alphawater seems to be:
- generate a closed version of the door sill
- funkySetFields with pos().z < <some value>
- go to the "big" case
- mapFields <from closed version>
- funkySetBoundaryField with expression "internalField(alphawater)"

--> the liquid looks pretty good afterwards, unfortunately I get convergence problems due to the mapping (I assume)

Stefan

P.S. Is there any way to include the boundary condition "constantAlphaContactAngle" within swak4Foam?

gschaider August 2, 2013 06:24

Quote:

Originally Posted by shildenbrand (Post 443449)
P.S. Is there any way to include the boundary condition "constantAlphaContactAngle" within swak4Foam?

What do you mean with "include"?

shildenbrand August 2, 2013 07:38

Quote:

Originally Posted by gschaider (Post 443467)
What do you mean with "include"?

If I use funkySetFields on 0/alphawater, where I use the BC (for example)

Schweller_Schweller_links
{
type constantAlphaContactAngle;
theta0 50;
limit gradient;
value uniform 0;
}

funkySetFields complains about the used type, gives me a overview about the correct ones (e.g. zeroGradient and some 50 others) and stops. I have to change the type to zeroGradient, use funkySetFields, and switch back to constantAlphaContactAngle.

By "include" I mean: How and where do I include $FOAM_SRC/transportModels/twoPhaseProperties/lnInclude such that funkySetFields does not complain anymore?

gschaider August 3, 2013 05:34

Quote:

Originally Posted by shildenbrand (Post 443478)
By "include" I mean: How and where do I include $FOAM_SRC/transportModels/twoPhaseProperties/lnInclude such that funkySetFields does not complain anymore?

Thanks for the clarification. But you see the point? It was clear to you because you were confronted with the problem before you wrote that posting. But everyone else is lacking that context. You wouldn't be happy with the answer "That is OK. The boundary condition is not in the runtime-selection table" instead of the one below (and there ARE people who'd confronted with that answer would say "Ah. Of course. Libs in controlDict. Only have to find the right library")

Quote:

Originally Posted by shildenbrand (Post 443478)
If I use funkySetFields on 0/alphawater, where I use the BC (for example)

Schweller_Schweller_links
{
type constantAlphaContactAngle;
theta0 50;
limit gradient;
value uniform 0;
}

funkySetFields complains about the used type, gives me a overview about the correct ones (e.g. zeroGradient and some 50 others) and stops. I have to change the type to zeroGradient, use funkySetFields, and switch back to constantAlphaContactAngle.

The "problem" is that constantAlphaContactAngle is a "special" boundary condition that is not present in the finiteVolume library. And FSF only links against this (would be hard to link it against every library that holds some boundary conditions). The good new is that you can "inject" additional BCs if they are in a library: just add that library to the libs-list in the controlDict then the runtime-selection-table will know about it and FSF can read and write this BC. The name of the library that has this boundary condition starts with "libtwoPhase" (which it is differs between OF-versions. Have a look in $FOAM_LIBBIN and experiment)

shildenbrand August 5, 2013 05:55

Thank you very much for your help - it actually was "libtwoPhaseProperties.so" I had to declare in my controlDict.
You're right about the description of the problem (in text or by a sketch). I'll try my very best in the future.

shildenbrand August 6, 2013 03:44

Hi all,

my final comment for future reference. The way I get my computation converging is slightly different as posted above. It is

- generate a closed version of the door sill
- funkySetFields with pos().z < <some value>
- go to the "big" case
- mapFields <from closed version>
- generate cellZone of cells near walls of door sill
faceSet f0 new patchToFace <Patches>
cellSet c0 new faceToCell f0 any
cellZoneSet c0Zone new setToCellZone c0
- use funkySetFields with condition "(zone(c0Zone))" to set alpha=0 there
- run case

Apparently my divergence problems came from alpha=1 at some outlet holes in the door sill.

Thanks again for the help.
Stefan


All times are GMT -4. The time now is 14:39.