CFD Online Logo CFD Online URL
Home > Forums > OpenFOAM Programming & Development

Dimension checking for internalField() / Field()

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

LinkBack Thread Tools Display Modes
Old   August 29, 2011, 23:28
Default Dimension checking for internalField() / Field()
New Member
Join Date: Jun 2011
Posts: 17
Rep Power: 8
timbojones is on a distinguished road

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 is offline   Reply With Quote

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

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:

You'll see you need dimensionedInternalField() if you want the dimensions.
Laurence R. McGlashan :: Website
l_r_mcglashan 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
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 08: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 09:50

All times are GMT -4. The time now is 17:28.