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

[mesh manipulation] Generating nonuniform meshes with sizefunction

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 12, 2006, 15:13
Default Generating nonuniform meshes with sizefunction
  #1
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Is it possible to generate non-uniform grids with nodes positioned following a distribution expressed by an analitical function?

Regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   April 12, 2006, 15:17
Default Yes. Generate a uniform mesh
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Yes. Generate a uniform mesh and then move the points :-)

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   April 12, 2006, 15:19
Default Yes. Generate a uniform mesh
  #3
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
Yes. Generate a uniform mesh and then move the points :-)

Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   April 12, 2006, 15:54
Default Do you mean with the moveMesh
  #4
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Do you mean with the moveMesh solver?
I gave a look, but it doesn't seem I can use a user defined function but only linear, quadratic and exponential (I need an hyperbolic tangent).

Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   April 12, 2006, 16:07
Default How about just doing a little
  #5
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
How about just doing a little custom code like this:

pointField newPoints = mesh.points();

forAll (newPoints, i)
{
// Your code here, calculate the point position
}

mesh.movePoints(newPoints);

mesh.write();


Hrv
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   April 13, 2006, 05:40
Default Thanks Hrv. It works! :-)
  #6
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Thanks Hrv. It works! :-)
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   March 28, 2007, 05:43
Default Hi Alberto, Could you possi
  #7
Senior Member
 
Frank Bos
Join Date: Mar 2009
Location: The Netherlands
Posts: 340
Rep Power: 18
lr103476 is on a distinguished road
Hi Alberto,

Could you possibly give an example of how to move the internal points of a uniform mesh? (Just the few lines within the forAll(newPoints,i){} )

Thanks, Frank
__________________
Frank Bos
lr103476 is offline   Reply With Quote

Old   March 29, 2007, 14:49
Default Check your mail :-) A.
  #8
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Check your mail :-)

A.
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 23, 2007, 11:41
Default Hi I want to solve channel f
  #9
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 17
ehsanyasari is on a distinguished road
Hi
I want to solve channel flow with hyperbolic mesh in one direction. i am new in O-F, how can i generate hyperbolic mesh in O-F?
Regards
Thanks for your help
ehsanyasari is offline   Reply With Quote

Old   December 25, 2007, 19:14
Default Hello Ehsan, the trick is exa
  #10
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
Hello Ehsan,
the trick is exactly the one explained by Hrvoje in this thread.

Create a uniform mesh, with the number of nodes you need in the three directions. Then write a small utility which:

- Reads the mesh (see how this is done in all solvers or mesh manipulation utilities).

- Does

pointField newPoints = mesh.points();

forAll (newPoints, i)
{
// Your code here, calculate the point position
}

mesh.movePoints(newPoints);

mesh.write();

using an analytical expression to relate the position of a node in a uniform grid to the new position (this is commonly done to generate grids for channel flow simulations).

Regards,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   December 26, 2007, 07:09
Default Hello Alberto Thank you very
  #11
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 17
ehsanyasari is on a distinguished road
Hello Alberto
Thank you very much for your guide.
Could you possibly give your code? And tell me where should I add this code?
Excuse me for my basic question because I am new in O_F.
Best regards
ehsanyasari is offline   Reply With Quote

Old   December 30, 2007, 13:02
Default hello Alberto Thank you very
  #12
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 17
ehsanyasari is on a distinguished road
hello Alberto
Thank you very much for your help,it works well.
Best Regards.
ehsanyasari is offline   Reply With Quote

Old   December 31, 2007, 13:09
Default You're welcome :-) Happy ne
  #13
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,912
Rep Power: 36
alberto will become famous soon enoughalberto will become famous soon enough
You're welcome :-)

Happy new year,
Alberto
__________________
Alberto Passalacqua

GeekoCFD - A free distribution based on openSUSE 64 bit with CFD tools, including OpenFOAM. Available as in both physical and virtual formats (current status: http://albertopassalacqua.com/?p=1541)
OpenQBMM - An open-source implementation of quadrature-based moment methods.

To obtain more accurate answers, please specify the version of OpenFOAM you are using.
alberto is offline   Reply With Quote

Old   January 4, 2008, 10:56
Default Happw new year Alberto I am
  #14
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 17
ehsanyasari is on a distinguished road
Happw new year Alberto

I am going to run a channel395 with channel oodles solver, when i choose mixedsmagorinskey model and laplace filter, after some iteration, courant number diverged. but when i used simple filter it works,and also when i changed the mesh into uniform mesh, it works.

Do you have any idea about this problem?
Best Regards.
ehsanyasari is offline   Reply With Quote

Old   January 8, 2008, 23:55
Default Hello Alberto, Thanks for y
  #15
Member
 
vof_user
Join Date: Mar 2009
Posts: 67
Rep Power: 17
asaha is on a distinguished road
Hello Alberto,

Thanks for your hyperbolicSpacingChannel code. It works well with the given channel395 case.

Thanks.
asaha is offline   Reply With Quote

Old   July 15, 2009, 12:14
Default
  #16
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
Hi, I would like to output the polyMesh in a new time directory. I tried to add
Code:
runTime++;
    
mesh.write();
Unfortunately, at runtime I get:

Code:
Requested field U does not exist in the database


    From function Foam::fieldAverage::initialise()
    in file fieldAverage/fieldAverage.C at line 108.

FOAM exiting
So how can I output in a new time directory, the same way renumberMesh or snappyHexMesh do ?
johndeas is offline   Reply With Quote

Old   July 15, 2009, 12:25
Default
  #17
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
To be more accurate, here is my new code

Code:
#include "argList.H"
#include "Time.H"
#include "polyMesh.H"
#include "transformField.H"

#include "fvMesh.H"

using namespace Foam;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//  Main program:

int main(int argc, char *argv[])
{
#   include "setRootCase.H"
#   include "createTime.H"
#   include "createMesh.H"

    pointField points=mesh.points();
    
    // Reading non-uniform grid parameters

    Info<< "Reading hyperbolicSpacingProperties\n" << endl;

    IOdictionary hyperbolicSpacingProperties
    (
        IOobject
        (
            "hyperbolicSpacingProperties",
            runTime.constant(),
            polyMesh::meshSubDir,
            runTime,
            IOobject::MUST_READ,
            IOobject::NO_WRITE,
            false
        )
    );

    Info<< "Reading A coefficient\n" << endl;

    dimensionedScalar A
    (
        hyperbolicSpacingProperties.lookup("A")
    );

    Info<< "A = " << A.value() << endl << endl;
    
    Info<< "Reading B coefficient\n" << endl;
    
    dimensionedScalar B
    (
        hyperbolicSpacingProperties.lookup("B")
    );
    
    Info<< "B = " << B.value() << endl << endl;
    
    // Adapting the grid
    
    points.replace(vector::Y, A.value()*points.component(vector::Y) + 
                (1.0 - A.value())*(1.0 - Foam::tanh(B.value()*(1.0 - 
                points.component(vector::Y)))/(Foam::tanh(B.value()))));

    
    // Setting the default precision of the points data to 10
    IOstream::defaultPrecision(10);
    
    mesh.movePoints(points);
    
    runTime++;
    
    mesh.write();
    
    //Writing points
    // Info << "Writing points into directory " << points.path() << nl << endl;
    // points.write();

    return(0);
}
It might be very naive, but I have still not completely grasped how data is organized in OpenFOAM.
johndeas is offline   Reply With Quote

Old   July 15, 2009, 13:35
Default
  #18
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Dear John,

this error is not at all obvious ;-)

My bet is that you have a functionObject (fieldAverage to be precise) which I asking for U, but cannot find it.

Comment it and all will be fine - I hope

Henrik
henrik is offline   Reply With Quote

Old   July 15, 2009, 15:23
Default
  #19
Senior Member
 
John Deas
Join Date: Mar 2009
Posts: 160
Rep Power: 17
johndeas is on a distinguished road
I think one day I saw a piece of code which deactivated functionObjects, but I can not find it again. Do you see what I am refering to ?

-EDIT-

Just found it, it seems to be the
Code:
functionObjectlist::off()
method. I'll try this next time I have a grip on a work station.
tobiasS likes this.
johndeas is offline   Reply With Quote

Old   July 15, 2009, 15:37
Default
  #20
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Wernigerode, Sachsen-Anhalt, Germany
Posts: 281
Rep Power: 18
henrik is on a distinguished road
Dear John,

the keyword is "active_" ...

$FOAM_SRC/postProcessing/forces/lnInclude/forces.H

Henrik
henrik 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
[Other] Generating hex meshes STutexas OpenFOAM Meshing & Mesh Conversion 1 February 24, 2016 02:55
generating OpenFOAM meshes with pointwise robo OpenFOAM Pre-Processing 1 April 29, 2014 13:47
Doxygen documentation Tanay OpenFOAM Installation 9 September 23, 2011 11:40
ParaView and Qt 4.3.5 on Mac OS X 10.6 Adrian OpenFOAM 3 August 8, 2010 03:16
Generating big meshes with GAMBIT on NT Andrew Ooi FLUENT 12 February 2, 2000 22:26


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