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

How to change mesh size at runtime

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 13, 2010, 14:21
Default How to change mesh size at runtime
  #1
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
In my model I want to be able to specify the length scales of my mesh at run time so that I don't always have to change the blockMesh file and run "blockMesh -case xyz" just to change my mesh size.

So what I want to do is use blockmesh to make my mesh with unit length and then at runtime just multiply the grid spacing by my actual length. Is this possible to do?

I'm thinking that all I would have to do is find a way to multiply the mesh.deltaCoeffs() by my desired lengths. How can I do this?
benk is offline   Reply With Quote

Old   May 14, 2010, 04:27
Default
  #2
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
pointField newPoints = mesh.points();

//modify newPoints

mesh.movePoints(newPoints);
eugene is offline   Reply With Quote

Old   May 14, 2010, 12:17
Default
  #3
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Thanks eugene, this worked in changing my mesh, but when I use it I'm now getting an error at runtime that says:

Code:
V0 is not available

    From function fvMesh::V0() const
    in file fvMesh/fvMeshGeometry.C at line 338.
fvMeshGeometry.C at line 338 looks like this:

Code:
const volScalarField::DimensionedInternalField& fvMesh::V0() const
{
    if (!V0Ptr_)
    {
        FatalErrorIn("fvMesh::V0() const")
            << "V0 is not available"
            << abort(FatalError);
    }

    return *V0Ptr_;
}
Any guidance on how to fix this?


PS. To change my mesh all I did was:
Code:
   
    pointField newPoints = mesh.points();
    forAll(newPoints,i) {
        newPoints[i].component(0) = newPoints[i].component(0)*Length0;
        newPoints[i].component(1) = newPoints[i].component(1)*Length1;
        newPoints[i].component(2) = newPoints[i].component(2)*Length2;
    }

    mesh.movePoints(newPoints);
benk is offline   Reply With Quote

Old   May 16, 2010, 19:31
Default
  #4
Senior Member
 
Eugene de Villiers
Join Date: Mar 2009
Posts: 725
Rep Power: 21
eugene is on a distinguished road
It appears the fvMesh now either requires that you set up a field V0 or a field meshPhi (in which case V0 is calculated automatically).

A bit irretating really. The only reasonable way to make this work without extra coding is to specify a flux field meshPhi in your starting time directory. Just use phi as a template and set everything to 0.
eugene 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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
[ICEM] Generating Mesh for STL Car in Windtunnel Simulation tommymoose ANSYS Meshing & Geometry 48 April 15, 2013 04:24
Mesh size Mohsin FLUENT 7 May 3, 2010 04:03
Changing mesh size for independency test az_f ANSYS Meshing & Geometry 1 August 27, 2009 13:55
Faces during change of topology in the mesh virginie_e OpenFOAM Running, Solving & CFD 3 August 15, 2009 13:32


All times are GMT -4. The time now is 15:11.