|
[Sponsors] |
[swak4Foam] Boundary Conditions with GroovyBC, Normal Gradient |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 24, 2012, 10:42 |
Boundary Conditions with GroovyBC, Normal Gradient
|
#1 |
Member
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14 |
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 "Var-fixed"; 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 |
|
May 24, 2012, 12:11 |
|
#2 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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 ...) |
|||
May 30, 2012, 09:41 |
|
#3 |
Member
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14 |
Thanks for your answer, it works perfect.
I have another question on boundary conditions with groovyBC. Is it possible to make this location-dependent? Is here pos().x right? For example, if I´m having a look at a twodimensional geometry: boundary { type groovyBC; gradientExpression "Var-function"; 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? |
|
May 30, 2012, 10:44 |
|
#4 |
Member
Join Date: Mar 2012
Location: Munich, Germany
Posts: 67
Rep Power: 14 |
I think I found a solution to my problem from above.
boundary { type groovyBC; gradientExpression "Var-function"; 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 |
|
May 30, 2012, 14:03 |
|
#5 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
BUT: if you reorganize Var and Var2 as a cyclic patch you might be able to get what you want using a jump-boundary condition doing something like this Code:
var { type groovyBCJump; value uniform 0; patchType cyclic; jumpExpression "pos().x*pos().x+2*pos().x+3"; } Of course you'll have to make sure that the other physical quantities can live with the cyclic |
||
July 27, 2012, 10:34 |
patch to patch mapping
|
#6 |
Senior Member
Sören
Join Date: Mar 2012
Posts: 102
Rep Power: 14 |
Hi,
what do you exactly mean by "patch to patch mapping"? Right now I'm looking for a tool to map the velocity-field 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 outflow-velocity-profile -> map this outflow-profile onto an inlet-surface.The inlet and outflow geometries are the same. I've already looked into the lid-driven-cavity tutorial but there I mapped an entire Mesh onto a finer one but what if I just want to map one surface...? Kind regards |
|
August 1, 2012, 18:18 |
|
#7 | ||
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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) |
|||
September 19, 2012, 13:21 |
|
#8 |
New Member
anonymous
Join Date: Sep 2012
Location: Miami, USA
Posts: 7
Rep Power: 14 |
I am trying to apply a constant BC on micro-tubes 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)*(Tinf-T);"; } 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? Thank you aa |
|
September 19, 2012, 18:21 |
|
#9 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Variant 2 (the groovyBC one) should be equivalent to Code:
{ type mixed; refGradient uniform -10000; refValue uniform 0; valueFraction uniform 0; }
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
September 19, 2012, 20:37 |
|
#10 |
New Member
anonymous
Join Date: Sep 2012
Location: Miami, USA
Posts: 7
Rep Power: 14 |
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 |
|
September 21, 2012, 09:33 |
|
#11 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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 x-direction (for instance because of two fixedValue-BCs 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)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
September 21, 2012, 12:57 |
|
#12 |
New Member
anonymous
Join Date: Sep 2012
Location: Miami, USA
Posts: 7
Rep Power: 14 |
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*(Twall-Tfluid)/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 four-layer microchannel: 2.jpg 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 1E-6; // ************************************************** *********************** // here is the mesh quality: 4.jpg 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: 5.jpg 6.jpg 9.jpg 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!! |
|
September 22, 2012, 06:18 |
|
#13 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
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
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
September 22, 2012, 21:08 |
|
#14 |
New Member
anonymous
Join Date: Sep 2012
Location: Miami, USA
Posts: 7
Rep Power: 14 |
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 |
|
December 11, 2012, 15:54 |
Similar thing
|
#15 |
New Member
Peter Benovsky
Join Date: Jun 2011
Posts: 5
Rep Power: 15 |
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 { type groovyBC; value uniform 300; valueExpression "300"; gradientExpression "gradT*time()"; fractionExpression "0"; variables "heatFlux=6700;alpha=0.02;gradT=heatFlux/(alpha+alphat)"; } Any ideas where could I have messed up? Cheers Peter |
|
December 11, 2012, 16:10 |
|
#16 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
refValue uniform 300; This will only be used during startup (you didn't try to divide by 0. The thermoPhysics-library did with a value that was accidentally set to 0 because the expressions can't be evaluated before all the fields are loaded)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
December 11, 2012, 18:53 |
|
#17 | |
New Member
Peter Benovsky
Join Date: Jun 2011
Posts: 5
Rep Power: 15 |
Quote:
That works, and sorry for the duplicity if it is already mentioned elsewhere. Bye Peter |
||
December 12, 2012, 13:24 |
|
#18 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
In this case: no problem about the duplicity. It's hard to spot that it is the same bug if you don't know what is going on (you can't say that about all the bug reports I get here)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
December 14, 2012, 04:04 |
|
#19 | |
New Member
Peter Benovsky
Join Date: Jun 2011
Posts: 5
Rep Power: 15 |
Quote:
Is it the same bug, perhaps? Peter |
||
December 14, 2012, 05:28 |
|
#20 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
BTW: which version of OF?
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
Tags |
boundary, condition, gradient, groovybc, normal |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Problem in setting Boundary Condition | Madhatter92 | CFX | 12 | January 12, 2016 05:39 |
Problem with SIMPLEC-like finite volume channel flow boundary conditions | ghobold | Main CFD Forum | 3 | June 15, 2015 12:14 |
Radiation interface | hinca | CFX | 15 | January 26, 2014 18:11 |
Water subcooled boiling | Attesz | CFX | 7 | January 5, 2013 04:32 |
RPM in Wind Turbine | Pankaj | CFX | 9 | November 23, 2009 05:05 |