CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   polyMesh files, Elements? (http://www.cfd-online.com/Forums/openfoam/111998-polymesh-files-elements.html)

gironidegirona January 19, 2013 10:43

polyMesh files, Elements?
 
Hi you all!

Pleasure to post here (my first post :D).

I'm trying to do some freeSurface simulations with OpenFoam, I do the set-up as well as I can but the thing comes when I do have to set where there's VOF (alpha = 1). I'm following the damBreak example which is more or less the same, but the problem comes up when I want to generate the alpha list.

what I want to do is to set some elements on a certain zone with fluid. to do so what I need to do is to know which are the elements on this zone and set the alpha value equal to 1. am I right?

So the question to come is, where the jeck is the list of elements inside polyMesh folder?, the list of alphas in damBreak is as long as nFaces, but I'm working on a 3D problem, there's anyway to know how many alphas do I have to set? are they related with the elements?

Thank you,

wyldckat January 19, 2013 16:44

Greetings gironidegirona and welcome to the forum!

Look into the file "system/setFieldsDict" and you'll learn how you can select a zone in the mesh domain.
When you run the command setFields it will use that dictionary file for applying your requests.

For more example files, run these command:
Code:

find $FOAM_TUTORIALS $FOAM_UTILITIES -name setFieldsDict
Best regards,
Bruno

gironidegirona January 29, 2013 05:10

Thanks wyldckat :D,

Thanks for the fast reply, a couple of hours after posting here I realized how to use the setFieldsDict, but the thing I'm facing now is different. I can start a simulation with some predefined alphas, but during the simulation I would like to reduce the number of alphas or to increase it in determined places.

The easiest thing for me is to know the relation with the alpha list and the points of that determine the cell, that way I'll do my check "is this element in the redion I'm checking" and do the operations I need to do?

I hope I've explained myself.

Thanks,

Sergi

wyldckat January 29, 2013 18:11

Greetings Sergi,

That's an interesting kind of simulation you're trying to perform. But AFAIK, not very simple to put into practice.

From what I know, you have a few possible solutions:
  • You can try funkySetFields, which is part of swak4Foam. It's like setFields, but extremely powerful and very simple to use. But you'll have to start-stop your simulation once in a while.
  • There is also "simpleFunctionObjects", also part of swak4Foam, which can be used while the simulation is running and do operations similar to funkySetFields, without the need to stop the simulation. But I'm not sure if it provides a feature such as working per zone or using "if cell then"... but it's very likely the best bet.
  • Then there is also OpenFOAM's own "#codeStream" feature, that allows embedding C++ code directly into the case's dictionaries.
These are the possible solutions I can think of. You'll have to investigate further!

Good luck! Best regards,
Bruno

gironidegirona January 30, 2013 02:56

Pretty interesting Bruno thank you very much!

Actually yesterday I was writing a python program to stop the simulation (seting and endTime after writing data and the continue with and endTime = endTime + writeInterval)

I'll try the FunkysetFields, I think It'll meet my purpose.

Moreover is it simple to change boundary conditions (considering that I stop the simulation and I'm able to write the time folders). Imagine I want to set a PID for the inlet and change the flow depending on the results I get.

Thanks,

Sergi

wyldckat January 30, 2013 16:28

Hi Sergi,

:eek: implementing a PID... nice! Although I'm not familiar with any such implementation on OpenFOAM...

I think swak4Foam has some functionality for using Python controls directly in OpenFOAM... then again, it might need pythonFlu for the ability to control boundary conditions directly with Python code. You'll have to research more on this topic.
You can find references to pythonFlu in swak4Foam's wiki page.

Either way, it should be possible to do what you want, but coding is definitely involved! Either in Python or C++.

Best regards,
Bruno

elvis February 4, 2013 04:28

Quote:

Originally Posted by gironidegirona (Post 404948)
Actually yesterday I was writing a python program to stop the simulation

Hi,

do you know pythonflu? Just saw that you know python so why not using
the OF python wrapper


All times are GMT -4. The time now is 06:11.