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

Operate on volScalarField as whole v access elements

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 14, 2012, 08:19
Default Operate on volScalarField as whole v access elements
  #1
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
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, 08:25
Default
  #2
Senior Member
 
Awais Ali
Join Date: Feb 2010
Location: Germany
Posts: 128
Rep Power: 17
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, 12:35
Default
  #3
Senior Member
 
Adhiraj
Join Date: Sep 2010
Location: Karnataka, India
Posts: 187
Rep Power: 15
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


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
[ICEM] Hybrid mesh for 2D boundary layer Bigio ANSYS Meshing & Geometry 33 November 18, 2019 09:15
Access a volScalarField from BC code Hisham OpenFOAM Programming & Development 6 November 25, 2011 15: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 15:39.