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

Initial alpha.water of complex shapes

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Tobermory

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 12, 2025, 17:25
Default Initial alpha.water of complex shapes
  #1
New Member
 
Sea
Join Date: Jun 2023
Posts: 5
Rep Power: 3
SalmonPlant is on a distinguished road
Hi all,

I am wondering the best workflow in setting initial alpha.water for complex geometries. I have an .stl that represents the water volume (refer attached), and have exported it from blender. This is saved within constant/triSurface directory. I have completed Surface checks with no errors; but cannot get my fields to work. Any ideas as to where I am going wrong or alternate approaches to this issue?

My setFieldsDict
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object setFieldsDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

defaultFieldValues
(
volScalarFieldValue alpha.water 0 // Default value for air
);

regions
(
searchableSurfaceCell
{
type searchableSurfaceToCell
surface "constant/triSurface/waterEx.stl";
inside true;
fieldValues
(
volScalarFieldValue alpha.water 1
);
}
);

// ************************************************** ******************************** //

I have tried many sub-variations of this dict file with no success. The error messages have been reasonably consistent with the following:

Error Message
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0 Reading setFieldsDict Setting volume field default values - set internal values of volScalarField: alpha.water = 0 Setting field region values --> FOAM FATAL IO ERROR: (openfoam-2406) Unknown topoSetSource type searchableSurfaceCell
Attached Images
File Type: jpg Capture.JPG (43.9 KB, 9 views)
SalmonPlant is offline   Reply With Quote

Old   January 13, 2025, 12:24
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 840
Rep Power: 16
Tobermory will become famous soon enough
I've not used this type of topoSet before, but I think your syntax is wrong. You have named the topoSet block with your own name "searchableSurfaceCell", which is not a recognised type of topoSetSource (that's what the error message is telling you).

You should have named it with the type of topoSetSource that the block contains ... i.e. searchableSurfaceToCell. Check your parameters inside the block as well (ie type should be cellSet, I imagine) - if there's anythging wrong, it will tell you which parameter is missing or is badly formed. Hope that helps - good luck.
SalmonPlant likes this.
Tobermory is offline   Reply With Quote

Old   January 28, 2025, 03:31
Default setFieldDict
  #3
New Member
 
Sea
Join Date: Jun 2023
Posts: 5
Rep Power: 3
SalmonPlant is on a distinguished road
I have been working through this... after quite a while away from my computer.


My setFieldsDict is currently:


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

defaultFieldValues
(
volScalarFieldValue alpha.water 0
);

regions
(
searchableSurfaceToCell
{
type triSurfaceMesh; // Correct keyword for surface type
surface "waterLevelRegion.stl"; // Correct keyword for surface path
includeInside true; // Correct keyword for including cells inside the surface

fieldValues
(
volScalarFieldValue alpha.water 1 // Set alpha.water = 1 inside the surface
);
}
);

// ************************************************** *********************** //

When I run setFields, I get the following error:


Reading setFieldsDict

Setting volume field default values
- set internal values of volScalarField: alpha.water = 0

Setting field region values



--> FOAM FATAL IO ERROR: (openfoam-2406)
Unknown searchableSurface type waterLevelRegion.stl

Valid searchableSurface types :

24
(
box
closedTriSurfaceMesh
collection
cone
cylinder
disk
extrudedCircle
plane
plate
rotatedBox
searchableBox
searchableCone
searchableCylinder
searchableDisk
searchableExtrudedCircle
searchablePlane
searchablePlate
searchableRotatedBox
searchableSphere
searchableSurfaceCollection
searchableSurfaceWithGaps
sphere
subTriSurfaceMesh
triSurfaceMesh
)



file: searchableSurfaceToCell at line 26 to 32.

From static Foam::autoPtr<Foam::searchableSurface> Foam::searchableSurface::New(const Foam::word&, const Foam::IOobject&, const Foam::dictionary&)
in file searchableSurfaces/searchableSurface/searchableSurface.C at line 53.

FOAM exiting

Any ideas on where I am going wrong?
SalmonPlant is offline   Reply With Quote

Old   January 28, 2025, 05:28
Default Thanks - I needed to also run topoSet ahead of setFields!
  #4
New Member
 
Sea
Join Date: Jun 2023
Posts: 5
Rep Power: 3
SalmonPlant is on a distinguished road
As the title says - I needed to run topoSet ahead of setFields. I was getting quite confused between the two when reading other forums across the net.

These are the dictionaries that worked for me:

topoSetDict:

/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2406 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class dictionary;
location "system";
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
{
name myCellSet;
type cellSet;
action new;
source searchableSurfaceToCell;
sourceInfo
{
surfaceType triSurfaceMesh; // Use triSurfaceMesh for STL files
surfaceName water.stl; // Name of the STL file (without .stl extension)
mode inside; // Select cells inside the STL geometry
}
}
);

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

setFields dict:

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

defaultFieldValues
(
volScalarFieldValue alpha.water 0
);

regions
(
searchableSurfaceToCell
{
surfaceType triSurfaceMesh; // Correct keyword for surface type
surfaceName water.stl; //name of surface
mode inside; // Correct keyword for including cells inside the surface

fieldValues
(
volScalarFieldValue alpha.water 1 // Set alpha.water = 1 inside the surface
);
}
);

// ************************************************** *********************** //

I hope this helps someone else at a later stage!
SalmonPlant is offline   Reply With Quote

Reply

Tags
blender, setfieldsdict, stl

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Suppress twoPhaseEulerFoam energy AlmostSurelyRob OpenFOAM Running, Solving & CFD 33 September 25, 2018 17:45
Free surface issues with interDyMFoam for hydroturbine oumnion OpenFOAM Running, Solving & CFD 0 October 6, 2017 14:05
pressure in incompressible solvers e.g. simpleFoam chrizzl OpenFOAM Running, Solving & CFD 13 March 28, 2017 05:49
Micro Scale Pore, icoFoam gooya_kabir OpenFOAM Running, Solving & CFD 2 November 2, 2013 13:58
SLTS+rhoPisoFoam: what is rDeltaT??? nileshjrane OpenFOAM Running, Solving & CFD 4 February 25, 2013 04:13


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