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

defining sphere inside a cube model

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

Like Tree2Likes
  • 1 Post By stosse
  • 1 Post By stosse

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 25, 2014, 05:54
Default defining sphere inside a cube model
  #1
Member
 
Join Date: Oct 2014
Posts: 42
Rep Power: 11
Wien3 is on a distinguished road
Good Morning everyone!
I'm and trying to make a model which consists on a cube with a sphere inside, and a fluid which will flow along the cube. I achieved to do it with a cube inside a cube (as I commented in another post) but of course it is much more difficult with the sphere.

As I didn't know how to make a sphere, I read many post about it and I did it with snappyHexMesh at the end. Then, I assigned boundary conditions and run with 'buoyantBoussinesqSimpleFoam'. Everything worked fine until I entered in OpenFoam. I don't have any problems to see initial conditions, but when I press play this error message appears:
PHP Code:
--> FOAM FATAL IO ERROR
size 42875 is not equal to the given value of 42848

file
: /home/jstoeckl/Desktop/modelsphere/2000/U from line 18 to line 42930.

    From 
function Field<Type>::Field(const wordkeyword, const dictionary&, const label)
    
in file /home/opencfd/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/Field.C at line 292.

FOAM exiting 
I am pretty sure it has something to do with snappyMeshDict file, because it is the only new file for me, but maybe I'm wrong.

PHP Code:
// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       true;


geometry
{

    
sphere
    
{
        
type searchableSphere;
        
centre  (0 0 0);
        
radius  0.1;
    }
};

castellatedMeshControls
{
    
maxLocalCells 1000;
    
maxGlobalCells 2000;
    
minRefinementCells 10;
    
maxLoadUnbalance 0.50;
    
nCellsBetweenLevels 3;
    
features
    
(
    );
    
refinementSurfaces
    
{  
        
sphere
        
{
            
level (1 1 );
        
/*    regions
            {
                secondSolid
                {
                    level (5 5);
                }
            }
        */
            
patchInfo
            
{
                
type wall;
            }
        }
        
    }

    
resolveFeatureAngle 30;
    
refinementRegions
    
{
    
/*    sphere
        {
            mode outside;
            levels ((1.0 2));
        }
    */
    
}
    
    
locationInMesh (0.11 0 0);
    
allowFreeStandingZoneFaces true;
}


snapControls
{
    
nSmoothPatch 5;
    
tolerance 4.0;
    
nSolveIter 10;
    
nRelaxIter 10;
}

addLayersControls
{
    
relativeSizes false;
    
layers
    
{
        
sphere_region0
        
{
            
nSurfaceLayers 1;

        }

    }

    
expansionRatio 1.0;
//    finalLayerThickness 1e-9;
finalLayerThickness 0.015e-7;
  
//  finalLayerRatio 0.01;
    
minThickness 0.001e-7;
    
nGrow 0;
    
featureAngle 30;
    
nRelaxIter 10;
    
nSmoothSurfaceNormals 1;
    
nSmoothNormals 3;
    
nSmoothThickness 10;
    
maxFaceThicknessRatio 0.8;
    
maxThicknessToMedialRatio 0.8;
    
minMedianAxisAngle 40;
    
nBufferCellsNoExtrude 0;
    
nLayerIter 100;
    
nRelaxedIter 20;
}

meshQualityControls
{
    
maxNonOrtho 65;
    
maxBoundarySkewness 20;
    
maxInternalSkewness 4;
    
maxConcave 80;
    
minVol 1e-250;
    
minTetQuality 1e-25;
    
minArea -1;
    
minTwist 0.05;
    
minDeterminant 0.001;
    
minFaceWeight 0.05;
    
minVolRatio 1e-1;
    
minTriangleTwist -1;

    
nSmoothScale 4;
    
errorReduction 0.75;

    
relaxed
    
{
        
maxNonOrtho 75;
    }
}

debug 0;
mergeTolerance 1e-6
I attach a link where you can find my case folder.

http://freakshare.com/files/4oe8sdmy...phere.zip.html

If you could tell me the solution to my problem or at least guide my in some direction to solve would be great

Thank you in advance
Wien3 is offline   Reply With Quote

Old   November 25, 2014, 08:30
Default
  #2
New Member
 
Sindre Tosse
Join Date: Sep 2014
Posts: 6
Rep Power: 11
stosse is on a distinguished road
Usually, you can get a good idea of where something went wrong by looking at the error.
Quote:
size 42875 is not equal to the given value of 42848
means that the solver expects a specific number of values (the number of computational cells) but gets more/less. Try restarting from startTime (usually 0) either by deleting later time directories in your case dir, or modifying your controlDict (you are currently starting from 2000). The easiest way to set initial conditions is to have a uniform field (then you don't have to worry about number of cells anyway). Alternatively, you can use a field from a similar case with mapFields.
Wien3 likes this.
stosse is offline   Reply With Quote

Old   November 25, 2014, 08:33
Default
  #3
Member
 
davide basso
Join Date: Jan 2012
Posts: 48
Rep Power: 14
rolloblues is on a distinguished road
Hi Wien,

If you open your mesh in paraFoam you can see that the problem is that you don't have any sphere at all inside your cube.
That's because, I suspect, the castellated mesh is too coarse to snap to the sphere try something like this:

Code:
refinementSurfaces
    {  
        sphere
        {
            level (2 2);
        /*    regions
            {
                secondSolid
                {
                    level (5 5);
                }
            }
        */
            patchInfo
            {
                type wall;
            }
        }
        
    }
rolloblues is offline   Reply With Quote

Old   November 25, 2014, 09:12
Default
  #4
Member
 
Join Date: Oct 2014
Posts: 42
Rep Power: 11
Wien3 is on a distinguished road
Good afternoon!

First of all thank you both for your answers.

@ stosse: I deleted previous other time folders, and in fact my starting time is 0 in controlDict. When you say uniform fields, do you refer to every single variable?

@ rolloblues: I applied that change, but it didn't work.

In fact I do have the sphere in the model. If I write in my terminal blockMesh and then snappyHexMesh", time folders 1, 2 and 3 are created. If I run OpenFoam I can see perfectly the sphere after pressing play.

The problem comes when I run after that buoyantBoussinesqSimpleFoam. In the terminal doesn't appear any error during the calculation time. I restart OpenFoam, I select the Volume Fields I want to analyse and I press play again.

It is in that specific moment when the error I commented before appears, and I don know why.

I hope I have explained better my problem.

Thank you in advance!
Wien3 is offline   Reply With Quote

Old   November 25, 2014, 09:14
Default
  #5
Member
 
davide basso
Join Date: Jan 2012
Posts: 48
Rep Power: 14
rolloblues is on a distinguished road
My bad, sorry, I didn't noticed the other folders
rolloblues is offline   Reply With Quote

Old   November 26, 2014, 02:03
Default
  #6
New Member
 
Sindre Tosse
Join Date: Sep 2014
Posts: 6
Rep Power: 11
stosse is on a distinguished road
Uniform field means that the variable (U, p, etc.) has the same value in all cells. You set this in the starting time folder (3 in your case, since 1 and 2 are mesh generation steps) by setting something like (for U):
Quote:
internalField uniform (0 0 0);
and similar for other variables. This is something you should do for every variable.

For the start time, you have to change startFrom to startTime in controlDict if you want to use the specified start time. The default is to use the latest available time. I would recommend keeping the default setting, and deleting unwanted results before you rerun simulations. That way, you don't end up with results from multiple runs in the same case directory (if the write times are not exactly equal), or accidentaly run from a mesh generation step

By the way, if you use the -overwrite flag on snappyHexMesh,
Quote:
snappyHexMesh -overwrite
, it will overwrite your 0 folder so you don't end up with multiple mesh generation folders. Be sure to make a backup of your original 0 folder though
Wien3 likes this.
stosse is offline   Reply With Quote

Old   November 26, 2014, 03:37
Default
  #7
Member
 
Join Date: Oct 2014
Posts: 42
Rep Power: 11
Wien3 is on a distinguished road
Good Morning,

I read what you told me and I consider it makes sense! It is logic that the first 3 steps are taken to create the sphere and the buoyantBoussinesqSimpleFoam simulation should start from that point, and not from 0. So that is why I changed startFrom from startTime to latestTime (keeping startTime 0) and I didn't delete the 1,2,3 time folders.
I copied the 0 files in "3" and of course I was required to add commands about "sphere" in each of them. Again it doesn't imply any problem and the simulation runs perfectly.

However, I have another error exactly at the same point than before, after pressing play in the simulation. This time the error is:

PHP Code:
--> FOAM Warning 
    
From function polyMesh::readUpdateState polyMesh::readUpdate()
    
in file meshes/polyMesh/polyMeshIO.C at line 207
    Number of patches has changed
.  This may have unexpected consequences.  Proceed with care.
WarningIn /home/opencfd/OpenFOAM/ParaView-4.1.0/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxxline 279
vtkSMPVRepresentationProxy 
(0x90e77b0): Could not determine array range
I think this "number of patches has changed" could have something to do with snappyHexMesh file.
I can again see the sphere but not the T, U, p... field evolution. I attach al link with the modified .zip in case someone could help me.

http://freakshare.com/files/q6mpmadd...phere.zip.html

Thank you in advance
Wien3 is offline   Reply With Quote

Reply

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
Use of k-epsilon and k-omega Models Jade M Main CFD Forum 40 January 27, 2023 07:18
UDF for defining granular viscosity in mixture model priyanka.asp Fluent UDF and Scheme Programming 7 May 19, 2019 18:16
[Other] How to mesh inside a sphere? ssss OpenFOAM Meshing & Mesh Conversion 5 October 27, 2014 09:36
[ANSYS Meshing] Question about mesh generation for a pipe inside a cube lnk ANSYS Meshing & Geometry 0 July 10, 2012 12:28
Setting up: Cube, 2 holes, high pressure inside shangzung OpenFOAM 0 October 30, 2009 11:27


All times are GMT -4. The time now is 04:34.