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

Creating a 2D AMR copying from dynamicRefineFvMesh

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By chrisb2244
  • 1 Post By chrisb2244

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2014, 01:05
Default Creating a 2D AMR copying from dynamicRefineFvMesh
  #1
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
So, like several other people in this forum, I'm looking at how to try and implement at 2D adaptive mesh refinement.

I'm using the document at http://publications.lib.chalmers.se/...173/174173.pdf for direction, and am currently in the first instance attempting to copy and replace the names of my dynamicRefineFvMesh.{C,H} files. I have so far made no changes to what the files actually do - I'm only seeking to use wmake and get myInterDyMFoam to use the dynamicRefineFvMeshHexRef4.{C,H} (which still depend on HexRef8) to compile and run.

When I try and run the solver on the tutorial damBreakWithObstacle case from the interDyMFoam directory, I get

Code:
--> FOAM FATAL ERROR: 
Unknown dynamicFvMesh type dynamicRefineFvMeshHexRef4

Valid dynamicFvMesh types are :

8
(
dynamicInkJetFvMesh
dynamicMotionSolverFvMesh
dynamicRefineFvMesh
movingConeTopoFvMesh
multiSolidBodyMotionFvMesh
rawTopoChangerFvMesh
solidBodyMotionFvMesh
staticFvMesh
)


    From function dynamicFvMesh::New(const IOobject&)
    in file dynamicFvMesh/dynamicFvMeshNew.C at line 81.

FOAM exiting
Looking through dynamicFvMeshNew.C indicates that it opens a library file to get this list of available mesh types. I can avoid this error, and trigger a different one, if I insert a line like

Code:
dynamicFvMeshLibs dynamicRefineFvMeshHexRef4;
into my dynamicMeshDict, however then I have to define dynamicRefineFvMeshHexRef4 as an IOobject, it seems. This line (or rather, its equivalent) is not present in any of the pre-existing dynamicMeshDicts for other mesh types, but I am unable to find where they are defined/read from so as to model my own entry after them.

My first question is, are these meshes defined in libdynamicFvMesh.so, or some similar libXYZ.so, and if so, can I do anything about this? If they are defined somewhere else, could someone please point me in their direction?

It is my current assumption that they are held in a lib.so file, and that I will need to define the mesh type in some way inside my dynamicMeshDict file (or perhaps create copies of many more files to my solver, and make (hopefully minor?) modifications) so as to allow it to read a new mesh type.

Please let me know what I should be trying to do.
chrisb2244 is offline   Reply With Quote

Old   February 5, 2014, 01:17
Default
  #2
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
The parts of the files which I expect to be relevant (although clearly I'm wrong) now read:

dynamicRefineFvMeshHexRef4.C
Code:
namespace Foam
{
    defineTypeNameAndDebug(dynamicRefineFvMeshHexRef4, 0);
    addToRunTimeSelectionTable(dynamicFvMesh, dynamicRefineFvMeshHexRef4, IOobject);
}
dynamicRefineFvMeshHexRef4.H
Code:
class dynamicRefineFvMeshHexRef4
:
    public dynamicFvMesh
{
protected:

        //- Mesh cutting engine
        hexRef8 meshCutter_;
...

public:

 //- Runtime type information
    TypeName("dynamicRefineFvMeshHexRef4");
    // Constructors

        //- Construct from IOobject
        explicit dynamicRefineFvMeshHexRef4(const IOobject& io);


    //- Destructor
    virtual ~dynamicRefineFvMeshHexRef4();


    // Member Functions

        //- Direct access to the refinement engine
        const hexRef8& meshCutter() const
        {
            return meshCutter_;
        }
...
foamF likes this.
chrisb2244 is offline   Reply With Quote

Old   February 5, 2014, 02:00
Default
  #3
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
On a side note, and possibly (probably?) related to this - my solver, and the interDyMFoam default solver, have no dependence on the file dynamicFvMeshNew.C, even though it looks quite a lot like the function contained within is called - createDynamicFvMesh.H (which is #included in interDyMFoam.C) calls

Code:
autoPtr<dynamicFvMesh> meshPtr
    (
        dynamicFvMesh::New
        (
            IOobject
            (
                dynamicFvMesh::defaultRegion,
                runTime.timeName(),
                runTime,
                IOobject::MUST_READ
            )
        )
    );
and dynamicFvMesh.{H,C} have no mention of a New.

dynamicFvMeshNew.C opens with some includes, including to a "dlLibraryTable.H", which has an #ifdef NoRepository #include ...TemplateTable, which would seem to be required for the number of arguments being passed later in dynamicFvMeshNew.C
Code:
 const_cast<Time&>(io.time()).libs().open
    (
        dict,
        "dynamicFvMeshLibs",
        IOobjectConstructorTablePtr_
    );
Side side note : Where is 'NoRepository' defined? A grep search gave me nothing, but lots of files have an #ifdef NoRepository #include ... block...

Back to the point, dynamicFvMeshNew.C then goes on to iterate through a list of libraries (or something?) returned by the libs().open call in the code above, and when it reaches the end without finding dynamicRefineFvMeshHexRef4, it outputs the error in the initial post (Valid dynamicFvMesh types are : ... "

Any thoughts much appreciated
chrisb2244 is offline   Reply With Quote

Old   February 5, 2014, 03:08
Default
  #4
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
Seems I can create an additional library using wmake libso and then link to that in my dynamicMeshDict file. Working on that now.
chrisb2244 is offline   Reply With Quote

Old   February 5, 2014, 03:46
Default
  #5
Member
 
Christian Butcher
Join Date: Jul 2013
Location: Japan
Posts: 85
Rep Power: 12
chrisb2244 is on a distinguished road
Had to move a few things around and change some variables in Make/{files,options} but got wmake libso to work. Linking the library to the solver allowed me to remove the line from controlDict, and allows the case to 'work', so now I can work on changing the library and/or solver.

Apologies for 5 posts of my talking to myself, but seems I can't delete the thread, and maybe others are as stupid as I am and will find this useful.
louisgag likes this.
chrisb2244 is offline   Reply With Quote

Old   December 30, 2014, 12:03
Default
  #6
Super Moderator
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 1,089
Rep Power: 34
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi Christian,

Were you successful in creating a 2-D version of dynamicRefineFvMesh?

Philip
bigphil is offline   Reply With Quote

Reply

Tags
amr, dynamicmesh


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
[Commercial meshers] Fluent3DMeshToFoam simvun OpenFOAM Meshing & Mesh Conversion 50 January 19, 2020 15:33
[blockMesh] Problems in creating a wedge type mesh Joscha OpenFOAM Meshing & Mesh Conversion 28 August 3, 2019 07:59
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28
Problem in running ICEM grid in Openfoam Tarak OpenFOAM 6 September 9, 2011 17:51
Problems with Meshing: Collapsed Cells Emmanuel Resch Siemens 1 July 30, 2007 03:02


All times are GMT -4. The time now is 07:24.