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

DirectionMixed mixed bc

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

Like Tree41Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   November 7, 2013, 00:55
Default
  #41
Senior Member
 
Srivathsan N
Join Date: Jan 2013
Location: India
Posts: 101
Rep Power: 5
Sherlock_1812 is on a distinguished road
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.
__________________
Regards,

Srivaths
Sherlock_1812 is offline   Reply With Quote

Old   September 15, 2014, 11:28
Default
  #42
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 5
Sliwa is on a distinguished road
Hi,

Quote:
Originally Posted by hjasak View Post
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,
Sliwa is offline   Reply With Quote

Old   September 17, 2014, 10:02
Default
  #43
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 617
Rep Power: 21
bigphil will become famous soon enoughbigphil will become famous soon enough
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
tom ato and meth like this.
bigphil is offline   Reply With Quote

Old   September 17, 2014, 10:03
Default
  #44
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 617
Rep Power: 21
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by Sherlock_1812 View Post
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
bigphil is offline   Reply With Quote

Old   September 18, 2014, 10:55
Default
  #45
New Member
 
Join Date: Jul 2013
Posts: 6
Rep Power: 5
Sliwa is on a distinguished road
Thank you, Philip! That worked.
Sliwa is offline   Reply With Quote

Old   August 9, 2015, 21:10
Default
  #46
New Member
 
Amir
Join Date: Jul 2011
Location: Shiraz
Posts: 15
Rep Power: 7
infinity is on a distinguished road
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
Attached Images
File Type: png 1.png (2.3 KB, 19 views)
infinity is offline   Reply With Quote

Old   August 12, 2015, 11:09
Default
  #47
New Member
 
Amir
Join Date: Jul 2011
Location: Shiraz
Posts: 15
Rep Power: 7
infinity is on a distinguished road
any answer guys ?
infinity is offline   Reply With Quote

Old   August 12, 2015, 11:13
Default
  #48
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 617
Rep Power: 21
bigphil will become famous soon enoughbigphil will become famous soon enough
I think the slip boundary condition already does what you want.

See here.

Philip
bigphil is offline   Reply With Quote

Old   August 12, 2015, 11:48
Default
  #49
New Member
 
Amir
Join Date: Jul 2011
Location: Shiraz
Posts: 15
Rep Power: 7
infinity is on a distinguished road
Thanks a lot Philip
It was very Helpful
infinity is offline   Reply With Quote

Old   December 3, 2015, 19:02
Default
  #50
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 41
Rep Power: 2
STutexas is on a distinguished road
Quote:
Originally Posted by bigphil View Post
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 is offline   Reply With Quote

Old   December 3, 2015, 19:07
Default
  #51
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 41
Rep Power: 2
STutexas is on a distinguished road
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.
STutexas is offline   Reply With Quote

Old   December 4, 2015, 20:40
Default Yes you can code with C++ many great thing in OF
  #52
Member
 
ubald's Avatar
 
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 51
Rep Power: 9
ubald is on a distinguished road
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
ubald is offline   Reply With Quote

Old   December 4, 2015, 22:09
Default
  #53
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 41
Rep Power: 2
STutexas is on a distinguished road
[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:

Problems with implementing groovy BC

This might give you more context to what I am trying to do. Thanks again for the help.
STutexas is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mixed difference Shuo Main CFD Forum 1 September 3, 2008 01:25
mixed convection sumesh FLUENT 0 March 7, 2008 01:00
Mixed CPU/GPU computing Joe Main CFD Forum 4 September 20, 2006 12:04
Direction mixed bc evgenii OpenFOAM Pre-Processing 1 November 30, 2005 05:37
mixed convection raj calay Main CFD Forum 6 April 21, 1999 22:33


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