|
[Sponsors] |
VOF initialization with a STL file (closed volume) |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 23, 2017, 02:16 |
VOF initialization with a STL file (closed volume)
|
#1 |
New Member
Dongguk Lee
Join Date: Jun 2017
Location: Seoul, Korea
Posts: 2
Rep Power: 0 |
Hi guys,
I was looking for the way to set the VOF initial position by using a certain shape (closed volume of STL file). Finally I was able to do that. Since I was not able to find this way from web searching, I write this thread here. Just prepare your stl file and set your setFieldsDict file with "surfaceToCell" optioin. /*--------------------------------*- C++ -*---------------------------------*\ | ========= | | | \ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \ / O peration | Version: 4 | | \ / A nd | Web: http://www.OpenFOAM.org | | \/ M anipulation | | \*--------------------------------------------------------------------------*/ FoamFile { version 4.1; format ascii; class dictionary; object setFieldsDict; location "system"; } defaultFieldValues ( volScalarFieldValue alpha.secPhase 0 ); regions ( // Select based on surface surfaceToCell { file "sphere.stl"; outsidePoints ((-1 -0.8 -0.5)); // definition of outside includeCut false; // cells cut by surface includeInside yes; // cells not on outside of surf includeOutside no; // cells on outside of surf nearDistance -1; // cells with centre near surf curvature 0.9; // cells within nearDistance fieldValues ( volScalarFieldValue alpha.secPhase 1 ); } ); |
|
January 6, 2018, 09:47 |
|
#2 |
Member
|
Hi Dongguk Lee
I appreciate you providing this post I have been looking for this type of approach for a period of time. I have taken your approach and tried to apply it to my particular case, however I am recieving the following error message: Code:
Create time Create mesh for time = 0 Reading setFieldsDict Setting field default values Setting internal values of volScalarField alpha.water Setting field region values --> FOAM FATAL ERROR: Cannnot read "test_1.stl" From function bool Foam::triSurface::read(const Foam::fileName&, const Foam::word&, bool) in file triSurface/triSurface.C at line 360. FOAM exiting Code:
defaultFieldValues ( volScalarFieldValue alpha.water 0 ); regions // Select based on surface ( surfaceToCell // https://www.cfd-online.com/Forums/openfoam-solving/189582-vof-initialization-stl-file-closed-volume.html { file "test_1.stl"; outsidePoints ((3.02858 1.94427 83.2)); // definition of volume outside includeCut false; // cells cut by surface includeInside yes; // include cells inside surface includeOutside no; // exclude cells outside surface useSurfaceOrientation true; // use surface normals nearDistance -0.01; // cells with centre near surface curvature 0.9; // cells within nearDistance fieldValues ( volScalarFieldValue alpha.water 1 ); } ); // ************************************************************************* // I have checked the db/dictionary (surfaceToCells) and the layout of the function and what you have provided appears to be fine so i guess the issue relates to the STL itself. Any assistance guidance will be appreciated. Regards JFM |
|
January 7, 2018, 22:49 |
|
#3 |
New Member
Dongguk Lee
Join Date: Jun 2017
Location: Seoul, Korea
Posts: 2
Rep Power: 0 |
Hi JFM,
I tried with your "test_1.stl" file and it works fine. Could you please try again, but please locate the "test_1.stl" file in your project directory. not inside of 0 or constant or system. |
|
January 10, 2020, 05:15 |
Same problem
|
#4 |
New Member
Ann
Join Date: Nov 2019
Posts: 6
Rep Power: 7 |
I know, this is an old thread, but maybe you read it anyway. This is exactly the same problem I struggle with:
Here is the error message Code:
--> FOAM FATAL ERROR: Cannot read "1.stl" From function bool Foam::triSurface::read(const Foam::fileName&, const Foam::word&, bool) in file triSurface/triSurface.C at line 304. FOAM exiting Code:
FoamFile { version 2.0; format ascii; class dictionary; object setFieldsDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // defaultFieldValues ( volScalarFieldValue alpha.water 0 volVectorFieldValue U (0 0 0) ); regions ( surfaceToCell { file "1.stl"; outsidePoints ((1 1 0.01)); // definition of outside includeCut false; // cells cut by surface includeInside yes; // cells not on outside of surf includeOutside no; // cells on outside of surf nearDistance -1; // cells with centre near surf curvature 0.9; // cells within nearDistance fieldValues ( volScalarFieldValue alpha.water 1 volVectorFieldValue U (0 0 0) ); } ); I attached the stl file. Hope you can help me! |
|
January 13, 2020, 02:55 |
|
#5 |
Senior Member
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16 |
Hello,
Outside point is point outside the stl and inside the geometry. Also I recommend you rename you file to start with string instead of 1. You need to keep the file in project directory or provide full path. Regards, -Yogesh |
|
January 13, 2020, 05:15 |
|
#6 |
New Member
Ann
Join Date: Nov 2019
Posts: 6
Rep Power: 7 |
Thanks for your reply! Finally I got it. But there's another problem.. This is for my bachelor thesis, so it would be great, to get it work.
Okay, I'll rename it. Does it matter, where this outside point is? And how can I define the position of the stl in my Mesh? At the moment, I don't see the phase in ParaView. When I look at p_rgh or U I can see something (don't know what it is exactly, but something happens). But the shape itself is not visible (see attached files) I also did the volume rendering, but there is nothing.. Does "surfaceToCell" give me the phase at all? Or is it just for U, p etc? |
|
January 14, 2020, 06:16 |
|
#7 |
Senior Member
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16 |
Hello,
Outside points is just any point outside the closed STL in which you want to patch the phase. surfaceToCell can be used to patch any scalar, vector etc. field. Regards, -Yogesh |
|
January 14, 2020, 06:17 |
|
#8 |
Senior Member
Yogesh Bapat
Join Date: Oct 2010
Posts: 102
Rep Power: 16 |
Outside points is just any point outside the closed STL in which you want to patch the phase and inside the mesh
|
|
Tags |
initialization, interfoam, setfields, vof |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] groovyBC in openFOAM-2.0 for parabolic velocity bc | ofslcm | OpenFOAM Community Contributions | 25 | March 6, 2017 11:03 |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
friction forces icoFoam | ofslcm | OpenFOAM | 3 | April 7, 2012 11:57 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |