CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   DirectionMixed mixed bc (https://www.cfd-online.com/Forums/openfoam-pre-processing/61989-directionmixed-mixed-bc.html)

Sherlock_1812 November 6, 2013 23:55

Hi Philip,

I have been trying to re-write valueFraction for each face of my patch as symm(n*n). I have a very basic doubt.
Is it better to write a new BC (derived from directionMixed (maybe?)) where this definition of valueFraction is changed as symm(n*n) while looping over all faces of the patch? If yes, where do I make the changes? In the 'updateCoeffs' section?

Thanks.

Sliwa September 15, 2014 11:28

Hi,

Quote:

Originally Posted by hjasak (Post 185688)
4) If this is not enough for you (there is another possibility), I have written a newDirectionMixedFvPatchField boundary condition, with 4 components. Unlike the above one, this b.c. allows both the normal and tangential condition to be mixed separately between the fixedValue and fixedGradient b.c. with two blending factors. You need this kind of thing for contact problems with friction and large deformation and similar. In my version, the stuff lives in:
OpenFOAM-1.2/applications/solvers/newStressAnalysis/materialModels/newDirectionM ixed

In my problem, I would like to specify on one of my boundaries:
- a zero gradient for the normal component of the displacement
- a zero displacement in the tangential direction
The newDirectionMixed looked like the perfect solution. However, when I ran it with my solver, I got the following error:

Code:

--> FOAM FATAL IO ERROR:

    Cannot find 'value' entry on patch symr of field U in file "/home/salwa/OpenFOAM/salwa-extend-3.0/run/tutorials/solidMechanics/elasticThermalSolidFoam/flosse_test1/0/U"
    which is required to set the values of the generic patch field.
    (Actual type newDirectionMixed)

    Please add the 'value' entry to the write function of the user-defined boundary-condition
    or link the boundary-condition into libfoamUtil.so

file: /home/salwa/OpenFOAM/salwa-extend-3.0/run/tutorials/solidMechanics/elasticThermalSolidFoam/flosse_test1/0/U::boundaryField::symr from line 64 to line 69.

    From function genericFvPatchField<Type>::genericFvPatchField(const fvPatch&, const Field<Type>&, const dictionary&)
    in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 71.

FOAM exiting

Adding a 'value' entry gave this error:
Code:

gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type newDirectionMixed)
    on patch symr of field U in file "/home/salwa/OpenFOAM/salwa-extend-3.0/run/tutorials/solidMechanics/elasticThermalSolidFoam/flosse_test1/0/U"
    You are probably trying to solve for a field with a generic boundary condition.

    From function genericFvPatchField<Type>::gradientInternalCoeffs() const
    in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 811.

FOAM exiting

This is my U file:
Code:

symr
    {

        type                                newDirectionMixed;
        refValue                          uniform    0;
        refGrad                            uniform    0;
        nHat                              (1 0 0);
        normalValueFraction            0;
        tangentialValueFraction      1;
        value                              uniform (0 0 0);
  }

Does anyone know where the problem might come from? Is there something wrong with my U file?

Thanks,

bigphil September 17, 2014 10:02

Hi Sliwa,

Quote:

In my problem, I would like to specify on one of my boundaries:
- a zero gradient for the normal component of the displacement
- a zero displacement in the tangential direction
directionMixed can do this: the capabilities of newDirectionMixed have essentially been included in the current directionMixed boundary condition, as valueFraction is a symmTensor now instead of a scalar.

To achieve what you want, use directionMixed like this:
Code:

myPatch
{
    type              directionMixed;
    refValue          uniform ( 0 0 0 );
    refGradient      uniform ( 0 0 0 );
    valueFraction    uniform ( 0 0 0 1 0 1 ); // (I - sqr(n))
    value            uniform ( 0 0 0 );

where I have assumed n = ( 1 0 0 ) above.
You can see that to fix the value in the normal direction valueFraction = sqr(n), whereas to fix the value in the tangential directions valueFraction = I - sqr(n).

Best regards,
Philip

bigphil September 17, 2014 10:03

Quote:

Originally Posted by Sherlock_1812 (Post 460937)
Hi Philip,

I have been trying to re-write valueFraction for each face of my patch as symm(n*n). I have a very basic doubt.
Is it better to write a new BC (derived from directionMixed (maybe?)) where this definition of valueFraction is changed as symm(n*n) while looping over all faces of the patch? If yes, where do I make the changes? In the 'updateCoeffs' section?

Thanks.

Hi Srivaths,

yes you should derive a new boundary condition from directionMixed and set the valueFraction in the constructor or, if the mesh is moving/changing, in updateCoeffs.

See for example, fixedDisplacementZeroShear in $FOAM_SRC/solidModels.fvPatchVectorFields in foam extend.

Best regards,
Philip

Sliwa September 18, 2014 10:55

Thank you, Philip! That worked.

infinity August 9, 2015 21:10

1 Attachment(s)
Hi Dear Foamers

I'm trying to use no-stress wall boundary condition

and I used:

Code:

        type            directionMixed;
        refValue        uniform (0 0 0);
        refGradient    uniform (0 0 0);
        valueFraction  uniform (0 0 0 1 0 0);

and now I'm getting wrong answers :(

I would appreciate if anyone could help me

infinity August 12, 2015 11:09

any answer guys ? :(

bigphil August 12, 2015 11:13

I think the slip boundary condition already does what you want.

See here.

Philip

infinity August 12, 2015 11:48

Thanks a lot Philip
It was very Helpful

STutexas December 3, 2015 18:02

Quote:

Originally Posted by bigphil (Post 328702)
Hi Nicolas,

Yes it is possible, using directionMixed, to give every face on a boundary patch a different gradient in the tangential direction. I would do something like this in a header file at the start of a time-step (although it might be possible to use groovyBC but I am not sure):

Code:

label patchID = mesh.boundaryMesh().findPatchID("patchOfInterest");
if(patchID == -1)
 {
    Info << "patch not found" << endl;
    return 0;
 }

directionMixedFvPatchVectorField& Upatch =
        refCast<directionMixedFvPatchVectorField>
        (
        U.boundaryField()[patchID]
        );

//- patch face normals     
vectorField n = mesh.boundary()[loadingIndex].nf();
     
//- set value fraction so as to have fixed value in patch normal direction
Upatch.valueFraction() = symm(n*n);

//- set fixed value
Upatch.refValue() = vector (0, 0, 0); //- put what ever vectorField you want here

//- set fixed gradient (as a function of position and time as an example)
const vectorField& patchFaceCentres = mesh.boundaryMesh()[patchID].faceCentre();
Upatch.refGradient() = patchFaceCentres * runTime.value();

By the way, "U" is my solution variable above.

Hope this helps,
Philip

Hi Philip
Interesting explanation for the changing the refGradient in the directionMixed BC. If we include this code in the data can we give any values in directionMixed condition in the 0/U file? Is it possible to set a nonuniform value for the valuefraction in a similar manner using tensor fields.

Thank you.

Saurabh

STutexas December 3, 2015 18:07

Hi Philip

Just another doubt. Can we use funkySetFields with directionMixed BC. I am getting an error when I try to do that. This is the error:

--> FOAM FATAL IO ERROR:
"ill defined primitiveEntry starting at keyword 'valueFraction' on line 29 and ending at line 41"

Thank you.

nlc December 4, 2015 19:40

Yes you can code with C++ many great thing in OF
 
Yes Saurabh you can do this,

If you want to this you want to define a summetric tensor field as a variable initialize it corectly with all the constructors and add it to the maping function if you want to be able to use it in parallèle.

You can always look at boundary condition source code to give you great exemple, ther is plenty of them.

But valueFraction is alrethy a symmTensorField !?? I'm not shure what is your objectif in creating your new dirrectionMixed boundary condition.

I dont konw about funkysetfield I did not use it yet.

Out of curiosity why do you want to do this ? What are you tring to accomplish ?

Not shur what you mean by including the code in the data ?

Hope this was usfull

STutexas December 4, 2015 21:09

[QUOTE=ubald;576267]Yes Saurabh you can do this,

If you want to this you want to define a summetric tensor field as a variable initialize it corectly with all the constructors and add it to the maping function if you want to be able to use it in parallèle.

You can always look at boundary condition source code to give you great exemple, ther is plenty of them.

But valueFraction is alrethy a symmTensorField !?? I'm not shure what is your objectif in creating your new dirrectionMixed boundary condition.

I dont konw about funkysetfield I did not use it yet.

Out of curiosity why do you want to do this ? What are you tring to accomplish ?

Not shur what you mean by including the code in the data ?

Hi Nicolas

Thank you for replying so quickly. I will take a look the deifnition of the codes and see if I can compile my own BC. I am trying to use openFoam for magnetic decay simulations and my BC doesnot have a symm tensor in value fraction. Please peruse my post:

http://www.cfd-online.com/Forums/ope...groovy-bc.html

This might give you more context to what I am trying to do. Thanks again for the help.

praveensrikanth91 October 20, 2016 00:36

directionMixed for fluid-fluid interface
 
Hello,

I am trying to use the conjugate heat transfer solver to compute phase change at a liquid-vapor interface. I have implemented the phase change models into the solver with just a normal velocity at the interface for the phase change. However, I have vapor flow over the interface which would create a viscous shear on the surface of the liquid. The boundary condition for the problem is essentially equal tangential velocities on either side of the interface and equal tangential shear stresses. Added to this is the fixed value in the normal direction. I was thinking that this would be possible to be implemented using the directionMixed boundary condition. However I am not sure how the value fraction would look for such a scenario.

Is it possible to use directionMixed for such a BC? I am hoping someone with some experience would be able to direct me in the right direction. As far as I know there does not seem to be any similar boundary conditions in OF.

Thanks so much for your time

Praveen

behzad-cfd November 17, 2017 13:24

Hi,

I don't know i'm in right thread or not by the way I want to solve https://www.cfd-online.com/Forums/vb...66b8683d-1.gif equation and obtain B that is defined like https://www.cfd-online.com/Forums/vb...5f9738e5-1.gif.
I've implemented the equation in my base solver. Now i want to test functionality of the new solver but i have some boundary condition problem before testing.
For example if i want to get https://www.cfd-online.com/Forums/vb...7e82e530-1.gif in boundaries i need to set https://www.cfd-online.com/Forums/vb...0bda500a-1.gif and https://www.cfd-online.com/Forums/vb...1fd15156-1.gif.

Can i use directionMixed BC for this?
How can i implement this BCs?

Thanks in advance,
Behzad

nlc November 18, 2017 19:16

I think it is better to start a new tread
 
Hi Behzad,

OpenFOAM is 3D by défaut 1D and 2D case are achieve by setting special BC. The equations you share seem to be 2D. You need first to specify your equations in 3D then figure ought what type of BC you need. Fixed, gradient, mixed !! Then you'll know what to look for.

It seems to me that you should start a new thread. Wright the hole set of equations for your problem with detail on the boundary condition you want to use. Or a link in an article relevant to your case.

It is better to use vector notation then component details as OF use vector and tensor notation. Add me on your new tread please as it seems interesting.

NLC

behzad-cfd November 18, 2017 19:36

Quote:

Originally Posted by nlc (Post 672025)
Hi Behzad,

OpenFOAM je 3D n'y défaut 1D and 2D case are achieve by setting special BC. The equation you share seem to be 2D. You need first to specify your equation on 3D then figure ought what type of BC you need. Fixed, gradient, mixed !! Then you'll know what to look for.

It seems to me that you should start a new thread. Wright the hole set of equations for your problem with detail on the boundary condition you want to use. Or a link in an article relevant to your case.

It is better to use vector notation then component details as OF use vector and tensor notation. Add me on your new tread please as it seems interesting.

NLC

Hi Nicolas,

Thanks for kind reply. as you mentioned OF operates in 3D my case is 2D and I'll set front and back plane as empty and that's not the problem. I showed component details for clarifying the variable relations and boundary conditions. any way I'll open new thread and add you there.

Kind regards,
Behzad

behzad-cfd November 19, 2017 06:25

Quote:

Originally Posted by behzad-cfd (Post 672026)
Hi Nicolas,

Thanks for kind reply. as you mentioned OF operates in 3D my case is 2D and I'll set front and back plane as empty and that's not the problem. I showed component details for clarifying the variable relations and boundary conditions. any way I'll open new thread and add you there.

Kind regards,
Behzad

Hi Nicolas,

This is the link of new thread.
https://www.cfd-online.com/Forums/op...tml#post671506

neilk January 11, 2019 11:32

spatially varying mixed boundary condition
 
1 Attachment(s)
Hello,

I have a doubt regarding mixed boundary condition. The available mixedFvPatchField I have to specify fixed Value and a normal gradient. I want to apply a mixed BC to a wall to simulate mass diffusion across it. Thus boundary condition to vary along the wall for varying mass fraction gradients and mass fraction values in cells neighboring the wall. Is there a boundary condition that provides this facility? I have attached the boundary condition equation below where Cmucus is the mass concentration which undergoes convection-diffusion and the coefficients of Cmucus are constants.

Attachment 67717

Thank you

Pavithra June 11, 2019 04:35

Hello Everyone

I am unable to understand the mixed boundary condition clearly.

I have a vertical wall and I want to set the x-component of velocity to be u = 0 and y-component of velocity to be set as dv/dx = 0.

In order to achieve this, I have implemented the following

sideWall
{
type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (0 0 0 0 0 1);
}

but, when I plot I see non-zero values for the x-component.

Kindly, please help me.

With Thanks & Regards,
Pavithra.

bigphil June 12, 2019 05:37

Quote:

Originally Posted by Pavithra (Post 735945)
Hello Everyone

I am unable to understand the mixed boundary condition clearly.

I have a vertical wall and I want to set the x-component of velocity to be u = 0 and y-component of velocity to be set as dv/dx = 0.

In order to achieve this, I have implemented the following

sideWall
{
type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (0 0 0 0 0 1);
}

but, when I plot I see non-zero values for the x-component.

Kindly, please help me.

With Thanks & Regards,
Pavithra.

Hi Pavithra,

To set the normal component to fixedValue and the two tangential components to fixedGradient, the valueFraction should be:
Code:

valueFraction = n*n
where 'n' are the unit normals.

Alternatively (your case), to set the normal component to fixedGradient and the two tangential components to fixedValue, the valueFraction should be:
Code:

valueFraction = I - n*n
In your case, n = (0 1 0), so the valueFraction should be:
Code:

    valueFraction                uniform (1 0 0 0 0 1);
Philip

Pavithra June 12, 2019 08:19

Quote:

Originally Posted by bigphil (Post 736070)
Hi Pavithra,

To set the normal component to fixedValue and the two tangential components to fixedGradient, the valueFraction should be:
Code:

valueFraction = n*n
where 'n' are the unit normals.

Alternatively (your case), to set the normal component to fixedGradient and the two tangential components to fixedValue, the valueFraction should be:
Code:

valueFraction = I - n*n
In your case, n = (0 1 0), so the valueFraction should be:
Code:

    valueFraction                uniform (1 0 0 0 0 1);
Philip


Respected Sir,

Thank you so much for your kind reply and the detailed explanation.

In my case, I have a vertical wall. So, v and w are my tangential components and u is my normal component.

I wan to set dv/dx =0, dw/dx = 0 and u = 0.

i.e. I want to set fixed gradient for my tangential components and fixed value for my normal component.

Hence, I feel to set



Code:


valueFraction      uniform ( 0 0 1 0 0 0)

Sir, Please correct me if I am wrong.

With Thanks & Regards,
Pavithra.

bigphil June 12, 2019 08:33

Hi Pavithra,

It would be helpful if you could give the unit normal of this "vertical wall", as it is unclear what exactly you are referring to.

Philip

Pavithra June 12, 2019 08:38

Quote:

Originally Posted by bigphil (Post 736088)
Hi Pavithra,

It would be helpful if you could give the unit normal of this "vertical wall", as it is unclear what exactly you are referring to.

Philip


Sir,



My wall is in yz-plane and the unit normal vector is (1 0 0)


Thank You.

bigphil June 12, 2019 12:46

Quote:

Originally Posted by Pavithra (Post 736090)
Sir,



My wall is in yz-plane and the unit normal vector is (1 0 0)


Thank You.

In that case, n*n = (1 0 0 0 0 0), where the componets are (XX XY XZ YY YZ ZZ).

This will set Ux to zero and set dUy/dx and dUz/dx to zero.

Philip

Pavithra June 12, 2019 19:46

Quote:

Originally Posted by bigphil (Post 736119)
In that case, n*n = (1 0 0 0 0 0), where the componets are (XX XY XZ YY YZ ZZ).

This will set Ux to zero and set dUy/dx and dUz/dx to zero.

Philip

Sir, Thank you so much for your kind help.

- Pavithra

Pavithra October 2, 2019 00:12

Hello Everyone,

Back again here :D:D:D:D
I want to implement the following boundary condition on the horizontal walls of a 2-D square cavity.



\beta \frac{du_x}{dy} = (1-\beta)u_x


u_y = 0

The value of \beta varies from 0 to 1 in steps of 0.25.

I understand that when \beta = 0, the boundary condition becomes u_x = 0 and u_y = 0.

Also, when \beta = 1, the boundary condition becomes \frac{du_x}{dy} = 0 and u_y = 0.

I am able to achieve the above two cases using directionMixed boundary condition.

But I am unable to figure out how to set the boundary condition when \beta takes a value such as 0.25, 0.5 or 0.75.

For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x.

Kindly please give me some directions to implement this boundary condition.

Thank You.

With Thanks
Pavithra.

shiyu December 24, 2020 04:01

Quote:

Originally Posted by Pavithra (Post 745995)
Hello Everyone,

Back again here :D:D:D:D
I want to implement the following boundary condition on the horizontal walls of a 2-D square cavity.



\beta \frac{du_x}{dy} = (1-\beta)u_x


u_y = 0

The value of \beta varies from 0 to 1 in steps of 0.25.

I understand that when \beta = 0, the boundary condition becomes u_x = 0 and u_y = 0.

Also, when \beta = 1, the boundary condition becomes \frac{du_x}{dy} = 0 and u_y = 0.

I am able to achieve the above two cases using directionMixed boundary condition.

But I am unable to figure out how to set the boundary condition when \beta takes a value such as 0.25, 0.5 or 0.75.

For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x.

Kindly please give me some directions to implement this boundary condition.

Thank You.

With Thanks
Pavithra.

Hi Pavithra,

I faced a very similar question, like yours. Have you figured out how to implement the boundary condition below?
[/QUOTE] For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x. [/QUOTE]

Thanks.

Best,
Shiyu

Pavithra December 24, 2020 21:38

Quote:

Originally Posted by shiyu (Post 791458)
Hi Pavithra,

I faced a very similar question, like yours. Have you figured out how to implement the boundary condition below?

For instance, when \beta = 0.25, it becomes \frac{du_x}{dy}=3u_x. [/QUOTE]

Thanks.

Best,
Shiyu[/QUOTE]


Hi Shiyu,



There is a boundary condition called "groovyBCDirection".



Thank You.

tomtony April 13, 2021 03:13

Quote:

Originally Posted by bigphil (Post 316165)
Hi G. Paulo,


I occasionally use directionMixed for stress simulations where I want a fixedValue (displacement) in the patch normal direction and some fixedGradient (traction) in the patch tangential direction.

So to achieve a fixedValue in the normal direction, and a fixedGradient in the tangential direction on a patch, then the valueFraction (which is a symmTensor, where the components of a symmTensor are (xx xy xz yy yz zz) ) should be set:
valueFraction = symm(n*n)
where n is the patch normal.

If your patch faces all have the same normal then you can calculate symm(n*n) by hand and put it in your initial conditions, eg:
for a patch with n = ( 1 0 0 )
then the valueFraction = symm( (1 0 0)(1 0 0) ) = ( 1 0 0 0 0 0)
then refValue will be enforced in the patch normal direction and refGradient will be enforced in the patch tangential direction.

If your patch faces have all different normals then you will have to set the patch valueFraction in the solver (using refCast etc.) to be symm(n*n).

So to sum up, if you want a fixedValue in the patch normal direction and a fixedGradient in the patch tangential direction then it looks like this:
refValue uniform (fixed_value_you_want)
refGradient uniform (shear_gradient_you_want)
valueFraction uniform (symm(n*n))

directionMixed can also be used for other situations:
it can act just like a fixedValue BC if valueFraction = (1 0 0 1 0 1),

Or, it can act just like a fixedGradient BC if valueFraction = (0 0 0 0 0 0).

If you look at the directionMixed BC source code, you can see it calculates it.


Hope it helps,
Philip

Hi,Sir,your post give me a great help!

According to your post ,I want to set a boundary conditon.

the pacth is top wall ,I want to set dUz/dz = 5;

so n = (0,0,1),then I-n*n = (1 0 0 1 0 0),refrefGradient repressent the dU/dn,so refGradient = (0 0 5)
Code:

type                                directionMixed;
                refValue uniform (0 0 0);
                refGradient uniform (0 0 5);
                valueFraction uniform (1 0 0 1 0 0);

That 's right?

bigphil April 13, 2021 12:17

Hi tomtony,

Yes that's correct, assuming you want Ux and Uy to be zero.

By the way, solvers (or paraview) may also want "value" to be define in the boundary condition, which corresponds to the current value on the patch e.g. the initial condition; you could just set this to the same value as refValue if you are not sure.

Philip

mostanad December 11, 2021 23:36

Quote:

Originally Posted by bigphil (Post 801447)
Hi tomtony,

Yes that's correct, assuming you want Ux and Uy to be zero.

By the way, solvers (or paraview) may also want "value" to be define in the boundary condition, which corresponds to the current value on the patch e.g. the initial condition; you could just set this to the same value as refValue if you are not sure.

Philip


Hi Philip,
I know you have answered to multiple questions about directionMixed. Your help was so useful for many about this BC. For me, I tried to figure out the valueFraction tensor I need for my case, but I think asking you is the best option for me.


As you see here, I have a normal vector (1 0 0). The difference is that I need to have two fixed value components, one in normal direction and another on one of the tangential directions. Finally, the remaining tangential direction should be fixedGradient. You can see this in the following image:


https://i.ibb.co/RCQKd6p/video-image.jpg


Code:

type                directionMixed;
refValue            uniform (2 0 2);
refGradient          uniform (0 1 0);
valueFraction        uniform (1 0 0 0 0 1);

My concern is whether OF extracts the normal direction from the tensor? If yes, it might be possible for my case to be misunderstood by a n=(0 1 0).

So can you please check the values I considered for my case? How it detects the normal direction? Through valueFraction?


Cheers,
Mohammad

bigphil December 13, 2021 08:11

Hi Mohammad,

If I understand correctly, then yes your proposed valueFraction is correct. It will use fixedValue in the X and Z directions and fixedGradient in the Y direction.

As for "How it detects the normal direction?", I am not sure I understand your question; the normal directions are just taken directly from the mesh geometry. The valueFraction here is independent of the normals and it is up to you to define it appropriately. For example, if the normals were non-uniform on the patch then you may need to define the valueFraction field as non-uniform in order to enforce what ever condition you want.

Philip

mostanad December 13, 2021 17:43

Quote:

Originally Posted by bigphil (Post 818410)
Hi Mohammad,

If I understand correctly, then yes your proposed valueFraction is correct. It will use fixedValue in the X and Z directions and fixedGradient in the Y direction.

As for "How it detects the normal direction?", I am not sure I understand your question; the normal directions are just taken directly from the mesh geometry. The valueFraction here is independent of the normals and it is up to you to define it appropriately. For example, if the normals were non-uniform on the patch then you may need to define the valueFraction field as non-uniform in order to enforce what ever condition you want.

Philip


OK. Good. So the normal direction comes from patch.nf and not be extracted by valueFraction.
Thank you for sharing you valuable information.
Cheers,
Mohammad

qingqingliu April 4, 2023 12:06

Quote:

Originally Posted by bigphil (Post 316165)
Hi G. Paulo,


I occasionally use directionMixed for stress simulations where I want a fixedValue (displacement) in the patch normal direction and some fixedGradient (traction) in the patch tangential direction.

So to achieve a fixedValue in the normal direction, and a fixedGradient in the tangential direction on a patch, then the valueFraction (which is a symmTensor, where the components of a symmTensor are (xx xy xz yy yz zz) ) should be set:
valueFraction = symm(n*n)
where n is the patch normal.

If your patch faces all have the same normal then you can calculate symm(n*n) by hand and put it in your initial conditions, eg:
for a patch with n = ( 1 0 0 )
then the valueFraction = symm( (1 0 0)(1 0 0) ) = ( 1 0 0 0 0 0)
then refValue will be enforced in the patch normal direction and refGradient will be enforced in the patch tangential direction.

If your patch faces have all different normals then you will have to set the patch valueFraction in the solver (using refCast etc.) to be symm(n*n).

So to sum up, if you want a fixedValue in the patch normal direction and a fixedGradient in the patch tangential direction then it looks like this:
refValue uniform (fixed_value_you_want)
refGradient uniform (shear_gradient_you_want)
valueFraction uniform (symm(n*n))

directionMixed can also be used for other situations:
it can act just like a fixedValue BC if valueFraction = (1 0 0 1 0 1),

Or, it can act just like a fixedGradient BC if valueFraction = (0 0 0 0 0 0).

If you look at the directionMixed BC source code, you can see it calculates it.


Hope it helps,
Philip

Hi Philip,
I saw you have answered many questions about directionMixed. Based on my understanding of directMixed condition, I set up it for my case. I think you are the right person to ask if my setup is correct or not.
Here is my case:
Normal vector: (0 1 0)
Velocity vector: (Vx, Vy, Vz)
I want to set Vx = 0, dVy/dn = 0, and dVz/dn = 0. Below is my setup, do you think it is right?

type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (1 0 0 0 0 0);

Thanks for your help!!!

bigphil April 5, 2023 07:19

Quote:

Originally Posted by qingqingliu (Post 847578)
Hi Philip,
I saw you have answered many questions about directionMixed. Based on my understanding of directMixed condition, I set up it for my case. I think you are the right person to ask if my setup is correct or not.
Here is my case:
Normal vector: (0 1 0)
Velocity vector: (Vx, Vy, Vz)
I want to set Vx = 0, dVy/dn = 0, and dVz/dn = 0. Below is my setup, do you think it is right?

type directionMixed;
refValue uniform (0 0 0);
refGradient uniform (0 0 0);
valueFraction uniform (1 0 0 0 0 0);

Thanks for your help!!!

Yes, that looks correct.

After running the model, I suggest you check the boundary conditions are enforced as you expect, e.g. check Vx on the patch, and plot Vy and Vz away from the wall to check the gradient is zero.

qingqingliu April 5, 2023 10:27

Quote:

Originally Posted by bigphil (Post 847629)
Yes, that looks correct.

After running the model, I suggest you check the boundary conditions are enforced as you expect, e.g. check Vx on the patch, and plot Vy and Vz away from the wall to check the gradient is zero.

Hi Philip,

Thanks so much for your reply!


All times are GMT -4. The time now is 22:51.