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

Error with codedFixedValue BC

Register Blogs Community New Posts Updated Threads Search

Like Tree6Likes
  • 1 Post By Hisham
  • 4 Post By bruce
  • 1 Post By amir.a.aliabadi

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 26, 2011, 12:01
Default Error with codedFixedValue BC
  #1
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Foamers,

I want to use the codedFixedValue to set boundary conditions for a volScalarField to be 0 if the Y-Co larger than 2.5 and 1 otherwise. I tried this code:

Code:
BoundaryName
    {
        type            codedFixedValue;
	value           uniform 0;
	redirectType    initialWaterSurf;
	code
	  #{
	  forAll(this, i) 
	    {operator== ((this[i]->y() > 2.5)? 0 : 1  )}
	  #};
    }
I would like to know what does "this" points to ... and how can I loop the faces and face centers?
Which includes should I have as well?

By the way the error I get is:
Code:
 Setting internal values of volScalarField alpha1


--> FOAM FATAL IO ERROR: 
Loading a shared library using case-supplied code is not enabled by default
because of security issues. If you trust the code you can enable this
facility be adding to the InfoSwitches setting in the system controlDict:

    allowSystemOperations 1

The system controlDict is either

    ~/.OpenFOAM/$WM_PROJECT_VERSION/controlDict

or

    $WM_PROJECT_DIR/etc/controlDict
The error is generated when the dict for this BC is read (it is the error source).

Best Regards,
Hisham
mizzou likes this.
Hisham is offline   Reply With Quote

Old   October 28, 2011, 05:39
Default
  #2
Member
 
Jim Knopf
Join Date: Dec 2010
Posts: 60
Rep Power: 16
JimKnopf is on a distinguished road
Quote:
Originally Posted by Hisham View Post
code
#{
forAll(this, i)
{operator== ((this[i]->y() > 2.5)? 0 : 1 )}
#};
Hi Hisham,

i'm not sure aboute code fixed Value stuff but it seems to me that there are two Operators in your equation. The first is the equal introduced after operator and then there is the operator > before the 2.5 maybe you have to check the syntax
Greetz
Jim
JimKnopf is offline   Reply With Quote

Old   October 28, 2011, 05:58
Default
  #3
Senior Member
 
Hisham's Avatar
 
Hisham Elsafti
Join Date: Apr 2011
Location: Braunschweig, Germany
Posts: 257
Blog Entries: 10
Rep Power: 17
Hisham is on a distinguished road
Hi Jim,

I appreciate your answer. I think I need more tutorials on the codedBC. The only available one, is in its header file:

Code:
 code
            #{
               operator==(min(10, 0.1*this->db().time().value()));
            #};
So if this is how to access time, how can patch faces be accessed and their coordinates be identified?

I had a workaround for my problem. Nevertheless, the coded BC is a nice tool to have by one's side.

Regards
Hisham
Hisham is offline   Reply With Quote

Old   January 11, 2012, 01:20
Default
  #4
Member
 
bruce
Join Date: May 2009
Location: Germany
Posts: 42
Rep Power: 17
bruce is on a distinguished road
hi,

codedFixedValue is like other inherited from fixedValueFvPatchField<>

I tested this below code for pitzDaily , simpeFoam solver.

U = 100 * y^2;

Code:
    inlet
    {
        type            codedFixedValue;
        value           uniform (0 0 0);
        redirectType    rampedFixedValue;
        code
        #{
            // flow direction
            vector sys = vector(1, 0, 0);

            // co-ord direction of a patch
            vector dir = vector(0, 1, 0);

            // variable to be evaluated
            scalarField var = patch().Cf() & dir;

            // evaluated value
            scalarField value = 100 * var * var;

            operator==( value * sys);
        #};
    }
hope it helps.
bruce is offline   Reply With Quote

Old   March 22, 2012, 02:57
Default
  #5
New Member
 
Join Date: Mar 2012
Posts: 12
Rep Power: 14
November is on a distinguished road
Hi Bruce,

If I want to apply the codedfixedValue under icoFoam application, do I need to do something extra, like adding some library and recompiling???

Thanks.
November is offline   Reply With Quote

Old   March 13, 2013, 22:50
Default
  #6
Member
 
Amir Abbas Aliabadi
Join Date: Mar 2013
Posts: 33
Rep Power: 13
amir.a.aliabadi is on a distinguished road
The error message can be fixed by flagging "allowSystemOperations" in controlDict under /openfoam211/etc system directory. You should simply change it to 1 from 0. If permission is denied since you have installed OpenFoam under root directory then go to the above directory and type:

$ sudo gedit controlDict

This enables you to change the setting and save the file.
mizzou likes this.
amir.a.aliabadi is offline   Reply With Quote

Reply

Tags
codedfixedvalue


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
codedFixedValue boundary condition wolfindark OpenFOAM Pre-Processing 50 August 29, 2020 05:46


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