About groovyBC to set distributed fixedGradient values for each cell boundary patch
Hi,
I need to set a distributed fixedGradient value for each cell boundary patch, the boundary setting is as follows: top { type groovyBC; fields ( gt ) gradientExpression "gt"; fractionExpression "0" //gradientExpression is used lookuptables ( { name gt; outOfBounds clamp; fileName "$FOAM_CASE/gt.data"; } ); } and my gt.data is ( (0.0950554) (0.035402) (0.0456968) (0.0371096) (0.0382265) (0.0358306) (0.0355109) (0.0347807) (0.0347118) (0.0342635) (0.0336614) .... ) I have 4608 Faces in the top patch, and when I running this code, I got the following warning No value defined for T on top therefore using 4608{0} Looked like the boundary patch haven't read my defined value, can anyone have a look at my setting? Cheers, Kan |
A few comments to my post,
The error is the reason that I didn't set "value", which is used at Startup. My scalar is based on radius and angle, so then I change my input data into ( (2.544053e-02 4.090615e-03 1904.18) (2.544053e-02 1.227185e-02 709.182) (2.544053e-02 2.045308e-02 915.406) (2.544053e-02 2.863431e-02 743.38) (2.544053e-02 3.681554e-02 765.746) (2.544053e-02 4.499677e-02 717.741) (2.544053e-02 5.317800e-02 711.326) (2.544053e-02 6.135923e-02 696.685) ................... ) The boundary setting changes as well, top { type groovyBC; value $internalField variables ( "radius=sqrt(pow(pos().x,2)+pow(pos().x,2));" "angle=atan(pos().y/pos().x);" ); fields ( radius angle grad ) gradientExpression "gt(radius angle)"; fractionExpression "0" //gradientExpression is used lookuptables ( { name gt; outOfBounds clamp; fileName "$FOAM_CASE/gt.data"; } ); } Not sure if GroovyBC can do that??? Cheers, Kan |
Quote:
Anyway: lookuptables only work with one independent variable (so something of the form "gt(radius)" would work). Interpolation from more than one independent variable is currently on my "Nice to have" list (which means it gets done when I need it or when or when someone who pays me needs it. Of course that assumes that I have to implement it. Which is not necessarily the case) If you can separate your function into two independent functions similar to gt(radius,angle)=gtr(radius)*gta(angle) then you're in business again |
Quote:
Thank you for your reply. The reason that I have the fields entry is I followed this thread here: http://www.cfd-online.com/Forums/ope...le-values.html Is that "fields entry" necessary to groovyBC? I though this is used to set the index to each column at input data file, as you can see, I have my calculated radius and angle, I was wondering I can look-up my input data based on column 1 and 2, However, you said that lookup tables only work with one independent variable, but my value depends on two independent variables. Then, I have also tried to set nonuniform List<scalar> to my boundary patch, which is now working. Cheers, Kan |
Quote:
http://www.cfd-online.com/Forums/ope...tml#post361133 Quote:
|
Quote:
For this groovy BC, if I need to calculate gradient for boundary patch based heat transfer coefficient and ambient temperature. see below: type groovyBC; value $internalField gradientExpression "gt"; fractionExpression "0" //gradientExpression is used variables ( "ratational_speed = 50000;" // rotational speed "radius=sqrt(pow(pos().x,2)+pow(pos().x,2));" "vel_rotor = ratational_speed * radius;" "hfc = 30;" // heat transfer coefficient "T_ambinet = 290;" // ambient temperature "k = 16;" // thermal conductivity of solid pad "gt = hfc*(T-T_ambinet)/k" ); at the last euqation, hfc is heat transfer coefficient, T_ambient is ambient temperature, k is thermal conductivity, I assumed that T is the boundary temperature, is that right? Cheers, Kan |
Quote:
BTW: For large hfc/k (almost instantaneous heating) a gradient-Formulation would overshoot. Consider blending (with fractionExpression) to a T=T_ambient in that case BTW2: The variables till vel_rotor are not used. This is on purpose? |
All times are GMT -4. The time now is 01:11. |