Boundary Conditions with GroovyBC, Normal Gradient
Hello,
I´d like to implement some boundary conditions with groovyBC, but it seems, that that doesn`t work like I think it should ;). Here is my problem: Without groovyBc it´s possible to implement a fixed normal gradient with boundary { type fixedGradient; gradient 100; } Now i need this expression with a dependency of a variable, computet in a step befor. So i tried boundary { type groovyBC; gradientExpression "Varfixed"; variable "Var{boundary2}=Var2; fixed=100"; value uniform 0; } For a calculating a single value, for example for a Dirichlet boundary condition, it works. Did I make a mistake in my definition of the boundary condition? Are there any good documentations for groovyBC, where i can find such things? Best regards treima 
Quote:
Code:
fractionExpression "0"; Quote:
No seriously. I've started writing a document that summarizes the most important concepts of swak4Foam. But don't hold your breath. If we're lucky I will have a first version before the end of the Mayan calendar (otherwise the world will end ...) 
Thanks for your answer, it works perfect.
I have another question on boundary conditions with groovyBC. Is it possible to make this locationdependent? Is here pos().x right? For example, if I´m having a look at a twodimensional geometry: boundary { type groovyBC; gradientExpression "Varfunction"; variable "Var{boundary2}=Var2; function=pos().x^2+2*pos().x+3"; value uniform 0; fractionExpression "0"; } And if this is possible, how can I define a interval for x, e.g. x from 0 to 1? 
I think I found a solution to my problem from above.
boundary { type groovyBC; gradientExpression "Varfunction"; variable "Var{boundary2}=Var2; function=pos().x*pos().x+2*pos().x+3"; value uniform 0; fractionExpression "0"; } But I´d like to expand my example ;) Is it possible to define something like this in the boundary conditions? Var{boundary2} (x) = Var2 (x) Var2 at boundary2 is a function, which is dependent from the location. OpenFoam takes the average of the Values, but it would be nicer to have the exact values at every location. Best regards treima 
Quote:
BUT: if you reorganize Var and Var2 as a cyclic patch you might be able to get what you want using a jumpboundary condition doing something like this Code:
var Of course you'll have to make sure that the other physical quantities can live with the cyclic 
patch to patch mapping
Hi,
what do you exactly mean by "patch to patch mapping"? Right now I'm looking for a tool to map the velocityfield of one model onto the inlet of another model. Is this possible and where do I find an example? What I want to do is the following: simulate a rectangular line > export the outflowvelocityprofile > map this outflowprofile onto an inletsurface.The inlet and outflow geometries are the same. I've already looked into the liddrivencavity tutorial but there I mapped an entire Mesh onto a finer one but what if I just want to map one surface...? Kind regards 
Quote:
Quote:
If you want something like the mapFields utility but only for one boundary: could be done with the above stuff, but I'm not aware of such a utility (which doesn't mean that it doesn't exist) 
I am trying to apply a constant BC on microtubes surfaces inside a substrate. I have tried these:
1. { type fixedGradient; gradient uniform 10000; } 2. { type groovyBC; gradientExpression "10000"; fractionExpression "0"; } 3. { type groovyBC; value uniform 300; gradientExpression "gradT"; variables "htot=15000.00;Tinf=293.00;k=130;gradT=htot/(k)*(TinfT);"; } 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 http://www.foamcfd.org/Nabla/guides/...sGuide452x.gif . I need to define only the magnitude of temperature gradient on the tubes. Could you help me please? Thank you aa 
Quote:
Variant 2 (the groovyBC one) should be equivalent to Code:
{ 
Thank you for your help!
I want to define temperature gradient exactly "10000" on the pipe. I have tried those 3 cases that I wrote in my previous post separately. Non of them gave me the constant gradient on my pipe. I assume the gradient that I define is the magnitude of gradient normal to surface. Then why sqrt(gradTx^2+gradTy^2+gradTz^2) is so much bigger than that. I tried the Mixed BC that you suggested but still I have that problem. Isn't it because of my mesh? I used blockMesh/snappyHexMesh? Thank you again aa 
Quote:
 you prescribe the gradient on the face. The values you're referring to are calculated in the cell center. May be bigger or smaller (that's discretization)  you prescribe only the value of the gradient in normal direction. If for instance the normal direction of your patch is y but your model has an implicit gradient in xdirection (for instance because of two fixedValueBCs with different values) then of course these two give a biggere absolute value In general be more specific when asking (I don't know how it is with other people, but if I have trouble understanding what your problem actually is I loose interest). To be specific:  how much is "much bigger than that"? 5%, 100%  which of the four cases (fixedGradient, mixed and the two groovyBC variants) give the same results (and by how much do they differ) 
5 Attachment(s)
Thank you Bernhard for your help!
I am sorry, I am new here! My case is a microchannel. For the flow inside the pipes I use a FORTRAN code to get friction losses. To get the temp. on the pipe (walls) I use OpenFOAM. So, first I use laplacianFOAM to get wall temp., and then with my code I will get the fluid temp. Then inside my FORTRAN code I calculated dT/dn=h*(TwallTfluid)/k (I know the value of k) and import it as an input for laplacianFoam to get the updated temp. field. Since in my FORTRAN code I know Twall, therefore dT/dn will be constant for each patch. I put this procedure into a loop until the temp. difference between two iteration is less than 10^04. It is converging and I get the results but I dont know they are correct or not. I have fourlayer microchannel: Attachment 15866 Here are the setting for my snappyHexMesh: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // snappyHexMesh switches. castellatedMesh true; snap true; addLayers true; // Geometry. Definition of all surfaces. geometry { BN.stl { type triSurfaceMesh; name nozzle; } }; // Settings for the castellatedMesh generation. castellatedMeshControls { // Refinement parameters maxLocalCells 100000; maxGlobalCells 300000; minRefinementCells 10; nCellsBetweenLevels 6; resolveFeatureAngle 20; features ( ); // Surface based refinement refinementSurfaces { "nozzle_*" { level (3 3); } } refinementRegions { } // Mesh selection locationInMesh (0.00000001 0.00000001 0.00000001); //close to a inlet side corner where no channel would coincide //depends on prob dimensions } // Settings for the snapping. snapControls { nSmoothPatch 3; tolerance 4; nSolveIter 30; nRelaxIter 5; } // Settings for the layer addition. addLayersControls { layers { "nozzle_*" { nSurfaceLayers 10; } } relativeSizes true; expansionRatio 1.05; finalLayerThickness 0.5; minThickness 0.1; nGrow 1; // Advanced settings featureAngle 60; nRelaxIter 3; nSmoothSurfaceNormals 1; nSmoothNormals 3; nSmoothThickness 10; maxFaceThicknessRatio 0.5; maxThicknessToMedialRatio 0.3; minMedianAxisAngle 130; nBufferCellsNoExtrude 0; nLayerIter 50; } // Generic mesh quality settings. meshQualityControls { maxNonOrtho 65; maxBoundarySkewness 20; maxInternalSkewness 4; maxConcave 80; minFlatness 0.5; minVol 1e30; minArea 1; minTwist 0.05; minDeterminant 0.001; minFaceWeight 0.02; minVolRatio 0.01; minTriangleTwist 1; // Advanced nSmoothScale 4; errorReduction 0.75; } // Advanced debug 0; mergeTolerance 1E6; // ************************************************** *********************** // here is the mesh quality: Attachment 15867 I just use the value of "10000" to see if I can get the constant temp. gradient on the walls or not. I used the following setting (as you suggested): { type mixed; refGradient uniform 10000; refValue uniform 0; valueFraction uniform 0; } here are results: Attachment 15868 Attachment 15869 Attachment 15870 As you see the values are much more higher that "10000". I should mention that these channels are inside the silicon substrate 15*15*2 mm. I know top surface heat flux and bottom surface temp. other sides are isolated. I could not attach its picures. If you want I will attach it in another pot. Please help me!! 
Quote:
So if you're working only use cell values. The point values are only for the presentations afterwards so that the aesthets are not bother with the "steppiness" of the cells 
Hi Bernhard,
I dont know exactly, but I think you are right. here is my fvSchemes:  ddtSchemes { default steadyState; } gradSchemes { default Gauss linear; grad(T) Gauss linear; } divSchemes { default none; } laplacianSchemes { default non; laplacian(DT,T) Gauss linear corrected; } interpolationSchemes { default linear; interpolate(T) linear; } snGradSchemes { default corrected; } fluxRequired { default no; T; } // ************************************************** *********************** // I use sample to get the temp. and its gradient on surfaces and patches. My sampleDic is: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // interpolationScheme cellPointFace; setFormat vtk; surfaceFormat vtk; sets (); surfaces ( maxY { type patch; patchName maxY; } minY { type patch; patchName minY; } ); fields ( T gradTy ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // sample results are same as paraFoam. How can I make sure my results are correct? gradSchemes is based on cell enter value. Thank you aa 
Similar thing
Hi,
I would like to have something like timeVaryingFixedGradient. The first thought was to use the groovyBC. The problem is when I do this in the T dictionary boundary(running buoyantPimpleFoam): Code:
heater Any ideas where could I have messed up? Cheers Peter 
Quote:
refValue uniform 300; This will only be used during startup (you didn't try to divide by 0. The thermoPhysicslibrary did with a value that was accidentally set to 0 because the expressions can't be evaluated before all the fields are loaded) 
Quote:
That works, and sorry for the duplicity if it is already mentioned elsewhere. Bye Peter 
Quote:

Quote:
Is it the same bug, perhaps? Peter 
Quote:
BTW: which version of OF? 
All times are GMT 4. The time now is 21:38. 