Skip to content

Commit

Permalink
Merge pull request #21 from xLPMG/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xLPMG authored Jan 26, 2024
2 parents b897ab0 + e59d132 commit 04c6307
Show file tree
Hide file tree
Showing 32 changed files with 3,550 additions and 765 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
build/
_build/
_templates/
temp/

.sconsign.dblite
.sconf_temp
Expand Down
10 changes: 8 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ env = conf.Finish()
# generate help message
Help( vars.GenerateHelpText( env ) )

####################
# ENABLE THREADS #
####################
env.Append( LINKFLAGS = [ '-lpthread' ] )
if OS != "Darwin":
env.Append( CXXFLAGS = [ '-pthread' ] )

#####################
# DEFAULT FLAGS #
#####################
Expand Down Expand Up @@ -236,8 +243,7 @@ if 'yes' in env['gui']:
# add other OS specific flags
if OS == "Darwin":
env.AppendUnique(FRAMEWORKS=Split('OpenGL Cocoa IOKit CoreVideo'))
else:
env.Append( CXXFLAGS = [ '-DNOGUI' ] )

#####################
# GET SOURCE FILES #
#####################
Expand Down
6 changes: 3 additions & 3 deletions configs/chile5000.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"outputFileName":"chile_5000_solution",
"nx":700,
"ny":590,
"endTime":15000,
"writingFrequency":500,
"checkpointFrequency": 10
"endTime":10000,
"writingFrequency":80,
"checkpointFrequency": 0
}
2 changes: 1 addition & 1 deletion configs/tohoku5000.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
"nx":540,
"ny":300,
"endTime":15000,
"writingFrequency":100
"writingFrequency":80
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/assets/task-10-Gui_help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/assets/task-10-Gui_select.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions docs/source/files/assignments/project.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
10. Project Phase
********************

In the project phase we decided to implement a userfriendly Gui. The aim is to make the usage of our Tsunami solver
as easy and interactive as possible.

GUI
===========

.. image:: ../../_static/assets/task-10-Gui_help.png

For the layout we chose to use multiple tabs, in order to make the use more clear.
The first page gives general informations about the project and refers to our website.

.. image:: ../../_static/assets/task-10-Gui_connectivity.png

Tab number two handles the the connection to thhe server. The properties for interacting with the server are getting set here.
Furthermore, the connection can also be disconnected here.

.. image:: ../../_static/assets/task-10-Gui_windows.png

On the next page the user can find all options of configuration for the simulation. The simulation parameters like cell amount, size and offset can be set here.
In Addition to that, compiler and run time options can be found here. These contain differetn modes, compiler options, flags and usage choices.
After selecting the simulation has to be recompiled with the according button below.

.. image:: ../../_static/assets/task-10-Gui_select.png

The last tab contains further actions to interact with the simulation. First, the simulation can be started or killed here.
Also files for the bathymetry and displacement can be chosen. As an addition, the user can get data like the heigth from the simulation.



Communicator
=============================

For communication between simulation and the gui Luca-Philipp introduced a communication library.
The **Communicator.cpp** library can be used to easily create a client-server TCP connection and handle its communication and logging.

**communicator_api**

Since all communication happens using text over TCP, we had to implement a structure that both server and client can adhere to
in order to guarantee correct communication. For this, we decided to send all data in JSON format. Furthermore, each message
follows a strict pattern. It consists of 3 parts: the TYPE which provides information on the nature of the message,
the KEY which is a unique identifier for each message, and ARGS containing other message data (such as parameters) in JSON format.

.. code:: cpp
enum MessagePart
{
TYPE,
KEY,
ARGS
};
enum MessageType
{
SERVER_CALL,
FUNCTION_CALL,
OTHER,
SERVER_RESPONSE
};
struct Message
{
MessageType type = MessageType::OTHER;
std::string key = "NONE";
json args = "";
};
It also implements various functions to convert from and to json format, such as ``messageToJson()``, ``messageToJsonString()``
and ``jsonToMessage()``.

**Communicator.hpp**

The library provides functions to start server and client and to send messages to each other.
Transmitted data is logged and can be retrieved via ``getLog()``.
Describing the detailed code here would be too extensive and not necessary, as this library
is rather just a tool for us to develop the actually interesting code.

**Communication example**

``communicator_api.h``

.. code:: cpp
inline const Message START_SIMULATION = {MessageType::SERVER_CALL, "start_simulation"};
Client-side usage:

.. code:: cpp
xlpmg::Communicator m_communicator;
m_communicator.startClient(IPADDRESS, PORT)
[...]
xlpmg::Message startSimMsg = xlpmg::START_SIMULATION;
m_communicator.sendToServer(messageToJsonString(startSimMsg));
Server-side usage:

.. code:: cpp
xlpmg::Communicator m_communicator;
m_communicator.startServer(m_PORT);
// listen for key
Server
============
TODO
27 changes: 20 additions & 7 deletions docs/source/files/categories/introduction.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
Introduction
================
What is the tsunami lab?
#########################

This project was created as part of the Tsunami course in the winter semester 2023/24 at FSU Jena.
The lectures content was implemented by `Luca-Philipp Grumbach <https://github.com/xLPMG>`_ and `Richard Hofmann <https://github.com/ZeyxRew>`_ as weekly homework / exam assignments.
The `tsunami lab <https://scalable.uni-jena.de/opt/tsunami/>`_ is a course taught at the `University of Jena <https://www.uni-jena.de/en/universityofjena>`_ as
the practical lab for the lecture on parallel computing.
The goal is to write a C++ tsunami `wave equation <https://en.wikipedia.org/wiki/Wave_equation>`_ `solver <https://www.clawpack.org/riemann_book/html/Index.html>`_, optimize and parallelize it and run tsunami simulations on an `HPC cluster <https://www.hpe.com/asia_pac/en/what-is/hpc-clusters.html>`_.

Visit the homepage for more information:
https://scalable.uni-jena.de/opt/tsunami/
During the class, we received weekly assignments which make up the final grade. Our (`Luca-Philipp Grumbach <https://github.com/xLPMG>`_ and `Richard Hofmann <https://github.com/ZeyxRew>`_)
implementations of the given weekly tasks are what make up this repository - a fully functional 2D wave equation solver for Linux and MacOS.

What does the code do?
##########################

The solver can be used either with pre-defined setups or with custom `bathymetry <https://en.wikipedia.org/wiki/Bathymetry>`_ & `displacement <https://en.wikipedia.org/wiki/Displacement_(fluid)>`_ files.
A bathymetry file contains info on the depth of water, while the displacement file describes the effects on the water level due to e.g. an earthquake.

Using this data, our program will numerically calculate (if specified in parallel on multiple CPU cores) the wave propagation after the initial input data, that is specifically
calculate and output how a tsunami forms and moves after an earthquake.

The solver outputs this data either in form of a ``.csv`` file or a ``netcdf`` file (recommended for large data).
This data can then be visualized, for example using `Paraview <https://www.paraview.org/>`_:

Documentation structure
^^^^^^^^^^^^^^^^^^^^^^^^^^
#########################

This documentation is divided into different categories categories:

Expand Down
Loading

0 comments on commit 04c6307

Please sign in to comment.