CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Scripting Fluent, reference values? (http://www.cfd-online.com/Forums/fluent/88134-scripting-fluent-reference-values.html)

Unneoetech May 9, 2011 11:57

Scripting Fluent, reference values?
 
I'm doing research on airfoils and winglets and want to see the lift and drag coefficient curves for different angles of attack. I'm using a script to run a solution from a ready to run case file which adapts the inlet conditions, initializes, solves and saves the data file. Fluent 13 runs on the server so I start it using ssh. Using the nohup command I can let it run overnight (even if I close the ssh connection) and see the output in nohup.out or open the .dat files. All works really well but in post processing I need to open the data file, specify the force vector (different for each angle of attack...), change the reference values (if I changed the velocity) and report on the forces, both for lift, drag and sometimes moment (which is a bit easier off course).
I can report the forces from the script file but If I change the velocity I have to change the reference values in Fluent and I can not find this in the command line options.

Is there a way to let my script to these things? I was trying to do it from a command line in fluent -g but could not find how to do this...

This is an example of my script for two angles of attack:
Code:

rc Airfoil/3D/Fluent_winglet/Wingfinal4.cas o
/define/boundary-conditions/velocity-inlet inlet yes yes no 25.72 no 0 yes no 0.990268 no -0.139173 no 0 no yes 0.1 0.01
/solve/initialize/initialize-flow
/solve/iterate 100000
/file/write-data Airfoil/3D/Fluent_winglet/V25.72AOA-8 o
/report/forces/wall-forces yes 0.139173 0.990268 0 no
/report/forces/wall-forces yes 0.990268 -0.139173 0 no
/report/forces/wall-moments yes 0.25 0 0 0 0 -1 no
rc Airfoil/3D/Fluent_winglet/Wingfinal4.cas o
/define/boundary-conditions/velocity-inlet inlet yes yes no 25.72 no 0 yes no 0.994522 no -0.104528 no 0 no yes 0.1 0.01
/solve/initialize/initialize-flow
/solve/iterate 100000
/file/write-data Airfoil/3D/Fluent_winglet/V25.72AOA-6 o
/report/forces/wall-forces yes 0.104528 0.994522 0 no
/report/forces/wall-forces yes 0.994522 -0.104528 0 no
/report/forces/wall-moments yes 0.25 0 0 0 0 -1 no
exit o

My matlabscript to build the input files:
Code:

clc; clear all; close all
vels=[25.72 30.87 36.01 41.15];%
fid= fopen('script.flin','a');
AOA=[-8 -6 -4 -2 0 2 4 6 8 10 11 12 13];
iter=100000;
tweedried=3;
homefolder='Airfoil/3D/Fluent_winglet/';
casefile='Wingfinal4.cas';
inletname='inlet';
if tweedried==2
    for i=1:length(vels);
        for j=1:length(AOA);
            fprintf(fid,['rc ',homefolder,casefile,' o\n']);
            fprintf(fid,['/define/boundary-conditions/velocity-inlet ',inletname,' yes yes no %g no 0 no %g no %g no yes 0.1 0.01\n'],[vels(i) cos(AOA(j)/360*2*pi) sin(AOA(j)/360*2*pi)]);
            fprintf(fid,'/solve/initialize/initialize-flow\n');
            fprintf(fid,'/solve/iterate %g\n',iter);
            fprintf(fid,['/file/write-data ',homefolder,'V',num2str(vels(i)),'AOA',num2str(AOA(j)),' o\n'],iter);
            fprintf(fid,'/report/forces/wall-forces yes %g %g no\n',[-sin(AOA(j)/360*2*pi) cos(AOA(j)/360*2*pi)]);
            fprintf(fid,'/report/forces/wall-forces yes %g %g no\n',[cos(AOA(j)/360*2*pi) sin(AOA(j)/360*2*pi)]);
            fprintf(fid,'/report/forces/wall-moments yes 0.25 0 0 0 -1 no\n');
        end
    end
else
    for i=1:length(vels);
        for j=1:length(AOA);
            fprintf(fid,['rc ',homefolder,casefile,' o\n']);
            fprintf(fid,['/define/boundary-conditions/velocity-inlet ',inletname,' yes yes no %g no 0 yes no %g no %g no 0 no yes 0.1 0.01\n'],[vels(i) cos(AOA(j)/360*2*pi) sin(AOA(j)/360*2*pi)]);
            fprintf(fid,'/solve/initialize/initialize-flow\n');
            fprintf(fid,'/solve/iterate %g\n',iter);
            fprintf(fid,['/file/write-data ',homefolder,'V',num2str(vels(i)),'AOA',num2str(AOA(j)),' o\n'],iter);
            fprintf(fid,'/report/forces/wall-forces yes %g %g 0 no\n',[-sin(AOA(j)/360*2*pi) cos(AOA(j)/360*2*pi)]);
            fprintf(fid,'/report/forces/wall-forces yes %g %g 0 no\n',[cos(AOA(j)/360*2*pi) sin(AOA(j)/360*2*pi)]);
            fprintf(fid,'/report/forces/wall-moments yes 0.25 0 0 0 0 -1 no\n');
        end
    end 
end
fprintf(fid,'exit o');
fclose(fid);

I run the whole script from a terminal, connected via ssh to the server which has fluent, with:
nohup fluent 3d -t 4 -g -i Airfoil/3D/Fluent_winglet/script.flin &
Edit:
I found a way to edit the reference values via the commandline. It is under /report/reference-values...


All times are GMT -4. The time now is 07:51.