# Query regarding force calculation

Hello all,

I am calculating wave loading on coastal structures. I am getting wrong results.

My xml file includes --

```					<!-- Piston -->
<setdrawmode mode="full" />
<setmkbound mk="1" />
<drawbox>
<boxfill>solid</boxfill>
<point x="4" y="1.0" z="0.0" />
<size x="0.05" y="4.0" z="4.0" />
</drawbox>

<!-- Flume -->

<!-- Basin -->
<setdrawmode mode="face" />
<setmkbound mk="0" />
<drawfilestl file="basin.stl" objname="basin" autofill="false">
<drawscale x="0.001" y="0.001" z="0.001" />
<drawmove x="17.05" y="1" z="0" />
</drawfilestl>

<!-- Building 1 -->
<setdrawmode mode="face" />
<setmkbound mk="2" />
<drawfilestl file="building.stl" objname="building1" autofill="false">
<drawscale x="0.001" y="0.001" z="0.001" />
<drawmove x="25.79" y="1.25" z="0.795" />
</drawfilestl>

<!-- Building 2 -->
<setdrawmode mode="face" />
<setmkbound mk="3" />
<drawfilestl file="building.stl" objname="building2" autofill="false">
<drawscale x="0.001" y="0.001" z="0.001" />
<drawmove x="25.79" y="2.05" z="0.795" />
</drawfilestl>

<!-- Building 3 -- and many such buildings .........	>
﻿
```

To calculate forces, I used the following command -

```ComputeForces -dirin out -onlymk:11 -savecsv forces
```

In above code I changes values of mk for different buildings. I consider the rule given in documents for calculation of mk.

mk = mkbound + 10

So, mk values associated with piston becomes mk = 1 + 10 = 11

mk value associated with first building becomes mk = 2 + 10 = 12

and so on.

But after running the simulations, I am getting zero values for mk12 to mk 20 where buildings are present. Also there is this fluctuating value at mk 21 which seems to be wrong. There should be single peak force.

Can anyone please tell me where I went wrong.

Thanks!

• Hi @Vijay,

Have you tried gaugeForces ?

It computes forces throughout the simulation, i.e., it cannot be used after simulation like ComputeForce.

For more information, in the PDf file XML_GUIDE_vXX, look for the item XML file: Special-Gauges. Also, see the file _FmtXML_Gauges.xml in folder doc/xml_format

Below is an example to compute resultant forces on boundary particles with mkbound=1 and mkbound=2 (no need to add 10 to mklbound!), and considering all time steps.

Just add in the xml file the code below

```   ...
﻿</casedef>
<execution>
<special>
<gauges>
<default>
<savevtkpart value="true" comment="Creates VTK files for each PART (default=false)" />
<computedt value="0" comment="Time between measurements. 0:all steps (default=TimeOut)" units_comment="s" />
<_computetime start="0.1" end="0.2" comment="Start and end of measures. (default=simulation time)" units_comment="s" />
<output value="true" comment="Creates CSV files of measurements (default=false)" />
<outputdt value="0" comment="Time between output measurements. 0:all steps (default=TimeOut)" units_comment="s" />
<_outputtime start="0" end="10" comment="Start and end of output measures. (default=simulation time)" units_comment="s" />
</default>
<!-- Calculates force sumation on selected fixed or moving particles (using only fluid particles). -->
<force name="Force1">
<savevtkpart value="true" comment="Creates VTK files for each PART (default=default.savevtkpart)" />
<output value="true" comment="Creates CSV files of measurements (default=default.output)" />
<target mkbound="1" comment="Indicates the mkbound of selected particles to compute forces" />
</force>
﻿            <force name="Force2">
<savevtkpart value="true" comment="Creates VTK files for each PART (default=default.savevtkpart)" />
<output value="true" comment="Creates CSV files of measurements (default=default.output)" />
<target mkbound="2" comment="Indicates the mkbound of selected particles to compute forces" />
</force>
</gauges>
</special>
<parameters>
...
```

• Hi @rubens ,

Thank you so much for your reply. I have not tried this method yet. I will definitely give a try to implement this for the force calculations. Thanks again!

However, I will keep rerunning the simulation as a last option as the it is computationally expensive. So, if @rubens or anyone has a idea about how to make this resolve the problem just with computeForce, please let me know.

Thank you..

• Hi @Vijay ,

Maybe the problem is that you considered all the building solid walls.

ComputeForces gets accelerations of all selected wall MKbound particles, see Eq. 48 in https://link.springer.com/article/10.1007/s40571-021-00404-2

I think in your case the drag forces are like the image below :

According to the file doc/guides/ComputeForces_Help.out , you can set filters, and the option below looks like what you need, i.e. set the region containing the face of the building hit by the flow.

-onlypos:xmin:ymin:zmin:xmax:ymax:zmax Indicates limits of particles

The classic 3D dam-break case in the main folder adopts a different material for the face of the column. It also avoid forces on the lateral and back walls.

Hope this works now!

• Hi @rubens ,

Yes. The picture you have shown is correctly depicted what I want! Also thanks for sharing the article.

However, for my case, I want to consider all faces, instead of just a front face. So, I am taking a stl file for building and assigning mk number.

Initially I tried computeForce with single building and I got desired results.

Although, here mk assignment was as follows -

```					<!-- Piston -->
<setdrawmode mode="full" />
<setmkbound mk="10" />
<drawbox>
<boxfill>solid</boxfill>
<point x="4" y="1.0" z="0.0" />
<size x="0.05" y="4.0" z="4.0" />
</drawbox>

<!-- Flume -->

<!-- Basin -->
<setdrawmode mode="face" />
<setmkbound mk="0" />
<drawfilestl file="basin.stl" objname="basin" autofill="false">
<drawscale x="0.001" y="0.001" z="0.001" />
<drawmove x="17.05" y="1" z="0" />
</drawfilestl>
<!-- Building -->
<setdrawmode mode="face" />
<setmkbound mk="1"/>
<drawfilestl file="building.stl" objname="building" autofill="false">
<drawscale x="0.001" y="0.001" z="0.001" />
<drawmove x="25.79" y="2.8" z="0.795" />
</drawfilestl>
```

So here the force on single building has been calculated using

```ComputeForces -dirin out -onlymk:11 -savecsv forces
```

So, I am curious to know if this is working for single building, then why its not working for multiple building. I must have made an error in assigning mk values. What do you think?

• You should use "-viscoauto" in order to use the same viscosity values you used during the simulation

Regards

• Thanks @Alex , I will use following command using -viscoauto for multiple building case

```ComputeForces -dirin out -viscoauto -onlymk:14 -savecsv forces
```

And will update about the results.

Thanks!