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

external variable in codedFixedValue boundary condition

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2022, 13:24
Default external variable in codedFixedValue boundary condition
  #1
New Member
 
claudio caccia
Join Date: Nov 2014
Location: Italy
Posts: 1
Rep Power: 0
claudio_it is on a distinguished road
Send a message via Skype™ to claudio_it
Hi,
I'd like to read an external variable (i.e. defined in another dictionary) within a boundary condition of the kind codedFixedValue.
The snippet is more or less like this:

Code:
#include "$FOAM_CASE/include/initialConditions"

dimensions      [0 1 -1 0 0 0 0];

internalField   uniform ($Uref 0 0);

boundaryField
{
    inlet
    {
    
        //
    
        type            codedFixedValue;
        value           uniform (1 0 0);
        
        name            parabolicVelocity;
        

           
        code
        #{
        
            const vectorField& Cf = patch().Cf();
            vectorField& field = *this;
            
            const scalar Umax = 1.5*$Uref;
            
            forAll(Cf, faceI)
            {
                const scalar y =Cf[faceI][1];
                
                field[faceI] = vector(4*Umax/(pow(H,2))*(H-y)*y, 0, 0);
            }
        #};
The variable Uref is defined in the file initialConditions. It is correctly read to initialize the internal field. But up to now, I'm not able to read it within the code. What is the correct way to access that variable?

Thank you
Claudio
claudio_it is offline   Reply With Quote

Reply

Tags
boundary condition, codedfixedvalue, variable

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
My radial inflow turbine Abo Anas CFX 27 May 11, 2018 02:44
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 07:20
Radiation interface hinca CFX 15 January 26, 2014 18:11
Using codedFixedvalue to apply totalPressure Boundary Condition cdm OpenFOAM Running, Solving & CFD 2 June 22, 2013 15:10
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


All times are GMT -4. The time now is 06:41.