|
[Sponsors] |
Subscripted value is neither array nor pointer |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
New Member
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 8 ![]() |
Im having some trouble trying to impose the movement in two directions.
My UDF is the following: DEFINE_CG_MOTION(OW_fall, dt, vel, omega, time, dtime) { /* reset velocities */ NV_S(vel[0], =, 40.0); NV_S(vel[1], =, -1.5); NV_S(omega, =, 0.0); if (!Data_Valid_P()) return; } I get an error of the type "error: subscripted value is neither array nor pointer". Apparently it is related with the definition of the array vel which I think is defined by default as a 3-d array. Any suggestions? Thnaks.
__________________
Loading signature... |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 ![]() |
The NV_S macro is for operating on a vector with a scalar. For example in 2-D, NV_S(vel,=,0.0) is the same as applying vel[0]=0.0 and vel[1]=0.0.
For your case, the non-uniform velocity components could be applied with: Code:
vel[0] = 40.0; vel[1] = -1.5; |
|
![]() |
![]() |
![]() |
![]() |
#3 |
New Member
Enrique Pérez Heredia
Join Date: May 2018
Location: Madrid, Spain.
Posts: 16
Rep Power: 8 ![]() |
Thank you 'e'. I tried your way and it worked.
It is quite strange because after this case I was doing a 2-D simulation using this UDF DEFINE_CG_MOTION(OW_fall, dt, vel, omega, time, dtime) { /* reset velocities */ NV_S(vel[1], =, -5.0); NV_S(omega, =, 0.0); if (!Data_Valid_P()) return; } Thank you againand see you around.
__________________
Loading signature... |
|
![]() |
![]() |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to define the two-dimensional array in OpenFOAM use List | SH_Zhong | OpenFOAM | 2 | December 29, 2016 01:20 |
[General] Contour plot: celldata2pointdata | dmaz | ParaView | 1 | April 28, 2014 17:05 |
multi-dimensional dynamic array allocation for multi-block solver using fortran | mano | Main CFD Forum | 4 | June 25, 2012 22:01 |
An unknown array definition in fortran | morteza08 | Main CFD Forum | 0 | June 20, 2011 05:32 |
ODETest.C Compiling failed in version 1.6 | sxhdhi | OpenFOAM Bugs | 4 | April 27, 2010 06:36 |