CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Community Contributions

[swak4Foam] Problems with implementing groovy BC

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 14, 2015, 21:47
Default Problems with implementing groovy BC
  #1
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 43
Rep Power: 11
STutexas is on a distinguished road
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=3e-09;"
"rho=10e-06;"
"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.
STutexas is offline   Reply With Quote

Old   November 18, 2015, 06:07
Default
  #2
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
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");
to your controlDict file?

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.
Nicole is offline   Reply With Quote

Old   November 18, 2015, 22:25
Default
  #3
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 43
Rep Power: 11
STutexas is on a distinguished road
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=3e-09;"
"rho=10e-06;"
"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
STutexas is offline   Reply With Quote

Old   November 19, 2015, 02:43
Default
  #4
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
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"
This might have something to do with "f" in your variables.
Nicole is offline   Reply With Quote

Old   November 19, 2015, 02:53
Default
  #5
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 43
Rep Power: 11
STutexas is on a distinguished road
Hi Nicole

Thank you for replying so quickly. Please peruse the post

http://www.cfd-online.com/Forums/ope...-mixed-bc.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
STutexas is offline   Reply With Quote

Old   November 19, 2015, 03:49
Default
  #6
Member
 
Nicole Andrew
Join Date: Sep 2014
Location: Pretoria, South Africa
Posts: 58
Rep Power: 12
Nicole is on a distinguished road
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
Nicole is offline   Reply With Quote

Old   November 19, 2015, 04:03
Default
  #7
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 43
Rep Power: 11
STutexas is on a distinguished road
Well, no problem. Thank you for the help. I will try it using refCast now.
Saurabh
STutexas is offline   Reply With Quote

Old   December 5, 2015, 22:42
Default
  #8
nlc
Member
 
nlc's Avatar
 
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 61
Rep Power: 17
nlc is on a distinguished road
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
nlc is offline   Reply With Quote

Old   December 5, 2015, 23:27
Default
  #9
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 43
Rep Power: 11
STutexas is on a distinguished road
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 non-symmetric 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.
STutexas is offline   Reply With Quote

Old   December 6, 2015, 00:11
Default
  #10
nlc
Member
 
nlc's Avatar
 
Nicolas Lussier Clément
Join Date: Apr 2009
Location: Montréal, Qc, Canada
Posts: 61
Rep Power: 17
nlc is on a distinguished road
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
nlc is offline   Reply With Quote

Old   December 6, 2015, 00:19
Default
  #11
Member
 
Saurabh Tandon
Join Date: Nov 2015
Location: Austin
Posts: 43
Rep Power: 11
STutexas is on a distinguished road
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
STutexas is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Problems with coedge curves and surfaces tommymoose ANSYS Meshing & Geometry 6 December 1, 2020 12:12
Patankar 1980 (Diffusion Convection Problems) hhandoko System Analysis 1 January 25, 2018 08:56
Needed Benchmark Problems for FSI Mechstud Main CFD Forum 4 July 26, 2011 13:13
Problems implementing a boundary condition ogloth OpenFOAM Running, Solving & CFD 3 July 17, 2007 16:36
Help required to solve Hydraulic related problems aero CFX 0 October 30, 2006 12:00


All times are GMT -4. The time now is 03:24.