Dear Axel,
Thanks for the reply. Pardon me not replying in the same style, I can't
change my webmail interface to do so.
I've got using lammps as a shared lib which is called from openfoam. Kinda
like CFDEM-LIGGGHTS but with the perks of modern lammps features such as
mpi load balancing and openmp threading (kudos for creating that, it helps
me a lot in optimizing MPI communication).
I want to pass information from openfoam to lammps (interpolated field
values, velocity, pressure gradient etc) and save them in a lammps dump
file using dump/custom. The idea here is I can use the lammps parallel IO
when running on 100+ mpi ranks.
At the moment I have a fix that applies fluid forces such as drag, virtual
mass force and others to the particles and this works ok. All the variables
are transferred through additional library functions.
The options I see now are
- Making a new atom style which include the desired properties (but let's
try to avoid that)
- Setting up the variables in the lammps input script (easy but error
prone, I'd prefer the next option)
- Sending commands to lammps from OpenFOAM via the lammps_command function
to create vars and use the find_custom() you mentioned
The reason I like the last option is it allows me to automate the the
creation of new vars, dump file content and freq on the openfoam side.
If you have any other ideas I'd love to hear them.
if you have the data already available in your custom fix, you can just
expose it from the fix directly.
if you set the following flags in the fix constructor:
peratom_flag = 1;
size_peratom_cols = nvalues;
with nvalues being the number of custom values per atom. then you just
need to allocate and fill the Fix::array array with the suitable data and
you are done.
now you can access all that data in dumps via f_ID[1], f_ID[2], f_ID[3],
etc. or simply f_ID[*] for all of them.
have a look at, for example, fix_ave_atom.cpp, which acquires all kinds of
per-atom data from computes, fixes, and variables, averages them and
exposes them to dumps with the same interface. if you strip out the parts
where the data is retrieved, it is fairly simple to follow. in your case,
you may not even need the parts where the averaged data is migrated between
processors with the atoms, just ensure that Fix::array is properly resized
as needed and then copy over the data.
axel.