# directionMixed boundary condition

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

August 31, 2017, 16:56
directionMixed boundary condition
#1
Member

Vedamt Chittlangia
Join Date: Feb 2016
Posts: 64
Rep Power: 9
Hello,

I am using directionMixed BC for my case of flow over 2D flat plate. At the top boundary I want to set du/dy = 0 and v = 0. Where velocity vector is (u,v,w).

I have defined BC as:
Code:
```top    //name of the boundary
{
type     directionMixed;
refValue         uniform (0 0 0);
valueFraction  uniform (0 0 0 1 0 0);
}```
But after plotting my v component at the top I don't get 0 value as in the picture. I can't figure where I went wrong in using this boundary condition ?
Attached Images
 geometry.png (2.6 KB, 67 views) v_top.png (31.8 KB, 61 views)

December 7, 2017, 09:23
#2
Senior Member

Ali Shayegh
Join Date: Oct 2015
Posts: 131
Rep Power: 10
Quote:
 Originally Posted by vcvedant Hello, I am using directionMixed BC for my case of flow over 2D flat plate. At the top boundary I want to set du/dy = 0 and v = 0. Where velocity vector is (u,v,w). I have defined BC as: Code: ```top //name of the boundary { type directionMixed; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform (0 0 0 1 0 0); }``` But after plotting my v component at the top I don't get 0 value as in the picture. I can't figure where I went wrong in using this boundary condition ?
To the best of my knowledge, elements of (0 0 0) aren't respectively (u v w)!
they are (1st_tangent 2nd_tangent normal_component) of velocity:
in this manner, valueFraction will be (0 0 0 0 0 1). see what ziemowitzima says:
DirectionMixed mixed bc

 March 22, 2019, 10:00 #3 Member   Join Date: Jan 2017 Posts: 71 Rep Power: 9 Boundary condition groovcBCDirection Based on the directionMixed boundary condition this allows to set a boundary condition as a Dirichlet-condition only in certain directions while in the other directions it is a gradient-condition. can anyone know how to implement above condition?

March 22, 2019, 13:52
#4
Senior Member

Ali Shayegh
Join Date: Oct 2015
Posts: 131
Rep Power: 10
Quote:
 Originally Posted by sadsid Boundary condition groovcBCDirection Based on the directionMixed boundary condition this allows to set a boundary condition as a Dirichlet-condition only in certain directions while in the other directions it is a gradient-condition. can anyone know how to implement above condition?
I haven't used groovybc, but I think directionMixed figures out your problem. Go to the link I inserted in my last post in this thread.

 March 22, 2019, 14:33 #5 Member   Join Date: Jan 2017 Posts: 71 Rep Power: 9 Thank you for your reply!! Actually I am looking for setting up the boundary condition like: Code: ``` type directionMixed; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform (0.1 0 0 0.2 0 0.2); value uniform (0 0 0);``` But in place of (0.1 0 0 0.2 0 0.2) I want to give a csv file. Can you help me in this regard? Thanks SS Last edited by wyldckat; March 24, 2019 at 14:51. Reason: Added [CODE][/CODE] markers

March 22, 2019, 15:53
#6
Senior Member

Ali Shayegh
Join Date: Oct 2015
Posts: 131
Rep Power: 10
Quote:
 Originally Posted by sadsid Thank you for your reply!! Actually I am looking for setting up the boundary condition like: type directionMixed; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform (0.1 0 0 0.2 0 0.2); value uniform (0 0 0); But in place of (0.1 0 0 0.2 0 0.2) I want to give a csv file. Can you help me in this regard? Thanks SS
I don't know if this sub-dictionary supports csv file or not. You can refer to well-informed users like wyldckat.

 March 22, 2019, 16:17 #7 Member   Join Date: Jan 2017 Posts: 71 Rep Power: 9 Ok. Thanks!

 March 24, 2019, 15:06 #8 Retired Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 10,975 Blog Entries: 45 Rep Power: 128 Quick answers: For future reference, regarding "groovyBCDirection" ("groovy", not "groovc") the only example I could quickly find was on file "Examples/tests/directionMixedBendPipe/0/U": Code: ``` inner { // type fixedValue; type groovyBCDirection; value uniform (0 0 0); valueExpression "vector(0,0,0)"; // switch from slip to fixedValue fractionExpression "pos().y>pos().x ? symm(normal()*normal()) : symmTensor(1,0,0,1,0,1)"; // fractionExpression "pos().y>pos().x ? symmTensor(0,0,0,0,0,0) : symmTensor(1,0,0,1,0,1)"; }``` Also available online: This: Code: `valueFraction uniform (0.1 0 0 0.2 0 0.2);` is by definition wrong. And it depends on whether you are applying on a vector field or a scalar field. For example, this: Code: `valueFraction nonuniform List 6(0.1 0 0 0.2 0 0.2);` which means it would only be applicable for a patch with 6 faces. Defining from CSV file... really depends on what exactly you are trying to do. Because I'm guessing that your CSV file will actually have the positions of the centres of the faces and then the respective values to be used for that field. And if that is what you are trying to do, then it requires creating a new derived boundary condition that does that. Please let us know how you are creating that CSV file, because it might be easier to simply convert the CSV file to the format that OpenFOAM is expecting here... __________________ OpenFOAM: FAQ | Getting started Forum: How to get help, to post code/output and forum guide Read this before sending me PM

 March 27, 2019, 10:12 #9 Member   Join Date: Jan 2017 Posts: 71 Rep Power: 9 Dear wyldckat, Thank you for your reply in detail. Code: ```dimensions [0 1 -1 0 0 0 0]; internalField uniform (0 0 0);//should I change this internal field? boundaryField { w1 { // type noSlip; type directionMixed; refValue uniform (0 0 0);//what about this uniform value if I have a table at value fraction refGradient uniform (0 0 0);//same question about this valueFraction table ( (0 (0.042735 0 0 0.01899696 0 0.042735)) (0.05 (0.042735 0 0 0.01899696 0 0.042735)) (1 (0.042735 0 0 0.01899696 0 0.042735)) ); //first value in (()) is time and rest values written in the bracket are values w.r.t. time value uniform;//what about this value should it be uniform?if we have a table at value fraction } w2 { type noSlip; } left1 { type cyclic; } right1 { type cyclic; } front1 { type cyclic; } back1 { type cyclic; } }``` Question1: Can I change valueFraction in a way I did?If not then how to make it unsteady as I have a tabular values to insert. Q2: If yes then what about the keyword uniform? Last edited by wyldckat; April 3, 2019 at 07:55. Reason: Added [CODE][/CODE] markers

April 3, 2019, 04:41
#10
Member

Join Date: Jan 2017
Posts: 71
Rep Power: 9
Quote:
 Originally Posted by wyldckat Quick answers: For future reference, regarding "groovyBCDirection" ("groovy", not "groovc") the only example I could quickly find was on file "Examples/tests/directionMixedBendPipe/0/U": Code: ``` inner { // type fixedValue; type groovyBCDirection; value uniform (0 0 0); valueExpression "vector(0,0,0)"; // switch from slip to fixedValue fractionExpression "pos().y>pos().x ? symm(normal()*normal()) : symmTensor(1,0,0,1,0,1)"; // fractionExpression "pos().y>pos().x ? symmTensor(0,0,0,0,0,0) : symmTensor(1,0,0,1,0,1)"; }``` Also available online: This: Code: `valueFraction uniform (0.1 0 0 0.2 0 0.2);` is by definition wrong. And it depends on whether you are applying on a vector field or a scalar field. For example, this: Code: `valueFraction nonuniform List 6(0.1 0 0 0.2 0 0.2);` which means it would only be applicable for a patch with 6 faces. Defining from CSV file... really depends on what exactly you are trying to do. Because I'm guessing that your CSV file will actually have the positions of the centres of the faces and then the respective values to be used for that field. And if that is what you are trying to do, then it requires creating a new derived boundary condition that does that. Please let us know how you are creating that CSV file, because it might be easier to simply convert the CSV file to the format that OpenFOAM is expecting here...

Dear Bruno my csv/text file containing a table of valueFraction with respect to the time, for example: the first entity of the table looks like (0,(1 0 0 1 0 1))).

April 3, 2019, 10:01
#11
Retired Super Moderator

Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128

Quote:
 Originally Posted by sadsid Code: ``` w1 { // type noSlip; type directionMixed; refValue uniform (0 0 0);//what about this uniform value if I have a table at value fraction refGradient uniform (0 0 0);//same question about this valueFraction table ( (0 (0.042735 0 0 0.01899696 0 0.042735)) (0.05 (0.042735 0 0 0.01899696 0 0.042735)) (1 (0.042735 0 0 0.01899696 0 0.042735)) ); //first value in (()) is time and rest values written in the bracket are values w.r.t. time value uniform;//what about this value should it be uniform?if we have a table at value fraction }``` Question1: Can I change valueFraction in a way I did?If not then how to make it unsteady as I have a tabular values to insert. Q2: If yes then what about the keyword uniform?
1. No, you cannot simply make that change like that...
2. "uniform" refers to the fact that 'valueFraction' was designed to be defined as a 1:1 definition of a value per face on the patch.

Quote:
 Originally Posted by sadsid Dear Bruno my csv/text file containing a table of valueFraction with respect to the time, for example: the first entity of the table looks like (0,(1 0 0 1 0 1))).
Which OpenFOAM version are you using? I ask this because this requires the creation of a new boundary condition specifically for your requirement.

 April 3, 2019, 10:41 #12 Member   Join Date: Jan 2017 Posts: 71 Rep Power: 9 I am using OpenFOAM v5. Yes I think it needs to customize boundary condition directionMixed (am I right?). I will wait for your response. It would be helpful if you guide me to code it. Thanks for your quick response.

 April 7, 2019, 16:40 #13 Retired Super Moderator   Bruno Santos Join Date: Mar 2009 Location: Lisbon, Portugal Posts: 10,975 Blog Entries: 45 Rep Power: 128 Quick answer: I wasn't able to look into this myself, namely to create the modified boundary condition. However, here are the steps I advise you to take: Study this: https://wiki.openfoam.com/Programmin...by_Gavin_Tabor Create a custom condition based on "directionMixed". Since you're using OpenFOAM 5, it's in the folder src/finiteVolume/fields/fvPatchFields/basic/directionMixed Next you need to look into the boundary condition "uniformFixedValue" (folder src/finiteVolume/fields/fvPatchFields/derived/uniformFixedValue) and see how the variable "uniformValue_" is defined. Now you need to implement the "uniformValue_" variable into your custom boundary condition. Example on how to use CSV is given here: https://cpp.openfoam.org/v5/classFoa...V.html#details Last edited by wyldckat; April 7, 2019 at 16:42. Reason: forgot a couple of links

 April 8, 2019, 03:58 #14 Member   Join Date: Jan 2017 Posts: 71 Rep Power: 9 Dear Bruno Thank you for the guidelines. Let me dig out in these. I will come back to you shortly.

 Tags boundary, directionmixed, openfoam 2.3.x