Skip to content

Commit 5f3a984

Browse files
committed
Merge branch 'develop'
2 parents 531f0e7 + 786ef37 commit 5f3a984

24 files changed

Lines changed: 448 additions & 153 deletions

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Release Notes
22
The release notes for the DesignSPHysics.
33

4+
-------------------
5+
## DesignSPHysics v0.8.1 (27-05-2025)
6+
* DualSPHysics v5.4 binaries uploaded at: https://dual.sphysics.org/sphcourse/DualSPHysics-bin/
7+
* Full compatibility with DesignSPHysics v0.7.0
8+
49
-------------------
510
## DesignSPHysics v0.8.0 (16-05-2025)
611
* Update DualSPHysics binaries from v5.4
@@ -15,7 +20,6 @@ The release notes for the DesignSPHysics.
1520
* Helper object to show position size and orientation of Inlet zones, Variable Resolution Zones, Gauges,Particle Filters and FlowTool Boxes
1621
* Script generation for Windows and Linux
1722
* Importing of .vtm and .vtu files
18-
* Compatibility with DesignSPHysics v0.7.0
1923

2024
-------------------
2125
## DesignSPHysics v0.7.0 (15-09-2023)

DesignSPHysics.FCMacro

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,28 @@
77

88
import sys
99
import os
10-
from html import escape
11-
from traceback import format_tb
10+
11+
""" Disables some types of FreeCAD warnings """
12+
from PySide2.QtCore import qInstallMessageHandler, QtMsgType
13+
def customMessageHandler(type, context, message):
14+
if "QWindowsWindow::setMouseGrabEnabled" not in message:
15+
print(message)
16+
qInstallMessageHandler(customMessageHandler)
17+
os.environ["QT_LOGGING_RULES"] = "*.debug=false;*.warning=false"
18+
# --------------------
19+
20+
import logging
21+
class IgnoreMouseGrabWarning(logging.Filter):
22+
def filter(self, record):
23+
return "QWindowsWindow::setMouseGrabEnabled" not in record.getMessage()
24+
logger = logging.getLogger()
25+
logger.addFilter(IgnoreMouseGrabWarning)
26+
# --------------------
1227

1328
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
29+
# --------------------
1430

15-
#from mod.widgets.custom_widgets.error_report_dialog import ErrorReportDialog # pylint: disable=wrong-import-position
1631
from mod.main import boot # pylint: disable=wrong-import-position
17-
1832
'''
1933
def report_error(exctype, value, tb):
2034
""" Displays a dialog with options about the sudden crash. """

README.md

Lines changed: 146 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,174 @@
11
# DesignSPHysics
22

3-
DesignSPHysics is a software module built into [FreeCAD](http://www.freecadweb.org/) that provides a Graphical User Interface for [DualSPHysics](http://dual.sphysics.org/). It is under development since September 2016 and in Beta stage.
3+
**DesignSPHysics** is an open-source FreeCAD module that provides a comprehensive graphical user interface (GUI) for [DualSPHysics](http://dual.sphysics.org/), a mesh-free particle-based fluid simulation engine based on Smoothed Particle Hydrodynamics (SPH).
44

5-
Check the [Official Webpage](http://design.sphysics.org) for downloads and more information.
5+
Development of DesignSPHysics began in September 2016, and the software is currently in its beta phase.
6+
7+
Visit the [official DesignSPHysics website](http://design.sphysics.org) for downloads, tutorials, and additional information.
68

79
![Screenshot](https://design.sphysics.org/img/github-shot-21112019.png)
810

9-
## News
10-
### Training courses
11-
* [19th SPHERIC World Conference](https://spheric2025.upc.edu/), Barcelona, Spain, on **16-19 June, 2025**.
12-
* [8th DualSPHysics Workshop](https://dual.sphysics.org/8thworkshop/), Ourense, Spain, on **27-29 January, 2026**.
13-
#### Past events
14-
* [SPH modelling For Engineering applications](https://sites.google.com/view/hykudsph/home?authuser=0), Braunschweig, Germany, on **25-27 March 2025**.
15-
* [4th Hands-on course on experimental and numerical modelling of wave-structure interaction](https://sites.google.com/unifi.it/hands-on-course-2024), Florence, Italy, on **1-5 July 2024**.
16-
* [7th DualSPHysics Workshop](https://dual.sphysics.org/7thworkshop/), Bari, Italy, on **19-21 March, 2024**.
11+
---
1712

18-
### Releases
19-
* [v0.8.0](https://github.com/DualSPHysics/DesignSPHysics/releases/tag/0.8.0) (22-05-2023). See [CHANGELOG file](CHANGELOG.md)
20-
* [v0.7.0](https://github.com/DualSPHysics/DesignSPHysics/releases/tag/0.7.0) (15-09-2023).
13+
## 📢 News
2114

22-
## Description
23-
DesignSPHysics enables the user to create cases with solids and fluids and exports it to a DualSPHysics compatible format. In addition, it does the hard work for the user, generating the case data automatically, simulating, and post-processing, all inside FreeCAD.
15+
### Upcoming Events
16+
- **[19th SPHERIC World Conference](https://spheric2025.upc.edu/)** — Barcelona, Spain — *June 16–19, 2025*
17+
- **[8th DualSPHysics Workshop](https://dual.sphysics.org/8thworkshop/)** — Ourense, Spain — *January 27–29, 2026*
2418

25-
It includes support for pre-processing with GenCase, simulation with DualSPHysics and post-processign with several tools of the DualSPHysics package.
19+
### Recent Past Events
20+
- **[SPH Modelling for Engineering Applications](https://sites.google.com/view/hykudsph/home?authuser=0)** — Braunschweig, Germany — *March 25–27, 2025*
21+
- **[4th Hands-on Course on Experimental and Numerical Modelling of Wave-Structure Interaction](https://sites.google.com/unifi.it/hands-on-course-2024)** — Florence, Italy — *July 1–5, 2024*
22+
- **[7th DualSPHysics Workshop](https://dual.sphysics.org/7thworkshop/)** — Bari, Italy — *March 19–21, 2024*
2623

27-
In the future the code will be modular, so integration with different SPH solvers can be used. Right now it's optimized to be used with DualSPHysics
2824

29-
It is developed as a FreeCAD module with a macro bootstrapper, in Python 3.5+, using the QT libraries via PySide.
25+
> Visit the [official DesignSPHysics website](https://dual.sphysics.org/training/) for more information.
3026
31-
## Installation instructions
32-
To install DesignSPHysics you have 2 options: Using the FreeCAD Addon manager for an stable version, or installing manually whatever version that you like from git.
27+
---
3328

34-
### Installing a release version
35-
To install a release version, open FreeCAD 0.18+ and go to the menu *Macro -> Macros...* From there, press the *Addons...* button on the bottom right corner, search for DesignSPHysics and click *Install / Update*. FreeCAD will advise you to reboot the application and you'll be set.
29+
## 🚀 Latest Releases
3630

37-
Take in mind that as it includes DualSPHysics, the package may take a while to download.
31+
- [v0.8.1](https://github.com/DualSPHysics/DesignSPHysics/releases/tag/0.8.1)*May 27, 2023* ([Changelog](CHANGELOG.md))
32+
- [v0.7.0](https://github.com/DualSPHysics/DesignSPHysics/releases/tag/0.7.0)*September 15, 2023*
3833

39-
To execute DesignSPHysics just open the same Macro dialog and double click DualSPHysics.
34+
---
4035

41-
### Installing a development build
42-
Clone the branch that you like from this repository and rename the folder to 'DesignSPHysics'. Then copy the folder to the Mod folder of the FreeCAD installation directory.
36+
## 🧩 Features
4337

44-
By default, for example, in Windows, it is located in `%appdata%/FreeCAD/Mod` or in Linux in `~/.FreeCAD/Mod`
38+
DesignSPHysics simplifies the process of setting up, running, and post-processing SPH simulations through an intuitive interface in FreeCAD. Key functionalities include:
4539

46-
Then copy the file `DesignSPHysics.FCMacro` of this repository into the FreeCAD macro directory (`%appdata%/FreeCAD/Macro` on Windows; `~/.FreeCAD/Macro` on GNU/Linux)
40+
- Integrated pre-processing with **GenCase**
41+
- Simulation execution with **DualSPHysics**
42+
- Post-processing using **DualSPHysics Tools**
43+
- Case creation with fluid and solid domains
44+
- Automated data generation and file management
45+
- Built-in support for Python 3.5+ and Qt via PySide
46+
- Macro bootstrapper integration with FreeCAD
4747

48-
## Where to get help
49-
The new [DualSPHysics forum](https://github.com/DualSPHysics/DualSPHysics/discussions) is available for help on using the features available in the solver.
48+
Future versions will include modular support for additional SPH solvers beyond DualSPHysics.
5049

51-
You can check the [DesignSPHysics Wiki](http://design.sphysics.org/wiki) to get help. Also, you can post an [issue here on GitHub](https://github.com/DualSPHysics/DesignSPHysics/issues) or send an email to any of the people found in the [CONTRIBUTING file](CONTRIBUTING.md).
50+
---
5251

53-
## Contributing and developing for DesignSPHysics
54-
You can freely contribute to the project, if you want!. You can do it here on GitHub.
52+
## ⚙️ Setup
5553

56-
Please check the [CONTRIBUTING file](CONTRIBUTING.md) to view information about how to contribute to the project.
54+
There are multiple ways to obtain the DesignSPHysics package:
5755

58-
## Copyright and License
59-
Copyright (C) 2025,
60-
Ivan Martinez Estevez, Andres Vieira
56+
### 📥 Option 1: Clone the Repository
6157

62-
EPHYSLAB Environmental Physics Laboratory, Universidade de Vigo
63-
EPHYTECH Environmental Physics Technologies
58+
Clone the latest development version from GitHub:
59+
```bash
60+
git clone https://github.com/DualSPHysics/DesignSPHysics.git
61+
```
62+
63+
### 📦 Option 2: Download a Stable Release
64+
65+
Get pre-packaged code from the [GitHub Releases page](https://github.com/DualSPHysics/DesignSPHysics/releases).
66+
67+
---
68+
69+
### 🔧 DualSPHysics Binaries
70+
71+
> **Important:** Starting with version 0.8.0, DesignSPHysics does **not** include the DualSPHysics binaries. These must be downloaded separately.
72+
73+
DualSPHysics binaries should be located in `DesignSPHysics/dualsphysics/bin`.
74+
You can obtain the required binaries using one of the following methods:
75+
76+
- **Option A: Automatically via Setup Script**
77+
```bash
78+
cd DesignSPHysics
79+
chmod +x setup.sh && ./setup.sh
80+
```
81+
82+
- **Option B: Manually**
83+
1. Download `dualsphysics.zip` from the [official DualSPHysics website](https://dual.sphysics.org/sphcourse/DualSPHysics-bin)
84+
2. Move the file into the `DesignSPHysics` folder
85+
3. Extract the contents
86+
87+
---
88+
89+
## 🛠 Installation Instructions
90+
91+
### Installing a Development Build
92+
93+
1. Rename the downloaded or cloned folder to `DesignSPHysics`
94+
2. Move the folder into FreeCAD’s `Mod` directory:
95+
- **Windows:** `%APPDATA%/FreeCAD/Mod`
96+
- **Linux:** `~/.FreeCAD/Mod`
97+
3. Copy the `DesignSPHysics.FCMacro` file into the FreeCAD `Macro` directory:
98+
- **Windows:** `%APPDATA%/FreeCAD/Macro`
99+
- **Linux:** `~/.FreeCAD/Macro`
100+
101+
---
102+
103+
## ▶️ Launching DesignSPHysics
104+
105+
To start using the plugin in FreeCAD:
106+
107+
1. Open **FreeCAD**
108+
2. Navigate to **Macro → Macros...**
109+
3. In the `Execute macro` window:
110+
- Locate and select `DesignSPHysics.FCMacro`
111+
- Click **Execute**
112+
113+
A new panel labeled **DesignSPHysics** will appear on the right. Follow these steps:
64114

65-
This file is part of DesignSPHysics.
115+
4. Click **Setup Plugin** to open the **DSPH Setup** window
116+
5. DualSPHysics executables should be configured automatically while ParaView executable should be configured manually.
66117

67-
DesignSPHysics is free software: you can redistribute it and/or modify
68-
it under the terms of the GNU General Public License as published by
69-
the Free Software Foundation, either version 3 of the License, or
70-
(at your option) any later version.
118+
---
71119

72-
DesignSPHysics is distributed in the hope that it will be useful,
73-
but WITHOUT ANY WARRANTY; without even the implied warranty of
74-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
75-
GNU General Public License for more details.
120+
## 🛠️ Troubleshooting
121+
122+
If you experience issues during installation or launch, residual configuration files from previous installations might be the cause. You should delete them before proceeding.
123+
124+
### Configuration File Locations
125+
126+
- **Windows:**
127+
```
128+
C:\Users\<user>\AppData\Roaming\FreeCAD
129+
```
130+
131+
- **Linux:**
132+
```
133+
~/.config/FreeCAD
134+
```
135+
136+
To manually remove residual files:
137+
- Use a file manager to delete any `DesignSPHysics`-related files
138+
- Or, run this command in a terminal (Linux):
139+
```bash
140+
rm ~/.config/FreeCAD/designsphysics*
141+
```
142+
143+
> Replace `<user>` with your actual system username.
144+
145+
146+
---
147+
148+
## 📚 Documentation & Support
149+
150+
- 📖 [DesignSPHysics Wiki](http://design.sphysics.org/wiki)
151+
- 💬 [DualSPHysics GitHub Discussions](https://github.com/DualSPHysics/DualSPHysics/discussions)
152+
- 🐛 [Report Issues on GitHub](https://github.com/DualSPHysics/DesignSPHysics/issues)
153+
- ✉️ Contact contributors via the [CONTRIBUTING file](CONTRIBUTING.md)
154+
155+
---
156+
157+
## 🤝 Contributing
158+
159+
We welcome contributions! Whether it’s bug fixes, new features, or documentation improvements, your input is valuable. Please read the [CONTRIBUTING file](CONTRIBUTING.md) for detailed guidelines.
160+
161+
---
162+
163+
## 📄 License
164+
165+
**DesignSPHysics** is released under the [GNU General Public License v3.0 or later](http://www.gnu.org/licenses/).
166+
167+
```
168+
© 2025 Ivan Martinez Estevez, Andres Vieira
169+
170+
EPHYSLAB Environmental Physics Laboratory, Universidade de Vigo
171+
EPHYTECH Environmental Physics Technologies
172+
```
76173

77-
You should have received a copy of the GNU General Public License
78-
along with DesignSPHysics. If not, see <http://www.gnu.org/licenses/>.
174+
> This software is provided “as is,” without warranty of any kind. See the license for details.

mod/constants.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
DIVIDER = 1000
1212
LINE_END = "\n"
1313
PICKLE_PROTOCOL = 1 # Binary mode
14-
VERSION = "0.8.0" # Version must be M.m.p (dd-mm-yyyy)
15-
REVISION = "010" # Revision number must be rrr
16-
VER_DATE = "(16-05-2025)" # Date version must be (dd-mm-yyyy)
14+
VERSION = "0.8.1" # Version must be M.m.p (dd-mm-yyyy)
15+
REVISION = "005" # Revision number must be rrr
16+
VER_DATE = "(27-05-2025)" # Date version must be (dd-mm-yyyy)
1717
WIDTH_2D = 0.001
1818
DISK_DUMP_FILE_NAME = "designsphysics-{}.log".format(VERSION)
1919
MKFLUID_LIMIT = 10
@@ -63,3 +63,19 @@
6363

6464
MAIN_WIDGET_INTERNAL_NAME = "DSPH Widget"
6565
PROP_WIDGET_INTERNAL_NAME = "DSPH_Properties"
66+
67+
68+
# In your mod/constants.py:
69+
class Constants:
70+
"""Dummy class that contains all module-level constants"""
71+
pass
72+
73+
# Copy all module-level constants into the class
74+
import sys
75+
module = sys.modules[__name__]
76+
for name in dir(module):
77+
if not name.startswith('_'):
78+
setattr(Constants, name, getattr(module, name))
79+
80+
# Create an instance that pickle can find
81+
constants = Constants()

mod/dataobjects/case.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from mod.tools.stdout_tools import debug, log
2121

2222
from mod.constants import VERSION, SUPPORTED_TYPES, MKFLUID_LIMIT, CASE_3D_MODE
23-
from mod.enums import ObjectType, InletOutletZoneGeneratorType, FlowUnits
23+
from mod.enums import ObjectType
2424

2525
from mod.dataobjects.inletoutlet.inlet_outlet_config import InletOutletConfig
2626
from mod.dataobjects.chrono.chrono_config import ChronoConfig
@@ -82,7 +82,6 @@ def __init__(self, reset=False):
8282

8383

8484

85-
8685
@staticmethod
8786
def the() -> "Case":
8887
""" Static access method. """

mod/dataobjects/case_information.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from os.path import isdir, isfile, dirname
77
from pathlib import Path
88

9+
from mod.functions import migrate_state
910
from mod.tools.file_tools import load_default_materials
1011

1112

@@ -22,8 +23,21 @@ def __init__(self):
2223
self.global_materials: list = list() # [MaterialProperty]
2324
self.last_used_directory: str = str(Path.home())
2425
self.last_used_bathymetry_data: BathymetryFormData = BathymetryFormData()
26+
self.is_simulation_done: bool = False
2527

2628
self.load_default_materials()
29+
30+
def __setstate__(self, state: dict):
31+
# Attribute renaming map (old -> new)
32+
rename_map = dict()
33+
34+
# Handle missing attributes (backward compatibility)
35+
default_attrs = {
36+
'is_simulation_done': False, # Add other renames if needed
37+
}
38+
39+
# Restore the state
40+
self.__dict__.update(migrate_state(rename_map,default_attrs,state))
2741

2842
def update_last_used_directory(self, new_path: str) -> None:
2943
""" Updates the last used directory with the folder from the provided path. """

mod/dataobjects/configuration/application_settings.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from mod.constants import VERSION
1111
from mod.functions import get_os
12+
from mod.functions import migrate_state
1213

1314

1415
class ApplicationSettings():
@@ -77,3 +78,15 @@ def persist(self) -> None:
7778
""" Persists the current settings to disk for next instantiations to load. """
7879
with open(self.get_save_file(), "w", encoding="utf-8") as save_file:
7980
json.dump(self.__dict__, save_file, indent=4)
81+
82+
def __setstate__(self, state: dict):
83+
# Attribute renaming map (old -> new)
84+
rename_map = {
85+
'force_moordyn_support_enabled': 'force_moordynplus_support_enabled', # Add other renames if needed
86+
}
87+
88+
# Handle missing attributes (backward compatibility)
89+
default_attrs = dict()
90+
91+
# Restore the state
92+
self.__dict__.update(migrate_state(rename_map,default_attrs,state))

0 commit comments

Comments
 (0)