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

Operate on volScalarField as whole v access elements

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

Reply
 
LinkBack Thread Tools Display Modes
Old   January 14, 2012, 09:19
Default Operate on volScalarField as whole v access elements
  #1
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
Hi all,
If I have a volScalarField that is formed by doing something (adding, dividing, taking square roots etc) of some other volScalarFields, should I do those operations element by element, or on the whole thing at one go?
I have the element by element version implemented, and was wondering if I could get a speedup by using the other option.
adhiraj is offline   Reply With Quote

Old   November 29, 2012, 09:25
Default
  #2
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 127
Rep Power: 8
owayz is on a distinguished road
Send a message via MSN to owayz
Hi adhiraj,
Yes you can do it as a whole. For some example you can see the yPlus utility and check how yPlus is being calculated.
Can you kindly share how did you do all the operations element wise.
regards,
Awais
owayz is offline   Reply With Quote

Old   November 29, 2012, 13:35
Default
  #3
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Pennsylvania, United States
Posts: 101
Rep Power: 6
adhiraj is on a distinguished road
Yes, I found that I can operate on the whole thing at once, too.
I did that and I don't know if it is more efficient or anything--the code is certainly cleaner and easier to read.
I did something like
Code:
A.internalField()[celli]=std::sqrt(B.internalField()[celli]);
or similar.
adhiraj is offline   Reply With Quote

Reply

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
[ICEM] Hybrid mesh for 2D boundary layer Bigio ANSYS Meshing & Geometry 32 January 9, 2014 11:26
Access a volScalarField from BC code Hisham OpenFOAM Programming & Development 6 November 25, 2011 16:33
Penetrating elements in extruded mesh Michael P CFX 2 May 20, 2005 08:06
CFX4.3 -build analysis form Chie Min CFX 5 July 12, 2001 23:19


All times are GMT -4. The time now is 06:03.