CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: blockMesh

Generating nonuniform meshes with sizefunction

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

Reply
 
LinkBack Thread Tools Display Modes
Old   April 12, 2006, 15:13
Default Is it possible to generate non
  #1
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
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,758
Rep Power: 21
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,758
Rep Power: 21
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,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
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,758
Rep Power: 21
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,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
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: 338
Rep Power: 9
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,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   December 23, 2007, 12: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: 8
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, 20:14
Default Hello Ehsan, the trick is exa
  #10
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   December 26, 2007, 08:09
Default Hello Alberto Thank you very
  #11
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 8
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, 14:02
Default hello Alberto Thank you very
  #12
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 8
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, 14:09
Default You're welcome :-) Happy ne
  #13
Senior Member
 
Alberto Passalacqua
Join Date: Mar 2009
Location: Ames, Iowa, United States
Posts: 1,894
Rep Power: 26
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 live DVD/USB, hard drive image and virtual image.
OpenQBMM - An open-source implementation of quadrature-based moment methods
alberto is offline   Reply With Quote

Old   January 4, 2008, 11:56
Default Happw new year Alberto I am
  #14
New Member
 
ehsan yasari
Join Date: Mar 2009
Location: Gothenburg, Sweden
Posts: 14
Rep Power: 8
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 9, 2008, 00:55
Default Hello Alberto, Thanks for y
  #15
Member
 
a a saha
Join Date: Mar 2009
Posts: 67
Rep Power: 8
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: 8
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: 8
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: Braunschweig, Niedersachsen, Germany
Posts: 275
Rep Power: 9
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: 8
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.
johndeas is offline   Reply With Quote

Old   July 15, 2009, 15:37
Default
  #20
Senior Member
 
Henrik Rusche
Join Date: Mar 2009
Location: Braunschweig, Niedersachsen, Germany
Posts: 275
Rep Power: 9
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

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Specifying nonuniform boundary condition maka OpenFOAM Running, Solving & CFD 59 October 22, 2014 14:52
Import or generating Meshes from Koordinates Gau%c3%9fKr%c3%bcger toby OpenFOAM Mesh Utilities 7 February 27, 2009 16:25
Specifying nonuniform initial condition msyaml OpenFOAM Running, Solving & CFD 61 January 20, 2009 15:05
FixedValue nonuniform BC dmoroian OpenFOAM Running, Solving & CFD 1 November 3, 2006 05:26
Generating big meshes with GAMBIT on NT Andrew Ooi FLUENT 12 February 2, 2000 23:26


All times are GMT -4. The time now is 12:16.