|August 29, 2011, 23:28||
Dimension checking for internalField() / Field()
Join Date: Jun 2011
Posts: 17Rep Power: 7
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,
|August 30, 2011, 11:59||
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370Rep Power: 15
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
|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|