# Spatially changing external forces

Hi!

I'm learning DualSPHysics to test it on sea ice simulation. Basically I want a 2D simulation on particles using a suitable rheology, forced by surface winds. The wind forcing is spatially and temporally variable, preferably provided as a 3D (x, y, time) mesh of drag vectors.

I am now quite familiar with the ExternalForces example, but there the external forces are spatially uniform. It is said in the documentation, that the capability for spatially and temporally varying external forces has existed since version 3.0, but I can't seem to find any information on how (except for the very limited case of angular forces that arguably vary in a spatial sense).

Is it possible to specify arbitrary spatially varying forces, and how?

-Jonni Lehtiranta, Operationan Oceanography group, Finnish Meteorological Institute

• In this case, if you want to apply external forces for a given spatial domain, then you will have to implement that and you need to modify the source code.

The current implementation will allow you to apply external forces to a given set of particles defined by the label "mk".

Regards

• Thank you for the reply!

I suppose it shouldn't be too hard to modify the current code to only apply external forces within some bounding box, defined in (x, y, z) coordinates. This would mean I could put together a coarse grid of force vectors in a straightforward manner that is easy to make automatic.

Or, alternatively, to apply an external force universally, but in a spectral manner (say, force being multiplied by sin(A*x)). Thus, any grid could be represented as a sum of waves.

Any comments on if these ideas make sense? Or pointers on how to approach the task? I'd be very grateful :).

• Seems to me I would need to modify KerFtCalcForces(). One problem though - the resulting external force in my case depends on the velocity difference of the prescribed wind and the fluid particle. I am not sure the fluid particle velocity is a parameter to that function.

Is there documentation describing the input parameters or naming conventions used in naming them?

-- JSphGpu_ker.cu:

//------------------------------------------------------------------------------ /// Adds acceleration from particles and from external forces to ftoforces[]. /// Anhade aceleracion de particulas y de fuerzas externas en ftoforces[]. //------------------------------------------------------------------------------

global void KerFtCalcForces(unsigned ftcount,float3 gravity, const float ftomass, const float3 ftoangles, const float4 ftoinertiaini8,const float ftoinertiaini1, const float3 ftoforcessum, float3 ftoforces,const float3 *ftoextforces) //fdata={pini,np,radius,mass}