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

How to access the members of a "volScalarField"?

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 2 Post By kmooney

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 5, 2012, 06:19
Default How to access the members of a "volScalarField"?
  #1
New Member
 
Nilesh
Join Date: Sep 2012
Posts: 7
Rep Power: 13
u396852 is on a distinguished road
I have to compare the individual values of a volScalarField. It gives error saying that operator (>) is not defined for volScalarField varible. How do I access the each member of the volScalarField varialbe. Also, there is function which calculates shearStress() and stores in volScalarField. How to access the each member of that function?
u396852 is offline   Reply With Quote

Old   November 5, 2012, 16:59
Default
  #2
Senior Member
 
kmooney's Avatar
 
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 17
kmooney is on a distinguished road
Quote:
Originally Posted by u396852 View Post
I have to compare the individual values of a volScalarField. It gives error saying that operator (>) is not defined for volScalarField varible. How do I access the each member of the volScalarField varialbe. Also, there is function which calculates shearStress() and stores in volScalarField. How to access the each member of that function?
You can access the entries of a volScalarField as such:
Code:
volScalarField myVSF;

scalarField intVSF = myVSF.internalField();

forAll(intVSF, cellI)
{
    intVSF[cellI] = whatYourAfter;
}
Note: A volScalarField has both internal and patch boundary values to access.
kmooney is offline   Reply With Quote

Old   November 9, 2012, 00:38
Default
  #3
New Member
 
Nilesh
Join Date: Sep 2012
Posts: 7
Rep Power: 13
u396852 is on a distinguished road
thank a lot kmooney for your reply it indeed works. thanks for the help.
u396852 is offline   Reply With Quote

Old   November 27, 2012, 06:35
Default access the values of volScalarField
  #4
New Member
 
Nilesh
Join Date: Sep 2012
Posts: 7
Rep Power: 13
u396852 is on a distinguished road
Kmooney now with your suggestion i am able to define the intVSF but when i try to access the values of intVSF using the following code it gives errors. i am copying the error message at the end could you help understanding it

Code:

volScalarField shearstress = old_visc*strainRate(); /* old_visc is VSF and strainRate() is function which returns shear rate which is also VSF */

volScalarField shearrate = strainRate();

scalarField intVSF = shearstress.internalField();
scalarField intVSF1 = shearrate.internalField();

if ( current_time.value() < 0.0001)
return old_visc;

else
{
forAll(intVSF1, celll)
{
if (intVSF1[celll] < scalar(0.001))
return old_visc;

else

if (intVSF1[celll] > scalar(10000))
return old_visc;

else {
if (intVSF[celll] > scalar(temp)) /* temp is calculated in the code */

return nu0_ /nu0_ is defined in the code
else
return old_visc;
}
}



ERROR:

[compute-0-25.local:16834] *** An error occurred in MPI_Recv
[compute-0-25.local:16834] *** on communicator MPI_COMM_WORLD
[compute-0-25.local:16834] *** MPI_ERR_TRUNCATE: message truncated
[compute-0-25.local:16834] *** MPI_ERRORS_ARE_FATAL (goodbye)
[compute-0-3.local:01034] *** An error occurred in MPI_Recv
[compute-0-3.local:01034] *** on communicator MPI_COMM_WORLD
[compute-0-3.local:01034] *** MPI_ERR_TRUNCATE: message truncated
[compute-0-3.local:01034] *** MPI_ERRORS_ARE_FATAL (goodbye)
[compute-0-37.local:09710] *** An error occurred in MPI_Recv
[compute-0-37.local:09710] *** on communicator MPI_COMM_WORLD
[compute-0-37.local:09710] *** MPI_ERR_TRUNCATE: message truncated
[compute-0-37.local:09710] *** MPI_ERRORS_ARE_FATAL (goodbye)
[compute-0-23.local:00497] *** An error occurred in MPI_Recv
[compute-0-23.local:00497] *** on communicator MPI_COMM_WORLD
[compute-0-23.local:00497] *** MPI_ERR_TRUNCATE: message truncated
[compute-0-23.local:00497] *** MPI_ERRORS_ARE_FATAL (goodbye)
[compute-0-38.local:14813] [0,0,0] ORTE_ERROR_LOG: Timeout in file base/pls_base_orted_cmds.c at line 275
[compute-0-38.local:14813] [0,0,0] ORTE_ERROR_LOG: Timeout in file pls_rsh_module.c at line 1166
[compute-0-38.local:14813] [0,0,0] ORTE_ERROR_LOG: Timeout in file errmgr_hnp.c at line 90
mpirun noticed that job rank 0 with PID 14908 on node compute-0-38 exited on signal 15 (Terminated).
[compute-0-38.local:14813] [0,0,0] ORTE_ERROR_LOG: Timeout in file base/pls_base_orted_cmds.c at line 188
[compute-0-38.local:14813] [0,0,0] ORTE_ERROR_LOG: Timeout in file pls_rsh_module.c at line 1198
--------------------------------------------------------------------------
mpirun was unable to cleanly terminate the daemons for this job. Returned value Timeout instead of ORTE_SUCCESS.
--------------------------------------------------------------------------
0/: Permission denied.

size 0 is not equal to the given value of 11037
file: /home/u396852/OpenFOAM/u396852-1.5/paintCases/Ellisrun-0.001fix-time-step/processor0/2e-05/visco_old from line 18 to line 63.
From function Field<Type>::Field(const word& keyword, const dictionary& dict, const label s)
in file /share/apps/devel/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/Field.C at line 224.
FOAM exiting
u396852 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
Getting access to mesh (fvMesh) via object registry Chris Lucas OpenFOAM Programming & Development 18 January 15, 2024 02:57
[DesignModeler] DesignModeler Scripting: How to get Full Command Access ANT ANSYS Meshing & Geometry 53 February 16, 2020 15:13
Online libraries - with access to Journals momentum_waves Main CFD Forum 2 December 12, 2007 10:08
Error: access: unbound variable,HELP sudhakar FLUENT 0 January 15, 2007 23:21
Access Density Allan Walsh FLUENT 3 October 4, 2005 07:55


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