|May 11, 2012, 04:43||
Boundary condition with a non-uniform gradient - groovyBC?
Join Date: May 2012
Posts: 2Rep Power: 0
I would like to run a simulation with laplacianFoam (one variable to solve : T). On one surface of my geometry (normal to z direction), I want to impose a boundary condition where the gradient in z direction is spatially dependent with x and y.
I thought that groovyBC was one way to achieve this particular BC by using gradientExpression.
Before running simulations with my real expression, I tested a simple case with the gradientExpression set as a constant. But it doesn't give the right result, i.e.: results in paraview are wrong (when compared to fixedGradient BC) and show that the gradient is neither defined on the surface corressponding to the BC nor in the domain (but still calculated as there is a file gradTz in my result file).
Does somebody has an example of use of this kind of BC?
Here is the different cases that I tried :
compared to :
gradient uniform -150000;
Something must be missing when I use groovyBC...
|May 23, 2012, 12:21||
Join Date: May 2012
Posts: 2Rep Power: 0
finally I write my own script to modify the BC. The following script creates a BC with a fixed gradient (depending on the radial position) on the surface called "Extern". gradTz = a first polynomial function when r<= 0.016, and = a second polynomial function for r>0.016.
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv)
float A0 = -0.27776;
float A1 = -0.039557;
float A2 = -4.8824e-3;
float A3 = 2.4143e-3;
float A4 = -2.267e-3;
float A5 = -9.5923e-4;
float B0 = -0.47948;
float B1 = -0.076608;
float B2 = -0.014216;
float B3 = -0.054171;
float B4 = -0.12812;
float B5 = -7.0919e-4;
float B6 = 0.1443;
float B7 = 0.054432;
float B8 = -0.057662;
float B9 = -0.044232;
float B10 = -8.365e-10;
//// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//Get index of the patch where you want to have the spatially dependent BC
label ExternPatchID = mesh.boundaryMesh().findPatchID("Extern");
//Get reference to boundary value
fixedGradientFvPatchScalarField& Textern = refCast<fixedGradientFvPatchScalarField>(T.boundar yField()[ExternPatchID]);
scalarField& gradTextern = Textern.gradient();
//Get coordinates for cell centre
const fvPatchVectorField& centre = mesh.C().boundaryField()[ExternPatchID];
//scalarField x = centre.component(vector::X);
//scalarField y = centre.component(vector::Y);
const vector& xy = centre[cell];
// Info << xy << endl;
gradTextern[cell] = A0 + A1*r + A2*r*r + A3*pow(r,3) + A4*pow(r,4) + A5*pow(r,5);
gradTextern[cell] =B0 + B1*r + B2*r*r + B3*pow(r,3) + B4*pow(r,4) + B5*pow(r,5) + B6*pow(r,6) + B7*pow(r,7) + B8*pow(r,8) + B9*pow(r,9) + B10*pow(r,10);
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
Info<< "End\n" << endl;
// ************************************************** *********************** //
It may help somebody wanting to have a spatially dependant BC with a fixed gradient.
|September 19, 2012, 12:19||
Join Date: Sep 2012
Location: Miami, USA
Posts: 7Rep Power: 6
I am trying to apply a constant BC on micro-tubes surfaces inside a substrate. I have tried these:
gradient uniform -10000;
value uniform 300;
The results show different gradient values on the walls, gradTx, gradTy and gradTz are so much more that the input values. I should mention that when I apply this BC for top surface which is horizontal I get perfect results. Here it says ( http://www.foamcfd.org/Nabla/guides/...Guidese11.html) that by "fixedgradient" we define
. I need to define only the magnitude of temperature gradient on the tubes.
Could you help me please?
|October 11, 2013, 02:04||
Join Date: Jan 2013
Posts: 101Rep Power: 5
Your script file will be of guidance in my case. Thank you.
I have a basic doubt. These script files are specific to the case. So are they saved in the case folder or in FOAM_SRC as a derived BC?
I am just starting on writing custom BC. Your reply will be of immense help.
Thanks in advance!
|Thread||Thread Starter||Forum||Replies||Last Post|
|Pressure instability with rhoSimpleFoam||daniel_mills||OpenFOAM Running, Solving & CFD||44||February 17, 2011 18:08|
|Boundary condition setting for non-premixed combustion using reactingFoam||skyopener||OpenFOAM||0||May 23, 2010 22:55|
|vorticity boundary condition||bearcharge||Main CFD Forum||0||May 14, 2010 11:32|
|Slip boundary condition what is inside||normunds||OpenFOAM Running, Solving & CFD||2||June 4, 2007 06:45|
|pressure gradient boundary condition||kamesh||FLUENT||0||May 9, 2005 14:17|