identifiers::dynamicsIdRegistration missing?

Hi,
I tried to recompile an older palabos shallow water implementation and experienced the following error with PLB v1.0

The line:

[code=“cpp”]
template<typename T, template class Descriptor>
int NLShallowWaterDynamics<T,Descriptor>::id =
identifiers::dynamicsIdRegistration<T,Descriptor>().registerId(“NLShallowWater”);



produces the error:

error: ‘dynamicsIdRegistration’ is not a member of ‘plb::identifiers’

I also could not find the dynamicsIdRegistration or something similar in the identifier name space. 

Could anybody help me how to fix this?

Thanks a lot 
   hansjoerg

Dear Hansjoerg,

I remember this shallow-water code: we wrote it out of curiosity during a workshop, as someone showed us a new LB model for the shallow water equation. We’ve never found the time to complete the implementation, though, and it got included into Palabos by mistake. That’s why we have removed it from more recent versions.

I do not recommend to use this shallow-water code, because it has several issues. There must be a bug somewhere, and it comes without boundary conditions.

We will certainly deliver Palabos with a properly implemented shallow-water model at some point, but this is not a topic with highest priority right now.

Cheers,
Jonas

Hi Jonas,
I got the code from you via a private email conversation quite some time ago.
I got it working and running that time, but had not much time to clean up details of the implementation. I successfully compared the results with a simple single processor code we wrote. The only mistake in the earliest implmentation was that the collision operators did not correspond to the corect directions, thus producing strange results.
After making the change everything looks nice.

I stopped working on the shallow water implementation since and came back to the code recently, when i realised that the
code does not compile anymore with palabos 1.0.
The question posted above was more about the way how the registration of a new model works in palabos now.
It seems that these things changed in palabos since because I could not find anything similar to the
dynamicsIdRegistratio.registerID in the class documentation.
Changing the line to simple
[code=“cpp”]
int NLShallowWaterDynamics<T,Descriptor>::id =1;


works fine, but I'd like to understand what the Id registration actually does and continue adding a body force and
changing the boundary conditions.

Thanks a lot hansjoerg

Dear Hansjoerg,

Although your code appears to run with the line

[code=“cpp”]
int NLShallowWaterDynamics<T,Descriptor>::id =1;



you cannot expect this to work in general: it's a bug.

Every dynamics class in Palabos has a unique identifier, which is provided by a central authority (the [i]dynamicsRegistration[/i] function in [i]core/dynamicsIdentifiers.h[/i]).

This central authority also provides means to fully serialize and un-serialize dynamics objects. This is important for parallelism: imagine that, for example you switch a cell from BGK to BounceBack on the boundary of a domain on one processor. The processors that hold the neighboring domains must be informed of this change (that's why each dynamics class needs a unique ID). If furthermore you change the data of the dynamics object (e.g. change the relaxation time locally), Palabos will use serialization - deserialization to stream this change through the network.

Serialization of dynamics objects is one of the more advanced aspects of Palabos, from a software engineering standpoint, but it is extremely useful. In also makes it possible to fully checkpoint a lattice, with not only the populations but also the nature and the content of the dynamics.

The following is an approach to the implementation of new dynamics that always works:

1. Implement the [i]serialize()[/i] and [i]deserialize()[/i] function in a way to fully save and restore the data of your dynamics (as examples, see the dynamics classes in [i]isoThermalDynamics.hh[/i]).

2. Implement a constructor which takes, as only argument,  an object of type [i]HierarchicUnserializer&[/i], and with the following implementation:
[code="cpp"]
template<typename T, template<typename U> class Descriptor>
MyDynamics<T,Descriptor>::MyDynamics(HierarchicUnserializer& unserializer)
    : IsoThermalBulkDynamics<T,Descriptor>((T)1) // Default construct the parent class
{
    unserialize(unserializer); // Restore the object properly.
}

  1. Assign the unique ID to your class with a line akin to the following:

[code=“cpp”]
template<typename T, template class Descriptor>
int MyDynamics<T,Descriptor>::id =
meta::registerGeneralDynamics<T,Descriptor,MyDynamics<T,Descriptor> >(“MyDynamics”);



The string you provide to the [i]registerGeneralDynamics[/i] function must also be unique, and is used by Palabos to transfer checkpoint files from one architecture to another.

As I said, this topic is a little bit sophisticated, but as always there is no free lunch...

Cheers,
Jonas