Dear developer, I want to write a particle generator in mfix, every once in a while to throw some particles into a certain area, any suggestions? Where should I add code to the subroutine?
This can be done with a UDF, via the file
rotating_drum_3d for a sample of a simulation using
usr1_des.f but what you are doing will be a little different. When inserting new particles you have to make sure they do not overlap with any existing particles. And if you are doing DMP you will have to deal with broadcasting the information to all nodes.
Thank you for your reply. My idea is to throw a particle into an area, wait until the fluid has washed away all the particles in that area, put the particle back in, and make the velocity of the particle equal to the velocity of the fluid in that location. Therefore, neither the time nor the speed at which the particles will enter cannot be known in advance. But I don’t know how to do that. Are there tutorials or similar examples for writing UDFs?
Hello, I have solved all the problems except the parallel. I want to know, why should the newly added particle information be broadcast to all nodes? The newly added particles will not be in all processes, and if broadcast to all nodes, will not cause an error? In addition, if I do this directly, for example: call bcast(DES_POS_NEW, pe_io), it will cause an error. I feel that this is not the right thing to do, that all particles of information should not be made available to every process, but I don’t know how to do that anymore. Could you give me some more advice? Thanks!
You are right… not all nodes know about all particles … you have to respect the domain decomposition.
Thanks very much. I am reading read_particle_input.f, and I find that the steps here are basically the same as what I do. Particle formation, particle scattering, buffer building, data sending and receiving, particle unpacking, balabala. I’m working on how to send all the threads’ particle information to the main thread, which should be solved soon.
In the process of all threads sending particle information to the root thread, there is the following code:
ALLOCATE (dProcBuf(LOCAL_CNT) )
IF(myPE == PE_IO) THEN
That is, if not in the root thread, the size of the receive buffer is defined as 10. Does that number mean anything? Or is it just random?