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

How can you create a dynamic/calculated internalField?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 10, 2014, 04:03
Default How can you create a dynamic/calculated internalField?
  #1
New Member
 
Martin Pedersen
Join Date: Sep 2014
Location: Xi'an, China
Posts: 3
Rep Power: 11
Dvergr is on a distinguished road
Hi!

I am currently setting up some airfoil simulations at different angles of attack. For this I want to be able to easily rotate the U.internalField to simulate changing angles of attack. Obviously, I could just calculate the new U vector by hand, but it would more practical to automatically calculate the new internalField-vector based on a free stream velocity and an angle of attack.

So instead of
Code:
internalField	uniform (2 0 0);
I would prefer either importing the values from a different file
Code:
#include 	"freeStream"
internalField	uniform (uInfX uInfY 0);
or simply calculate the values in the U file itself. And perhaps even be able to define the angles of attack in the shell script which runs my case.

In any case I need to calculate the velocity components in C++ code. I have tried using the codeStream directive, but I keep getting errors. The simplest case I can setup is one without any actual calculations:

Code:
internalField	#codeStream
{
	code
	#{
		os << (0, 0, 0);
	#};
};
But this produces the following error:

Code:
Create time

Create mesh for time = 0

Reading field p

Reading field U

Using #codeStream at line 21 in file "/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/0/U"
Using #codeStream with "/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/dynamicCode/platforms/linux64GccDPOpt/lib/libcodeStream_f4e00eed56f471723793acc5dad98c5aeb257006.so"
Creating new library in "dynamicCode/_f4e00eed56f471723793acc5dad98c5aeb257006/platforms/linux64GccDPOpt/lib/libcodeStream_f4e00eed56f471723793acc5dad98c5aeb257006.so"
Invoking "wmake -s libso /home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/dynamicCode/_f4e00eed56f471723793acc5dad98c5aeb257006"
wmakeLnInclude: linking include files to ./lnInclude
ln: failed to create symbolic link `./codeStreamTemplate.C': Read-only file system
Making dependency list for source file codeStreamTemplate.C
/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/0/U.#codeStream: In function ‘void Foam::codeStream_f4e00eed56f471723793acc5dad98c5aeb257006(Foam::Ostream&, const Foam::dictionary&)’:
/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/0/U.#codeStream:25:11: warning: left operand of comma operator has no effect [-Wunused-value]
/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/0/U.#codeStream:25:14: warning: right operand of comma operator has no effect [-Wunused-value]
'/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/dynamicCode/_f4e00eed56f471723793acc5dad98c5aeb257006/../platforms/linux64GccDPOpt/lib/libcodeStream_f4e00eed56f471723793acc5dad98c5aeb257006.so' is up to date.
--> FOAM Warning : 
    From function Field<Type>::Field(const word& keyword, const dictionary&, const label)
    in file /home/opencfd/OpenFOAM/OpenFOAM-2.3.0/src/OpenFOAM/lnInclude/Field.C at line 318
    Reading "/home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/0/U" from line 18 to line 46
    expected keyword 'uniform' or 'nonuniform', assuming deprecated Field format from Foam version 2.0.


--> FOAM FATAL IO ERROR: 
Expected a '(' while reading VectorSpace<Form, Cmpt, nCmpt>, found on line 0 the label 0

file: /home/mpedersen/Documents/internship/OpenFOAM/DU97/DU97_simpleFoam/0/U.internalField at line 0.

    From function Istream::readBegin(const char*)
    in file db/IOstreams/IOstreams/Istream.C at line 94.

FOAM exiting
It seems to be complaining about several things; a Read-only file system when using wmake, uniform/non-uniform problem (I don't know where to define this when using #codeStream), and an IO error.

Does anybody have an idea how to solve these errors, or any general tips on how to define a dynamic internalField?

I am very new to OpenFOAM and CFD in general, so any help would be much appreciated
Dvergr 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
create the file *.foam phongstar OpenFOAM 12 October 14, 2018 18:06
[GAMBIT] How to plot S pipe mariam.sara ANSYS Meshing & Geometry 36 November 7, 2013 15:22
[ANSYS Meshing] is it possible to create virtual edges on the blades er_ijaz ANSYS Meshing & Geometry 0 November 3, 2013 05:15
[DesignModeler] Design Modeller create surface papis ANSYS Meshing & Geometry 0 October 31, 2013 13:52
About create interface! xinzhiyu2008 STAR-CCM+ 2 August 6, 2010 20:47


All times are GMT -4. The time now is 14:28.