# Where to access formulas?

I find these constants in the Run file:

And also in the "JSph.h" source file, but can't figure out how to find how DualSPHysics calculates it.

Kind regards

I find these constants in the Run file:

And also in the "JSph.h" source file, but can't figure out how to find how DualSPHysics calculates it.

Kind regards

## Comments

Thanks for your time, but unfortunately this confuses me a bit, since when I run the floating test case I get different values depending on dp (initial particle spacing). Here are the screenshots from run file with dp = 0,025 m:

If I then do a simulation with dp = 0,0125:

None of these values correspond with the GitHub page:

Cs=0.12

CI=0.0066

Have I misunderstood something - I thought they were treated as constant in DualSPHysics?

Kind regards, Ahmed

You can read that in the theory and the link I sent before.

Note that SPS means sub-particle scale model, so that, some ctes are computed depending on the scale!

Regards

Alex

I am sorry but I am still confused. When I read the wiki page this is what I see:

According to the wiki page the constants are set as Cs=0.12, CI=0.0066 and when I look through the code (JSph.h):

So here I would expect to get the values as in the wiki, but I do not as seen in my previous answer.

I understand that turbulent eddy viscosity variates with particle spacing and therefore the stress tensor also variates, but I expect the Smagorinsky and Blinn constants to be the same as in the wiki, which they are not.

Of course it could be I am still misunderstanding something and that is why I hoped it would be possible to see the exact calculation of the constants in the DualSPHysics code - I've been trying to look through the source files in the DualSPHysics folder but I can't find the place where the constants are defined or calculated - I hope you could guide me to the right place.

Thanks for taking time to answer.

Kind regards, Ahmed

Let us take a look

By looking through Dalrymple 2006 and 2004 I will note that they describe C_I = 0.00066 and not C_I = 0.0066 as in the DualSPHysics wiki.

The way the magnitude, |bar(S)| is calculated in the wiki is also wrong according to Dalrymple 2006 it should be done as:

Maybe some kind of formatting went wrong since "0.5" is infront in the wiki.

In the calculation of the sub-particle stress tensor, at the end |S|^2 is added which doesn't correspond with the formula given in Dalrymple 2006 (equation 10).

This could be my mistake if I am misunderstanding something in the tensor notation, so sorry for that if it is.

I am just trying to understand the SPH method and how it is implemented in DualSPHysics, so that is why I am spending so much time on these issues.

Kind regards, Ahmed

The correct value of C_l is 0.0066. The paper Dalrymple and Rogers (2006, Coastal Engineering) contains a typographical error. The value of C_l = 0.0066 comes from Wang et al. (2001, reference is given below):

SpsBlin = Blin_const = twoThirds*0.0066*dp*dp

Shanwu Wang, Shih-Yang Hsieh, Vigor Yang, "Numerical Simulation of Gas Turbine Swirl-Stabilized Injector Dynamics", AIAA 2001-0334.

You are also correct the equation for |

S| on the wiki is not correct. it should beThe bars are dropped for convenience.

For the value of Cs, this is always a tricky one and you are right to be careful. The

confusion arises because many people use a dynamic value of Cs that varies throughout a simulation - they then tend to replace Cs^2 by another symbol confusingly also C or Cs. So, in the papers I sent you, they use Cs, but as an example you can see that in the following

text on google books by Herring & Williams "Lecture Notes on Turbulence", they use Cs^2 with a value of Cs~=0.1-0.2.

I hope this helps,

Ben

It cleared up some confusion for me, since the constants in the DualSPHysics wiki are stated as just constants and not formulaes.

1. SpsBlin = (2/3)*C_I*dp*dp, where C_I is 0.0066

Which I understand, but I am having trouble with Smagorinsky still. According to wikipedia I find that:

And as you state Cs should be between 0.1-0.2. But in DualSPHysics simulation SpsSmag is different according to particle size. So do you happen to know where I can find the formulation for SpsSmag?

I hope my question makes sense.

Kind regards

@Asalih3d I know this is a pretty old post but were you able to locate it? In case anyone still needs it ,SpsSmag and SpsBlin are defined in JSph.cpp

SpsSmag=float(pow((0.12*

dp_sps),2)); here 0.12 is the Cs.If Lam+SPS is activated,

ComputeSpsTauis called inJSphGpuSingle.cpp,ComputeSpsTauis defined in JSphGpuker.cuand it callsKerComputeSpsTauwhich also is defined inJSphGpuker.cu@circles

Thank you very much!

Nice to know where they are located, I actually never found it at the time I think, where the calculations were performed.

Kind regards