Hi Giuseppe,
I wanna run a test case with a defined initial condition, like position, velocity, pressure, etc, for the particles. Something like a hotstart option. Is there any way to do that?
To be more specific, I wanna run a problem for 20 seconds and then do some modifications on the outputs and use them as input and initial condition for the model, and then run the problem for the next 30 seconds.
Thank You!
Regards,
Alireza
Hi @AlirezaZarei, GPUSPH does support hotstarting simulations (through the HotWriter
and the --resume
options). This feature has been designed with the intent to restart simulations in case of e.g. system errors during long-running simulations, but I believe it can be used also for your intended purpose. My guess is how well it will work depends a bit on what kind of things you will be changing between the “pre-run” and the full run. Could you provide some details?
I want torun a big 3D simulation, but since it is computationally expensive, I was thinking about running it as two separate phases. Phase 1 is running it as a fake 2D case for the first 30 seconds, and then using the output (particles position, velocity, pressure, density, …) of this, and expanding it to 3D and then, in phase 2 running it a 3D case for next 10 seconds which is my interested time to look at the flow.
For this purpose, I need to know how to initialize the particles’ properties. I looked at the GPUSPH website and in the “initializeParticles” subsection, I found the following lines. I think this would be a good starting point.
void ProblemExample::initializeParticles(BufferList &buffer, const uint numParticle)
{
// We access the arrays of the data that we need
double4 *gpos = buffer.getData<BUFFER_POS_GLOBAL>();
float4 *vel = buffer.getData<BUFFER_VEL>();
const ushort4 *pinfo = buffer.getData<BUFFER_INFO>();
// We sweep over all the particles
for (uint i = 0 ; i < numParticle ; i++) {
// and act only on flud particles
if (FLUID(pinfo[i])){
// we get the x coordinate of the particle
double p = gpos[i].x;
// and assign the velocity according to the position
vel[i].z = 0.1*sin(2*M_PI*p);
}
}
}
Hi @AlirezaZarei, the current hotstart functionality in GPUSPH is definitely not designed for such changes in the test case topology. A typical example of the use for the hot start would be to have an initial relaxation phase to let the particles settle, and then start subsequent simulations after the settling, but given the same initial geometry.
The initializeParticles
member function in the test case can be used to arbitrarily override particle properties (this is used e.g. in multi-fluid test cases for the multi-fluid initialization), but I am not sure how you could transfer the particle properties from the results of the 30s fake 2D results. We do have an HDF5 reader to load particles in H5Sph format, but not a writer for the format, and then I guess you’d have to find some way to replicate it for the “across” direction?
So this sounds like one possibility, but there’s some coding work for it to make it work.
Another possibility would be to look into the experimental “repacking” system. This uses a lightweight integrator, so the repacking part is faster, and the end result of the repacking can be used to launch the actual simulation. It’s a bit of an experimental feature, and there’s some pending fixes that need to be integrated still, but it’s also a path to explore.