
[Sponsors] 
November 14, 2015, 21:47 
Problems with implementing groovy BC

#1 
Member
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 42
Rep Power: 3 
Hi
I am using OpenFoam to solve the magnetization decay problem and the boundary condition that I have looks like this: D.n.delta(M)+b.M = 0 where, D is scalar constant, n is the surface normal to the boundary face delta is the gradient operator b is a constant M is a vector field I tried using: boundaryField { fixedWalls { type groovyBC; refValue uniform (0 0 1); refGradient uniform (0 0 0); valueFraction uniform 1; value uniform (0 0 1); valueExpression "Tinf"; gradientExpression "0"; fractionExpression "f"; evaluateDuringConstruction 0; variables 4 ( "D=3e09;" "rho=10e06;" "Tinf=D/rho*snGrad(M);" "f=I;" ) ; timelines ( ); lookuptables ( ); } } but it gives me an error. Pleas let me know how I can code my boundary condition. Thank you. 

November 18, 2015, 06:07 

#2 
Member
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 4 
Hi Saurabh,
I am a novice myself, but perhaps if you post your error message then someone smarter can help you better. One quick check: Did you add Code:
libs ( "libgroovyBC.so"); You need to do this if you want groovyBC to work. Your code looks ok at first glance. I don't normally put the "4" in front of the variables list, but I'm not sure if this would cause a problem. 

November 18, 2015, 22:25 

#3 
Member
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 42
Rep Power: 3 
Hi
Thank you for replying to my post. This is the full context of the error that I get for my simulations: I use this file, for initial conditions: FoamFile { version 2.0; format ascii; class volVectorField; location "0"; object M; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 0 0 0 1 0]; internalField nonuniform List<vector> 64000 ( ..list of values.. ); boundaryField { fixedWalls { type groovyBC; value uniform (0 0 0); valueExpression "vector (0, 0, 0)"; gradientExpression "vector (0, 0, 0)"; fractionExpression "f"; variables 4 ( "D=3e09;" "rho=10e06;" "Tinf=vector (0, 0, 0);" "f=tensor(1/(1+D/(rho*mag(delta()))), 0, 0, 0, 1/(1+D/(rho*mag(delta()))), 0, 0, 0, 1/(1+D/(rho*mag(delta()))));" ) ; timelines ( ); lookuptables ( ); } } So far so good? So when I run the code this is the error that I get. swak4Foam: Allocating new repository for sampledGlobalVariables > FOAM FATAL ERROR: The expected return type scalar is different from the stored result type "tensor" From function tmp<Field<Type> > ExpressionResult::getResult() in file ../swak4FoamParsers/lnInclude/ExpressionResultI.H at line 247. Please let me know if you can understand this error and help me rectify it. Thanks again. Saurabh 

November 19, 2015, 02:43 

#4 
Member
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 4 
Hi Saurabh,
Your error message says that something is a tensor when groovyBC is expecting a scalar. Code:
> FOAM FATAL ERROR: The expected return type scalar is different from the stored result type "tensor" 

November 19, 2015, 02:53 

#5 
Member
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 42
Rep Power: 3 
Hi Nicole
Thank you for replying so quickly. Please peruse the post http://www.cfdonline.com/Forums/ope...mixedbc.html This describes the use of tensor for f in the case you have vector field instead of a scalar field. I am following these instructions. But you are right, in case of scalar field you have scalar f instead of a tensor. But it keeps giving me an error. Thanks again. Saurabh 

November 19, 2015, 03:49 

#6 
Member
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 4 
Hi Saurabh,
Sorry, I have not worked with tensors so I am rather out of my depth by now. Have you tried adding a space between the declaration and the bracket like this f= tensor (....etc . I think I saw something about that in a post once. Unfortunately that is all that I can think of with my limited understanding. Sorry I can't be more help 

November 19, 2015, 04:03 

#7 
Member
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 42
Rep Power: 3 
Well, no problem. Thank you for the help. I will try it using refCast now.
Saurabh 

December 5, 2015, 22:42 

#8 
Member
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 51
Rep Power: 10 
Im not certain of what is gonig on is valueFraction is a scalar or it is a symmTensor field like in directionmix boundary condition
valueFraction uniform 1; ??? Would you be open to share your case so i can run it to see what is going on. I would binterested in your simulation and boundary condition. Maibe you can send me the case by dropbox or on a zip on this forum. Regards 

December 5, 2015, 23:27 

#9 
Member
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 42
Rep Power: 3 
I was a little confused as well.
When you use GroovyBC the valueFraction or the refValue fraction should be a scalar. GroovyBC cannot handle tensors. But when you run a code like funkySetFields it will define a weird set of values for your variables that you see in my post. When you use directionMixed BC value fraction should be a tensor. Like you mentioned it can be symmetric tensor. In my problem I have to define value fraction as a nonsymmetric surface tensor field. That's why I am a little confused. If you read my post you will understand why I need to do that. 

December 6, 2015, 00:11 

#10 
Member
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 51
Rep Power: 10 
In the BC directionMixed valuefraction is a by dfi ition a symmTensor field when I look at the c++ code. To have a non symmetric tensor field as valuefraction you can copy and modify dirctionMixed and replace symmTensor with tensor recompile ...
Would you be open to share exemple case of what you try to do ? I would be interested to run it and look at the specific BC you need regard 

December 6, 2015, 00:19 

#11 
Member
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 42
Rep Power: 3 
Right now I am trying to use fixed value BC in the simulation. I use refCast to extract the values at the boundaries and then modify the values in accordance with my BC at the beginning of each time step. But I will try and modify the the tensor in the future. I can let you know how I do then. Thanks again for your advice.
Saurabh 

Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
[ICEM] Problems with coedge curves and surfaces  tommymoose  ANSYS Meshing & Geometry  0  August 5, 2011 16:02 
Needed Benchmark Problems for FSI  Mechstud  Main CFD Forum  4  July 26, 2011 12:13 
Twophase air water flow problems by activating Wall Lubrication Force  challenger85  CFX  5  November 5, 2009 06:44 
Problems implementing a boundary condition  ogloth  OpenFOAM Running, Solving & CFD  3  July 17, 2007 15:36 
Help required to solve Hydraulic related problems  aero  CFX  0  October 30, 2006 12:00 