|
[Sponsors] |
codedMixed boundary condition for switching between no-slip and slip |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 27, 2021, 06:28 |
codedMixed boundary condition for switching between no-slip and slip
|
#1 |
Member
Join Date: Mar 2021
Posts: 39
Rep Power: 5 |
Hello,
I would like to create a mixed boundary condition where based, on a switch, I change the boundary from no-slip to slip. Let's assume that after 1s of simulation the walls go from no slip to slip. For the time being I have: Code:
myPatch { type codedMixed; refValue uniform (0 0 0); refGradient uniform (0 0 0); valueFraction uniform 0; name myBC; code #{ // Access the current value of time const Time& time = mesh.time(); const scalar t = time.value(); // Loop over the patch forAll(patch(), faceI) { if(t < 1) { // Imposes no-slip boundary condition this->refValue()[faceI] = vector::zero; this->valueFraction()[faceI] = scalar(1); } else { // Imposes slip boundary condition ?Help needed here? } } #}; } However, I am quite new at this and would appreciate the help. |
|
May 27, 2021, 06:48 |
|
#2 |
New Member
Giovanni Luddeni
Join Date: Jan 2021
Posts: 14
Rep Power: 5 |
Hi, I have a few suggetsions for you, hoping to be of help:
1) I would put the for loop inside the if clause, since this way you have one evaluation of the if and one loop, otherwise you are evaluation the if clause multiple times, with lower performance; 2) From what I understand, the initial setup is not representing a no slip, since the fraction is 0 (you are starting with a zeroGradient basically, the flow can penetrate the wall!). You should start with a Dirichlet imposing zero velocity: Code:
type codedMixed; refValue uniform (0 0 0); valueFraction uniform 1; name myBC; 3) About your question, there are several ways you can follow to implement a slip condition, which is the equation you would like to use? 4) I don't know if you care, but you can express the switch threshold in the properties dict in the constant folder, this is an example where i get a variable called q from a dict called physicalProperties (which is defined in the solver, you could have transportProperties or something like that): Code:
const dictionary& physicalProperties = db().lookupObject<IOdictionary>("physicalProperties"); scalar& q = dimensionedScalar(physicalProperties.lookup("q")).value(); |
|
May 27, 2021, 06:50 |
|
#3 |
New Member
Giovanni Luddeni
Join Date: Jan 2021
Posts: 14
Rep Power: 5 |
I forgot to mention the silly solution:
you can put no slip and solve till 1s, then change in the 1 folder the bc to slip and start again the simulation from 1. This could avoid the use of a codedBC. |
|
May 27, 2021, 06:59 |
|
#4 | |
Member
Join Date: Mar 2021
Posts: 39
Rep Power: 5 |
Quote:
Thanks for the reply! But the purpose if to actually use the mixedCoded boundary. Regarding the slip boundary. I would expect it to be the same as implemented in OF where the basicSymmetryFvPatchField is called. However, I do not know how to input this into the codedMixed |
||
May 27, 2021, 08:00 |
|
#5 |
New Member
Giovanni Luddeni
Join Date: Jan 2021
Posts: 14
Rep Power: 5 |
I took a look to the code of the Bc you mention, the interesting part would be this
Code:
tmp<vectorField> nHat = this->patch().nf(); const Field<Type> iF(this->patchInternalField()); Field<Type>::operator= ( (iF + transform(I - 2.0*sqr(nHat), iF))/2.0 ); transformFvPatchField<Type>::evaluate(); I guess imposing a symmetry you would need to put the orthogonal component of the velocity to zero; I don't think this would be a completely correct way, but you can try it to test the codedBC, waiting for someone else to explain the right interpretation of the BC. At the end of the day it would be an approximation similar to no slip -> v=0, so you're basically imposing the no-penetrating condition rather than the whole symmetry. If you decide to try this, the BC would be something like: Code:
myPatch { type codedMixed; refValue uniform (0 0 0); valueFraction uniform 1; name myBC; code #{ // Access the current value of time const Time& time = mesh.time(); const scalar t = time.value(); vector currentVelocity; // Loop over the patch if(t < 1) { forAll(patch(), faceI) { // Imposes no-slip boundary condition this->refValue()[faceI] = vector::zero; } } else { forAll(patch(), faceI) { // no penetration only currentVelocity = this->refValue()[faceI]; this->refValue()[faceI] = currentVelocity - (currentVelocity&patch().nf()[f])&patch().nf()[f] ; } } #}; } I hope it helps. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table bounds warnings at: END OF TIME STEP | CFXer | CFX | 4 | July 17, 2020 00:44 |
Radiation in semi-transparent media with surface-to-surface model? | mpeppels | CFX | 11 | August 22, 2019 08:30 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
Question about heat transfer coefficient setting for CFX | Anna Tian | CFX | 1 | June 16, 2013 07:28 |
Error finding variable "THERMX" | sunilpatil | CFX | 8 | April 26, 2013 08:00 |