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

Entry 'selectionMode' not found in dictionary; CodedSource fvOptions

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 17, 2021, 08:48
Default Entry 'selectionMode' not found in dictionary; CodedSource fvOptions
  #1
New Member
 
Join Date: Mar 2020
Posts: 16
Rep Power: 6
Geb1313 is on a distinguished road
Hello Foamers,
I want to solve a dam bream problem using interFoam. I divided the dam into certain compartments (say two). The requirement is two of them will not start flowing at the same time, say the 1st will start at t = 0 s and the 2nd will follow the 1st after 2 seconds.
Well, my first question is, is there any "easy way" to do it ?

My second question is I supposed to manipulate the solver using fvOptions by initiating the problem with setFields for the whole dam and constraining the cells inside the 2nd compartment until time = 2 s. Hence, I produced the following fvOptions dictionary:
Code:
velocitySource
{
    type          vectorCodedSource;
    active        yes;
    name          velocitySource;
    vectorCodedSourceCoeffs
    {
       selectionMode cellSet;
       cellSet box1;
       fields (U);
      
         codeInclude
            #{
            #};
        codeCorrect
        # {
        #};

        codeAddSup
        # {
        #};

        codeConstrain
        # {
            const  Time& time = mesh().time();            //get time 
            const  scalar startTime = 2.0;                // set value upto this time 
            cellSet  selectedCells(mesh_, cellSetName_);
            labelList  cells = selectedCells.toc ();
           if (time.value() <= startTime)
            {
            vector values(0, 0, 0); 
            eqn.setValues​(cells, values);
            }
        #};
  
        code
        # {
            $ codeInclude
            $ codeCorrect
            $ codeAddSup
            $ codeConstrain
        #};
    }
velocitySourceCoeffs
    {
    }
}
However, I got the following error:
HTML Code:
 --> FOAM FATAL IO ERROR: (openfoam-2012)
[0] Entry 'selectionMode' not found in dictionary "/mnt/d/gebray/OpenFOAM/test/dambreak/constant/fvOptions.velocitySource.velocitySourceCoeffs"
[0]
[0]
[0] file: /mnt/d/gebray/OpenFOAM/test/dambreak/constant/fvOptions.velocitySource.velocitySourceCoeffs
[0]
[0]     From bool Foam::dictionary::readEntry(const Foam::word&, T&, Foam::keyType::option, bool) const [with T = Foam::word]
[0]     in file /home/pawan/OpenFOAM/OpenFOAM/OpenFOAM-v2012/src/OpenFOAM/lnInclude/dictionaryTemplates.C at line 334.
It is asking for keyword "SelectionMode" while it is there.
What did I miss?

Also, who is pawan in the file path
Geb1313 is offline   Reply With Quote

Old   December 17, 2021, 09:17
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Geb1313 View Post
Hello Foamers,
My second question is I supposed to manipulate the solver using fvOptions by initiating the problem with setFields for the whole dam and constraining the cells inside the 2nd compartment until time = 2 s. Hence, I produced the following fvOptions dictionary:
Code:
velocitySource
{
    type          vectorCodedSource;
    active        yes;
    name          velocitySource;
    vectorCodedSourceCoeffs
    {
       selectionMode cellSet;
       cellSet box1;
       fields (U);
      
         codeInclude
            #{
            #};
        codeCorrect
        # {
        #};

        codeAddSup
        # {
        #};

        codeConstrain
        # {
            const  Time& time = mesh().time();            //get time 
            const  scalar startTime = 2.0;                // set value upto this time 
            cellSet  selectedCells(mesh_, cellSetName_);
            labelList  cells = selectedCells.toc ();
           if (time.value() <= startTime)
            {
            vector values(0, 0, 0); 
            eqn.setValues​(cells, values);
            }
        #};
  
        code
        # {
            $ codeInclude
            $ codeCorrect
            $ codeAddSup
            $ codeConstrain
        #};
    }
velocitySourceCoeffs
    {
    }
}
You have fvOptions entries one level too deep.

Code:
 velocitySource
{
    type          vectorCodedSource;
    active        yes;
    name        velocitySource;


    selectionMode cellSet;
    cellSet box1;
    fields (U);



...  other entries    

}
olesen is offline   Reply With Quote

Old   December 17, 2021, 09:43
Default
  #3
New Member
 
Join Date: Mar 2020
Posts: 16
Rep Power: 6
Geb1313 is on a distinguished road
Thank you olesen.

It is working now. I was mixing both openfom.com and openfoam.org manuals.
For openfoam.com (e.g OpenFOAM-v2012) your recommendation avoids the error.
Geb1313 is offline   Reply With Quote

Old   December 17, 2021, 11:06
Default Multiple cellsets
  #4
New Member
 
Join Date: Mar 2020
Posts: 16
Rep Power: 6
Geb1313 is on a distinguished road
Quote:
Originally Posted by olesen View Post
You have fvOptions entries one level too deep.

Code:
 velocitySource
{
    type          vectorCodedSource;
    active        yes;
    name        velocitySource;


    selectionMode cellSet;
    cellSet box1;
    fields (U);



...  other entries    

}
A quick question while I am at it. Is that possible to have multiple cellsets like:

Code:
cellSet         box1,box2;
So that I can access cells in both of the boxes at different time. I want to have two different times, t1 and t2 where t1 is when cells at box1 start to move and t2 is when cells inside box2 stat to move.


Gebray
Geb1313 is offline   Reply With Quote

Old   December 18, 2021, 11:56
Default
  #5
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Geb1313 View Post
A quick question while I am at it. Is that possible to have multiple cellsets like:

Code:
cellSet         box1,box2;
So that I can access cells in both of the boxes at different time. I want to have two different times, t1 and t2 where t1 is when cells at box1 start to move and t2 is when cells inside box2 stat to move.

Gebray
That is a cool idea, but unfortunately not possible. At the moment you would have to use something like topoSet to create a cellSet box_1_2 (combining both).

No promises, but I think you should add this as an issue to develop.openfoam.com to keep your idea from being lost. Would give a chance to explore/discuss if your idea makes sense or how it could be added (or not).
olesen is offline   Reply With Quote

Old   December 25, 2021, 16:37
Default selectionMode
  #6
New Member
 
Join Date: Mar 2020
Posts: 16
Rep Power: 6
Geb1313 is on a distinguished road
Quote:
Originally Posted by olesen View Post
That is a cool idea, but unfortunately not possible. At the moment you would have to use something like topoSet to create a cellSet box_1_2 (combining both).

No promises, but I think you should add this as an issue to develop.openfoam.com to keep your idea from being lost. Would give a chance to explore/discuss if your idea makes sense or how it could be added (or not).
I somehow managed to do it. Instead of doing them in one, created box1,2, 3 using topSet and have separate dictionaries in fvoptions, like velocity source1, velocity source2, velocity source3, etc.

Gebray
Geb1313 is offline   Reply With Quote

Reply

Tags
codedsource, fvoptions


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
Problem of compilation OF 14Allwmake command not found erik_d OpenFOAM Bugs 13 September 13, 2008 21:45
Regarding FoamX running Kindly help out hariya03 OpenFOAM Pre-Processing 0 April 18, 2008 04:26
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51
[Commercial meshers] Trimmed cell and embedded refinement mesh conversion issues michele OpenFOAM Meshing & Mesh Conversion 2 July 15, 2005 04:15
FoamX error aachenBomb case Ervin Adorean (Adorean) OpenFOAM Pre-Processing 13 March 7, 2005 03:50


All times are GMT -4. The time now is 20:13.