CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Problem in the calculation of function

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2009, 14:43
Default Problem in the calculation of function
  #1
Senior Member
 
Antonio Martins
Join Date: Mar 2009
Location: Porto, Porto, Portugal
Posts: 112
Rep Power: 17
titio is on a distinguished road
Send a message via MSN to titio Send a message via Skype™ to titio
Hi all,

I have a problem where I have to calculate the value of a scalar function func, in the form

func=1+A*tr(tensor1)

where A is a scalar constant, tensor is a volume tensorial field, and func is scalar field.

In the createFields.h file I included the following line

volScalarField trac_tensor
(
IOobject
(
"trac_tensor",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
tr(tensor)
);

volScalarField func
(
IOobject
(
"func",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
1.0 + A*trac_tensor
);

I have considered that the trace of tensor generates a scalar field. Although it compiles fine and the code runs, when I check the values given by func_lin, I noted that it is always returning one. The value of A is defined and the components of the tensor change, but, func_lin never changes.

Am i doing something wrong? How I should do the calculation of func?

Antonio Martins
titio is offline   Reply With Quote

Old   May 20, 2009, 09:18
Default
  #2
Senior Member
 
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 18
psosnows is on a distinguished road
the code looks fine

one question though- are you updating the values during the simulation?

the createFields.h is called once at the beginning of the simulation before the main loop. It initiates the values, sets them for automatic reading/writing but does not set any automatic refreshment of the values.

maybe if you put something like:
Code:
trac_tensor=tr(tensor);
func=1.0 + A*trac_tensor;
inside the main loop you will get your results

otherwise it will be always only the ones which were initiated

Pawel
psosnows is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in drag force calculation M.Hasib FLUENT 1 March 16, 2009 12:01
Wall function calculation of tau_wall KRK FLUENT 0 October 30, 2007 13:50
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Warning 097- AB Siemens 6 November 15, 2004 04:41
Stream function in axisymmetrical problem Daniel Siemens 0 September 8, 2003 11:20


All times are GMT -4. The time now is 22:23.