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

Dimension checking for internalField() / Field()

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 29, 2011, 23:28
Default Dimension checking for internalField() / Field()
  #1
New Member
 
Join Date: Jun 2011
Posts: 22
Rep Power: 14
timbojones is on a distinguished road
Hello,

I'm still pretty new to OpenFOAM, but have been developing a couple of solvers of late. In my most recent work, I have an internal mass source that's introduced into an arbitrary number of cells based on a flag. As part of this operation, I need to calculate the total volume over which the mass source is added and then weight the mass source in each cell by the cell volume divided by the total volume over which the mass source acts.

In implementing this scheme, I've used the .internalField() along with mesh.V() to build up the weighted mass source. It all seems to be going OK. However, I do have a couple of questions based on what I have right now.

1) Are individual elements of a volScalarField accessed within a forAll loop treated as dimensionless? For example, I need to define totalVol as a scalar to make the assignment totalVol += mesh.V()]celli] within a forAll loop (with celli as the iterator).

2. Perhaps along a similar line, are the dimensions of assignments made using .internalField() or .Field() checked? It seems that the dimensions of the result are whatever dimensions have been assigned to the LHS field.

Hopefully this is understandable to readers out there and someone can help me to understand things a bit better.

Thanks and Regards,
timbojones
timbojones is offline   Reply With Quote

Old   August 30, 2011, 11:59
Default
  #2
Senior Member
 
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23
l_r_mcglashan will become famous soon enough
Hi,

1) Using [ ] will not have dimensions attached. You can use sum or gSum(if you'll be running in parallel) instead of explicitly looping.

2) Take a look at: http://foam.sourceforge.net/docs/cpp/a00709.html

You'll see you need dimensionedInternalField() if you want the dimensions.
__________________
Laurence R. McGlashan :: Website
l_r_mcglashan 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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01
Problems in compiling paraview in Suse 10.3 platform chiven OpenFOAM Installation 3 December 1, 2009 07:21
Help%7e%7einstall openfoam13 on fc5%7e%7e aderliner OpenFOAM Installation 2 September 11, 2006 07:24
Gerris software installation mer Main CFD Forum 2 November 12, 2005 08:50


All times are GMT -4. The time now is 13:04.