Accessing external fields

Hello everyone,

I have created a descriptor with an additional external field. The content of this field is modified within a dataprocessor. Inside the data processor, I have no troubles accessing the external field like this

[code=“cpp”]
Cell<T,Descriptor>& cell = lattice.get(someX,someY) ;
T someVariable = *(cell.getExternal(Descriptor::ExternalField::myNewExternalVariable)) ;



However, when I access it in my main function in the same way, it always returns zero. Is there another way to access the contents of an external field which is modified inside a dataprocessor (without recalculating it) or am I missing something entirely here?


Regards,

kk

Hello everyone,

the problem at hand is actually pretty simple… For those interested, it is not possible to access external fields directly through the MultiBlockLattice but through a data processor which accesses them through the BlockLattice.

Regards,

kk

Hi
I have trouble accessing different parameters like uSqr. I know it is a simple question but I do not know the solution.
I am working on the Segregation problem. In my case, I use ShanChenExternalForceBGKdynamics class in which the (uSqr) is defined as uSqr += util::sqr(j[iD]invRho + 0.5force[iD]);. So I need see the values and plot the uSqr value in my main program using image writer. How it s possible?

Best Regards

Hi m.khatoonabadi,

if it is only the uSqr you are interested in, you could write a data processor that couples your lattice (MultiBlockLattice2D in your main function) to a scalarfield (MultiScalarField2D in your main function). Inside the dataprocessor, you can access all the information related to each cell, i.e. external momentum, external force, distributions, etc. You can then calculate u_phys[iD] = j[iD]invRho + 0.5force[iD] and subsequently of course u_phys_sqr and store it in the scalarfield. You will then be able to access this information in your main routine.

In my opinion, it would be better to couple the lattice to a tensorfield and calculate the velocity vectors (for every cell) which can then also be accessed in your main routine.

A third solution would be to modify the shan chen dataprocessor and the dynamics class you are using (in the segregation example this is: ExternalMomentBGKdynamics) in such a way that during the collision the correct equilibrium velocity is used and the “computeVelocity” function of the dynamics class returns the physical velocity. This is however more complicated to accomplish and would require some more in depth palabos knowledge.

Regards,

kk

Hi KK
Thank you very much for your reply and I am so sorry for my late response. Your tip is really helpful although I have not been able to do what you mentioned, I think it is not so difficult to access different parametersI need some time.Since I am reading Palabos tutorials about data evaluation and data processor from the following links.

http://www.palabos.org/documentation/userguide/data-evaluation.html#data-evaluation

http://www.palabos.org/documentation/userguide/appendix-functions.html#appendix-data-analysis

Best Regards
S.M.Khatoonabadi