CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > FLUENT

Scripting Fluent, reference values?

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Unneoetech

Reply
 
LinkBack Thread Tools Display Modes
Old   May 9, 2011, 11:57
Default Scripting Fluent, reference values?
  #1
New Member
 
Nick
Join Date: May 2011
Posts: 4
Rep Power: 6
Unneoetech is on a distinguished road
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...
Centurion2011 likes this.

Last edited by Unneoetech; May 9, 2011 at 17:05.
Unneoetech is offline   Reply With Quote

Reply

Tags
command line, scripting

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
It would be wonderful if a tool for FoamToTecplot is available luckyluke OpenFOAM Post-Processing 165 November 27, 2012 07:54
Compiling new Solver with wmake lin123 OpenFOAM 3 April 13, 2010 14:18
Simulation of a single bubble with a VOF-method Suzzn CFX 18 October 2, 2009 04:18
mass flow in is not equal to mass flow out saii CFX 2 September 18, 2009 08:07
Error with Wmake skabilan OpenFOAM Installation 3 July 28, 2009 00:35


All times are GMT -4. The time now is 20:26.