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/)
-   -   Is there an 'internal' boundary condition?! (https://www.cfd-online.com/Forums/openfoam-solving/66345-there-internal-boundary-condition.html)

sega July 13, 2009 06:19

Is there an 'internal' boundary condition?!
 
Hello World.

Due to the fact that the sample tool can't handle curved surfaces I had to create a patch, which can be accessed from sample.

The patch containing the surfaces of interest lie within the domain and I created a patch (or rather two) from the faceSet using splitMesh.

This patch (or faceSet) should stay 'internal' so I am running into a problem which boundary condition I should choose.

Because of the fact that this patch has no physical meaning and its sole purpose is the sample location it should simple be treated as an internal surface.

How can I assign an appropriate boundary condition to this patch?

olesen July 14, 2009 02:16

You'd need something like a cyclic patch (maybe see the jump condition too), but then you have to ensure that the face numbering matches up etc (lots of annoying work).

IMO you should actually just attempt to solve the problem directly - it would be less work and be more useful in the future. That is to say, write some new sampledFaceSet/sampledFaceZone classes. The classes would resemble in large sampledPatch, but get their values from a faceSet or faceZone, respectively.
I think that others could benefit from it too.

sega July 14, 2009 02:50

Quote:

Originally Posted by olesen (Post 222562)
IMO you should actually just attempt to solve the problem directly - it would be less work and be more useful in the future. That is to say, write some new sampledFaceSet/sampledFaceZone classes. The classes would resemble in large sampledPatch, but get their values from a faceSet or faceZone, respectively.
I think that others could benefit from it too.

Yes I have thought about somthing like that, too.
Unfortunately I don't know how writing such a class can be done.
Do you have a suggestion where I could start investigating on this subject?

olesen July 14, 2009 03:23

Quote:

Originally Posted by sega (Post 222567)
Yes I have thought about somthing like that, too.
Unfortunately I don't know how writing such a class can be done.
Do you have a suggestion where I could start investigating on this subject?

It really isn't too difficult. In src/sampling/sampledSurface, there is a sampledPatch class. Copy it to sampledFaceSet (for example), change all the class names in the file and then build the list of faces from the faceSet.toc(). There'll also be other things to adjust, but once you get started you'll find it isn't too hard.

henrik July 14, 2009 03:56

Dear Sebastian,

there are more alternatives

1) Create two separate meshes + equation coupling ($FOAM_TUTORIALS/conjugateHeatFoam/heatedBlock/)
2) Single mesh + topological changes ($FOAM_TUTORIALS/icoDyMFoam/mixer2D/)

none of which I would recommend.

All the sampling is on runtime-selection. So have a look through here

$FOAM_SRC/sampling/sampledSurface/plane/sampledPlane.C
$FOAM_SRC/sampling/sampledSurface/patch/sampledPatch.C

and create a modified version that uses a faceZone to set up the interpolation.

Henrik

olesen July 14, 2009 04:43

Quote:

Originally Posted by olesen (Post 222571)
... then build the list of faces from the faceSet.toc().

A small additional point - use faceZone rather than faceSet if possible.
It is not only more memory efficient, it will also work better with domain decomposition etc.

sega July 14, 2009 04:52

Quote:

Originally Posted by olesen (Post 222579)
A small additional point - use faceZone rather than faceSet if possible.
It is not only more memory efficient, it will also work better with domain decomposition etc.

I will try to have a look into this in the afternoon.
Meanwhile I have to say I made a huge effort to create a faceSet.
What is the difference between faceSet and faceZone?
Do I have to discard my work on the faceSet?

olesen July 14, 2009 05:08

Quote:

Originally Posted by sega (Post 222582)
Meanwhile I have to say I made a huge effort to create a faceSet.
What is the difference between faceSet and faceZone?
Do I have to discard my work on the faceSet?

From storage:
A {face,cell,point}Set is stored as a labelHash.
A {face,cell,point}Zone is stored as a labelList.

A {face,cell,point} can belong to any number of sets, but can only belong to zero or one zones.
The zones have the advantage that they are directly part of the polyMesh class. Since there is a maximum of one-to-one correspondence between a face and its zone, renumbering (eg, domain-decomposition) works much more easily.

Depending on how you create your sets, you might be able to create zones directly. Otherwise, the 'setsToZones' utility might help you.

sega July 14, 2009 06:56

Quote:

Originally Posted by olesen (Post 222571)
It really isn't too difficult. In src/sampling/sampledSurface, there is a sampledPatch class. Copy it to sampledFaceSet (for example), change all the class names in the file and then build the list of faces from the faceSet.toc(). There'll also be other things to adjust, but once you get started you'll find it isn't too hard.

Woho. I had a look into the file, but this is really cryptic to me.
I think this is too much for me as I don't have any idea what I am doing.
Blindly replacing names just don't seems right to me in such a challenging task.

What is the meaning of "build the list of faces from the faceSet.toc()"?
I thought "building" involves some wmake command?

sega July 14, 2009 07:05

Quote:

Originally Posted by henrik (Post 222575)

All the sampling is on runtime-selection. So have a look through here

$FOAM_SRC/sampling/sampledSurface/plane/sampledPlane.C
$FOAM_SRC/sampling/sampledSurface/patch/sampledPatch.C

and create a modified version that uses a faceZone to set up the interpolation.

Henrik

Dear Henrik.

Thanks for your suggestion.
The code in these two files look even worse to me than sampledSurface.
As I have mentioned in my previous post I fear we are overestimating my knowledge in this case.

I can only suggest you take my problem as a recommendation for some future implementation (which should be done by someone more experienced).

Meanwhile I will take a look into your 'reciepe' for beginners in
http://www.cfd-online.com/Forums/ope...ogramming.html

henrik July 14, 2009 08:02

Dear Sebastian,

"SampledSurface is the virtual base class of both sampledPlane and sampledPatch and cannot be instantiated or used on its own"

If your asking yourself:

- How do I know that sampledSurface is the base class
- How do I know that sampledSurface is virtual
- and why it cannot be instatiated or used

then, IMHO, you will find it quite hard to make this fly. However, I can only stress what Mark said: This is not very difficult, especially if you create the sampledSurface from a faceZone, but it requires some basic C++-knowledge. Saying that, the questions above are not really covered by the step-by-step intro to OF programming that I mapped out in the link.

So questions remains: "What do I need to know to be able to do XYZ in OpenFOAM?". I would love to see such step-by-step guides on the Wiki - for future reference and to throw at newbies ;)

I think the first thing to do would be to formulate what YOU want to be able to do and then WE can start threads/Wiki documents to provide step-by-step guides. A list of books (or better chapters of books) would be helpful, too.

Henrik

olesen July 14, 2009 08:26

Quote:

Originally Posted by sega (Post 222598)
I think this is too much for me as I don't have any idea what I am doing.
Blindly replacing names just don't seems right to me in such a challenging task.

For a case (or two) of decent Weizen (eg, Erdinger, K. Ludwig, Maisel), I could whip it together for you. We'd just have to sove the transport problem (pun intended).

Quote:

What is the meaning of "build the list of faces from the faceSet.toc()"?
That would simply mean something like this
Code:

  labelList myFaces = myFaceSet.toc();
// or to avoid copying
  labelList myFaces(myFaceSet.size());
  label i=0;
  forAllConstIter(labelHashSet, myFaceSet, iter)
  {
    myFaces[i++] = iter.key();
  }


sega July 14, 2009 09:09

Quote:

Originally Posted by henrik (Post 222606)
So questions remains: "What do I need to know to be able to do XYZ in OpenFOAM?". I would love to see such step-by-step guides on the Wiki - for future reference and to throw at newbies ;)

I think the first thing to do would be to formulate what YOU want to be able to do and then WE can start threads/Wiki documents to provide step-by-step guides. A list of books (or better chapters of books) would be helpful, too.

Henrik

Dear Henrik.

I'm glad I've got your attention - I appreciate that.
As proposed by you I will give you an overview what I want to do.
As a matter of fact I have scattered these information all over the forum, but I will give you a short overview.

Although it is not directly related to the sampling-solution I will tell what simulation we are dealing with.

Its the turbulent simulation of the flow inside of an axisymmetric 3D domain (actually its the combustion chamber of an aircraft's turbine).

After the simulation inside the domain is finished we want to take a close look on some part of the domain. Have a look at this image. I'm talking about the red sub-domain:

http://therealsega.th.funpic.de/openfoam/ekt/arc.png

We want to use a different solver and a different discretization on the sub-domain (which exists separately from the big domain!) as we assume there is something interesting happening to the fuel jet. This should be made possible by:
  • sampling all face values on the red area from the first simulation results
  • mapping them on the small domain with the timeVaryingMappedFixedValue boundary condition
We have tested this approach on some simple domain which consists only of plane surfaces and the results are satisfying.

But in the real case we are dealing with curved surfaces whose boundaries lie within the domain and therefore can't be accessed by the sample tool (which deals only with cutting planes or patches).

This is why I thought about making sample work on faceSets, because the faces of interest (the red ones) can easily be selected as one.

I hope I made the case clear.
Discussion is open ... :)

henrik July 14, 2009 09:11

Dear Mark, dear Sebastian,

why don't you both come to the Stammtisch and do the trade there (programming and payment)?

Henrik

CFDUser_ July 7, 2014 07:49

creating circular patch
 
Hi,

I have gone through this threat and felt like it is the better place to seek if it is possible to create circular patch on hex faces. topoSet can be used to list all the faces in specified circular region and can create new patch but solution is diffusive as the patch looks like castled circle.

Is there any way to create circular patches?


Regards,
CFDUser_

randolph March 26, 2019 12:23

Quote:

Originally Posted by sega (Post 222462)
Hello World.

Due to the fact that the sample tool can't handle curved surfaces I had to create a patch, which can be accessed from sample.

The patch containing the surfaces of interest lie within the domain and I created a patch (or rather two) from the faceSet using splitMesh.

This patch (or faceSet) should stay 'internal' so I am running into a problem which boundary condition I should choose.

Because of the fact that this patch has no physical meaning and its sole purpose is the sample location it should simple be treated as an internal surface.

How can I assign an appropriate boundary condition to this patch?

I know this post is about 10 years old...
For who came after that is trying to define the monitor patch within the mesh, you just need to delete the internal face in boundary file under polyMesh and use the faceZone as the index for the monitor

saeed sangchooly March 23, 2022 10:49

Quote:

Originally Posted by randolph (Post 728940)
I know this post is about 10 years old...
For who came after that is trying to define the monitor patch within the mesh, you just need to delete the internal face in boundary file under polyMesh and use the faceZone as the index for the monitor

dear randolph
I'm new to openfoam
how should I use the faceZone as the index foe the monitor?


All times are GMT -4. The time now is 00:24.