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

Dependent Boundary Condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 22, 2017, 12:11
Question Dependent Boundary Condition
  #1
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12
RobertHB is on a distinguished road
Dead Foamers,
i want to create an inlet boundary condition for a scalar value. The inlet rate should depent on the scalar concentration in the cells connected to my inlet patch. So that if cell value = 0, the inlet value will be 1.0 and vice versa. Any anything in between.
Therefore i would like to know if there is any way to determine the cell value during runtime?

Regards,
Robert
RobertHB is offline   Reply With Quote

Old   November 28, 2017, 11:23
Default
  #2
Senior Member
 
Robert
Join Date: May 2015
Location: Bremen, GER
Posts: 292
Rep Power: 12
RobertHB is on a distinguished road
So, after a bit of digging i came with the idea of using the codedFixedValue BC.
Code:
code
        #{
            // look up patch fields directly:
            const scalarField& cPatchField = 
                this->patch().lookupPatchField<volScalarField, scalar>("psi");
        
            // Calculate the average field
            const surfaceScalarField cAvg = 
                cPatchField.average(patch().boundaryMesh().mesh().V());
        
            operator == (1.0-cAvg);
            //this->value() = 1.0-cAvg;
        
        #};
It seems, the "lookup" of the patch value works. But OpenFOAM complains that "const scalarField has no member named ‘average’".
So, the question is: How do i calculate the average, or in the best case the weighted average, of my scalar boundary field?

Regards,
Robert
RobertHB is offline   Reply With Quote

Reply

Tags
boundary condition, dependent variable, scalar value


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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
Multiphase flow - incorrect velocity on inlet Mike_Tom CFX 6 September 29, 2016 02:27
Time dependent boundary condition for VOF function houkensjtu OpenFOAM 1 January 25, 2013 14:34
External Radiation Boundary Condition for Grid Interface CFD XUE FLUENT 0 July 9, 2010 03:53
External Radiation Boundary Condition (Two sided wall), Grid Interface CFD XUE FLUENT 0 July 8, 2010 07:49


All times are GMT -4. The time now is 14:33.