I am trying to use the dynamic object to access the particle distribution function on a cell but I am having problems.
Now, since the distribution function saved in openlb is “f_i - t_i”, I want to access this function and then add the respective weight function, to give me the actual distribution function.
I proceeded as shown below for a D3Q19 lattice.
T *f;
T Mx; //Real particle distribution function;
lattice.get(iX, iY, iZ).computePopulations(f);
for(int i=0; i<DESCRIPTOR<T>::q; ++i){
Mx = (f[i] + DESCRIPTOR<T>::t[i])
}
This compiles successfully. However, on running it on my mac system, it terminates with “bus error”. I used gdb to debug and I get the following error messages
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000258
0x000046d4 in olb::Dynamics<double, olb::descriptors::D2Q9Descriptor>::computePopulations (this=0xbffff840, cell=@0x27e220, f=0x258) at dynamics.hh:45
45 f[iPop] = cell[iPop
Ideas on how to do this will be appreciated