CFD Online Logo CFD Online URL
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

LinkBack Thread Tools Display Modes
Old   May 19, 2009, 14:43
Default Problem in the calculation of function
Senior Member
Antonio Martins
Join Date: Mar 2009
Location: Porto, Porto, Portugal
Posts: 112
Rep Power: 10
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


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

volScalarField func
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
Senior Member
Pawel Sosnowski
Join Date: Mar 2009
Location: Munich, Germany
Posts: 105
Rep Power: 11
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:
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

psosnows is offline   Reply With Quote


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
problem in drag force calculation M.Hasib FLUENT 1 March 16, 2009 13:01
Wall function calculation of tau_wall KRK FLUENT 0 October 30, 2007 14:50
REAL GAS UDF brian FLUENT 6 September 11, 2006 08:23
Warning 097- AB Siemens 6 November 15, 2004 05:41
Stream function in axisymmetrical problem Daniel Siemens 0 September 8, 2003 11:20

All times are GMT -4. The time now is 16:21.