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

uniformFixedValue Boundary condition

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 9, 2023, 11:37
Default uniformFixedValue Boundary condition
  #1
New Member
 
Join Date: Jan 2022
Posts: 5
Rep Power: 4
akashshankhdhar7 is on a distinguished road
Hi all
I am using OpenFOAMv10, and currently working on a case such that I need to have the velocity field for a patch called droplet (Boundary condition in 0th folder) used within another dimensionless field called alpha as a condition for the same patch droplet.

For that I am using uniformFixedValue type coded.
(I am trying to use it as a groovyBC)

As I am not that good with coding it results in error that U is an unknown identity.

I am attaching the code for that patch droplet of alpha field as below:

droplet
{
type uniformFixedValue;
uniformValue coded;
name drop;
codeInclude
#{
#include "mathematicalConstants.H"
#};

code
#{
const volScalarField& U = this->db().lookupObject<volScalarField>("U");
return scalar(mag(U) > 1e-9) ? 1.0 : 0.0); // U as velocity from the boundary condition file 'U'
#};

}


Thanking in advance.
akashshankhdhar7 is offline   Reply With Quote

Old   May 9, 2023, 14:49
Default
  #2
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,715
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
If you have the option to use OpenFOAM-1912 or later, you have expressions (many ideas similar to swak4foam) - you can simply specify the uniformValue type as "expression" and go from there without any additional compilation.


If you do decide to stick with coded, remember that you are trying to write a boundary condition. This means that you need to access the corresponding boundary values of your velocity field (not the entire volume field). The velocity field is of course also a volVectorField not a volScalarFIeld either.


After you get at the boundary field part of "U", remember that you need to return a field of values, not just a single scalar.
olesen is offline   Reply With Quote

Old   May 10, 2023, 17:38
Default
  #3
New Member
 
Join Date: Jan 2022
Posts: 5
Rep Power: 4
akashshankhdhar7 is on a distinguished road
Hi olesen

Thanks for your quick reply and correcting out my mistake with the vector part. Though even if I do that I am still unable to access the velocity from Velocity boundary file for the droplet patch. It states an error that 'U' was not declared in the scope.
How do I get access/read to the velocity field for the patch droplet in the alpha boundary file?

Thanks in advance.

(Unfortunately I am bound to use only OpenFOAMv10 for this!)
akashshankhdhar7 is offline   Reply With Quote

Reply

Tags
groovybc, openfoam 10, uniformfixedvalue


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
sliding mesh problem in CFX Saima CFX 46 September 11, 2021 08:38
uniformFixedValue boundary condition meth Main CFD Forum 0 November 5, 2015 00:16
Accessing multiple boundary patches from a custom boundary condition file ripudaman OpenFOAM Programming & Development 0 October 22, 2014 19:34
Radiation interface hinca CFX 15 January 26, 2014 18:11
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44


All times are GMT -4. The time now is 09:44.