CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

OpenFoam 3D cases

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 20, 2016, 12:00
Default OpenFoam 3D cases
  #1
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Hi,

Is there any basic tutorial available for 3D cases? The tutorial contains 2D cases, I am not aware if there is any 3D case.

I am looking basic setup for creating my own model.

Thanks.
cute is offline   Reply With Quote

Old   May 21, 2016, 18:15
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

tutorials/basic/laplacianFoam/flange looks quite 3D. What exactly you are looking for?
alexeym is offline   Reply With Quote

Old   May 21, 2016, 18:47
Default
  #3
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Hi,

tutorials/basic/laplacianFoam/flange looks quite 3D. What exactly you are looking for?
Thnaks alexeym for replying. I found another one but it also did not solve my problem. In tutorial case, I don't see 3D object at all, i.e expecting a sphere in the center.

I created a geometry with dimension 1 x 1 x 0.5. I initialized the bottom part with a rectangular box in center and with field value 0.2. After running blockMesh and setFields, i visualized it in paraview. I can see 3D mesh, but I don't see rectangular box in center. Instead it appears as a 2D rectangle but not a box.
cute is offline   Reply With Quote

Old   May 21, 2016, 19:04
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
So, do I get it right: you are quite happy with generated 3D mesh, and not satisfied with setFields results? Could you post setFieldsDict file (and maybe screenshots of your visualization, to be sure words in message and picture are the same, to avoid misunderstanding)?
alexeym is offline   Reply With Quote

Old   May 21, 2016, 19:20
Default
  #5
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Quote:
Originally Posted by alexeym View Post
So, do I get it right: you are quite happy with generated 3D mesh, and not satisfied with setFields results? Could you post setFieldsDict file (and maybe screenshots of your visualization, to be sure words in message and picture are the same, to avoid misunderstanding)?
Here is setFieldsDict

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v3.0+ |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues ( volVectorFieldValue U (0 0 0) volScalarFieldValue T 0);

regions ( boxToCell { box (0.04 0.04 0) (0.06 0.06 0.04) ; fieldValues ( volScalarFieldValue T 0.2) ; } );


// ************************************************** *********************** //
Attached Images
File Type: jpg box.jpg (159.9 KB, 78 views)
cute is offline   Reply With Quote

Old   May 22, 2016, 04:58
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well, it is not setFields, it is the way you visualize the field. On the picture it looks like you selected "Surface" representation in paraview and then set opacity of the surface (but it still remain surface, i.e. something 2D). To look inside your mesh, you need to cut it with Clip filter (see attached screenshot for example) or use Volume representation.
Attached Images
File Type: png pv.png (64.3 KB, 53 views)
alexeym is offline   Reply With Quote

Old   May 22, 2016, 12:16
Default
  #7
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Quote:
Originally Posted by alexeym View Post
Well, it is not setFields, it is the way you visualize the field. On the picture it looks like you selected "Surface" representation in paraview and then set opacity of the surface (but it still remain surface, i.e. something 2D). To look inside your mesh, you need to cut it with Clip filter (see attached screenshot for example) or use Volume representation.
Thanks, probably this is the problem. I am new to openfoam and paraview and still learning. How can I use volume representation to visualize as 3D? Could you please write steps or point me to some tutorial?

Edit:
I was able to use clip filter as you mentioned. But it only shows shape as a slice. How can I see my whole object as 3D? Like a 3D dambreak example in youtube?

Edit:
I also managed to visualize using volume representation. Now I need to do more fine tuning and need more technique to visualize it properly.
I would like to do the following and looking for answer:
1. How to make side walls as transparent with bottom part as one color say black? Opacity make the whole box non-visible. But I need bottom part.
2. What color map should I select? My initial value is 0.2 and growing but has different values in different part of the object?
2.

Last edited by cute; May 22, 2016 at 13:03. Reason: Found somethng:
cute is offline   Reply With Quote

Old   May 23, 2016, 01:50
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
It would be easier if you illustrate what you need. Concerning your questions:

1. Open case in paraview twice, second time you select only bottom patch in the list of parts to import and draw it with solid color.

2. Question is beyond my comprehension. You can select colormap your like and set custom range of values. Also in recent versions of paraview it can go through time steps and rescale colormap to span over whole range of values.
alexeym is offline   Reply With Quote

Old   May 23, 2016, 10:55
Default
  #9
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Thanks alexeym for your reply.

I am simulating biomass growth in my simulations. When I change the opacity value of the grid, it also changes for biomass. It looks transparent.

1. I would like to visualize biomass growth as solid while the box invisible.
2. How can I set lighting effect to visualize it better?
3. As I am new, I used BoxToCell method to initialize my data. I don't know, how to setup initial data with semisphere at the center of bottom part.

Thanks in advance.
cute is offline   Reply With Quote

Old   May 24, 2016, 02:30
Default
  #10
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well,

2. To understand your "better" one have to see what you have now.

3. Since setFields utility uses topoSets to select cells, you can check $FOAM_UTILITIES/mesh/manipulation/topoSet/topoSetDict for possible ways to specify selection (there is sphereToCell for example).
alexeym is offline   Reply With Quote

Old   May 26, 2016, 11:35
Default
  #11
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
How to use sphereToCell, so it produce semisphere?
cute is offline   Reply With Quote

Old   May 26, 2016, 16:44
Default
  #12
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
1. Since your semi-sphere is at the bottom of domain, place center of the sphere on the edge of domain. Half of the sphere will be outside of simulation domain and you get just semi-sphere inside.

2. If you need more general solution, you have to use topoSet and setFields together. With topoSet you create hemispherical cellSet and them use cellToCell topoSet in setFieldsDict. Here is an example: imagine, you need hemisphere with centre (0 0 0.1) and 5 cm radius. You create cellSet c0 with topoSet:

Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      topoSetDict;
}

actions
(
    {
        name c0;
        type cellSet;
        action new;
        source sphereToCell;
        sourceInfo
        {
            centre (0 0 0.1);
            radius 0.05;
        }
    }

    {
        name c0;
        type cellSet;
        action delete;
        source boxToCell;
        sourceInfo
        {
            box (-1 -1 -1) (1 1 0.1);
        }
    }

);

// vim: set ft=foam et sw=4 ts=4 sts=4:
First you create sphere using sphereToCell and then delete half with boxToCell. Then you can use c0 in setFieldsDict:

Code:
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    location    "system";
    object      setFieldsDict;
}

defaultFieldValues
(
    volScalarFieldValue gl 0.0
);

regions
(
    cellToCell
    {
        set c0;

        fieldValues
        (
            volScalarFieldValue gl 1.0
        );
    }

);

// vim: set ft=foam et sw=4 ts=4 sts=4:
As a result, you get hemisphere with gl = 1 as on the attached picture.
Attached Images
File Type: png Capture-d’écran-2016-05-26-à-22.37.14.png (29.5 KB, 36 views)
alexeym is offline   Reply With Quote

Old   May 27, 2016, 12:49
Default
  #13
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Thanks for the reply. I have little problem understanding the above procedure. Please let me know, if I understand correctly.

1. Copy Cod1 in a file "toposetDict" and store it in system directory
2. Copy code 2 in setFieldsDict and store in system directory
3. Then run setFields

Am I right?
Is there any good tutorial regarding this? This might be helpful in understanding the concept.
cute is offline   Reply With Quote

Old   May 27, 2016, 13:10
Default
  #14
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Almost, before running setFields you need to run topoSet to create cell set c0. Also you need to adjust geometry in dictionaries for your case.

Unfortunately I do not know much about OpenFOAM tutorials.
alexeym is offline   Reply With Quote

Old   May 27, 2016, 13:37
Default
  #15
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Thanks, I will try today sometime.
cute is offline   Reply With Quote

Old   May 27, 2016, 15:46
Default
  #16
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
I tried as you suggested, but I don't see sphere. Is there any specific filtersI need to apply. I visualized for t=0, loaded into paraview, applied clip filter but don't see anything.

My box dimension is 1 x 1 x 0.5 m^3 with
blocks ( hex (0 1 2 3 4 5 6 7) (20 20 20) simpleGrading (1 1 1) );

I used in topoSetDict

actions
(
{
name c0;
type cellSet;
action new;
source sphereToCell;
sourceInfo
{
centre (0.5 0.5 0);
radius 0.2;
}
}

{
name c0;
type cellSet;
action delete;
source boxToCell;
sourceInfo
{
box (0 0 0) (1 1 0.5);
}
}

);

when I ran topoSet command it produces

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create polyMesh for time = 0

Reading topoSetDict

Time = 0
mesh not changed.
Created cellSet c0
Applying source sphereToCell
Adding cells with centre within sphere, with centre = (0.5 0.5 0) and radius = 0.2
cellSet c0 now size 0
Read set cellSet c0 with size 0
Applying source boxToCell
Removing cells with center within boxes 1((0 0 0) (1 1 0.5))
cellSet c0 now size 0

End


I don't know, what is wrong?

BTW: how do you submit code inside rectangle on this site? As you posted above.
cute is offline   Reply With Quote

Old   May 27, 2016, 16:41
Default
  #17
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well, this one is quite obvious, as you just delete created sphere. You create sphere with centre (0.5 0.5 0) and radius 0.2, so it lies within (0.3 0.3 -0.2)-(0.7 0.7 0.2) and then you delete box (0 0 0)-(1 1 0.5), box overlaps sphere, so you deleted everything you have created during first step.

There is [CODE] tag. Marked as # in toolbar.
alexeym is offline   Reply With Quote

Old   May 27, 2016, 17:01
Default
  #18
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Yes, I realized and figured out. Thanks for quick reply.

In my previous post, I was asking about toposet Guide. If it is available some where. Not about tutorial cases.

Sorry, my toolbar does not show any hash tag like #.
cute is offline   Reply With Quote

Old   May 27, 2016, 17:56
Default
  #19
Member
 
anonymous
Join Date: Mar 2016
Location: Canada
Posts: 93
Rep Power: 10
cute is on a distinguished road
Thanks for your help. I was able to run my application with 4 semi-spheres in the domain. As you can see in picture, they will grow and then merge at some time,i.e. outer surface merge. Now I need some post-processing:

(1) Is there any better option to visualize more clearly. I used only clip filter.
(2) I also would like to extract and visualize only the outer-surfaces of all semi-spheres as they grow. How can I do this?


I wanted to upload animation, but It could not.

In my previous post, I was asking about toposet Guide. If it is available some where. Not about tutorial cases.
Attached Images
File Type: jpg spheres.jpg (192.1 KB, 40 views)
sante likes this.
cute is offline   Reply With Quote

Old   May 29, 2016, 15:28
Default
  #20
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Since it is your simulation and process you know, it is YOU who decide what to do. For example...

- There is threshold filter. If your hemispheres have certain property than distinguishes them from other space, use it. The filter can be used to select cell with liquid in VOF. Sometimes I use the filter to select liquid pool cells.

- There is iso-surface filter. It can be used to visualize surfaces defined by certain value of field variable. It is used to draw liquid surface in VOF simulations (alpha = 0.5). I use it for visualization of solidification front (gl = 0.5).

Concerning your second question, as I said earlier, I do not know much about tutorials. topoSetDict supplied with sources of topoSet utility has plenty of examples.
alexeym is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM Training, London, Chicago, Munich, Sep-Oct 2015 cfd.direct OpenFOAM Announcements from Other Sources 2 August 31, 2015 13:36
OpenFoam - Vof verification with standard cases P Sharma OpenFOAM Running, Solving & CFD 4 December 1, 2014 00:25
Suggestion for a new sub-forum at OpenFOAM's Forum wyldckat Site Help, Feedback & Discussions 20 October 28, 2014 09:04
OpenFOAM tests cases cfdivan OpenFOAM Installation 2 August 14, 2013 15:33
Convertation axisymmetric cases from Fluent to OpenFOAM Svensson OpenFOAM 0 April 19, 2011 06:08


All times are GMT -4. The time now is 02:29.