The third example of this tutorial allows the development of a module for very simplified Lagrangian hydrodynamics:
- the only supported cell type is the hexahedron,
- no pseudo viscosity supported,
- the only supported characteristic length calculation type is the one using medians,
- the only supported boundary condition type is imposing a velocity component on a surface,
- the nodal mass is assumed constant and is not recalculated at each iteration,
- no value consistency test (positive pressure, positive volume, ...) is performed.
The list of operations performed by the module is as follows:
- calculation of pressure forces,
- calculation of momentum,
- taking into account boundary conditions,
- node displacement,
- calculation of new geometric values: cell volume, characteristic cell length, results at the vertices of each cell,
- calculation of density,
- calculation of pressure and energy using the equation of state. This calculation is performed by a service ARCANE. Two implementations are available for the service: perfect gas, and "stiffened" gas.
- calculation of the new time step.
The list of values manipulated by the module is as follows:
| Name | Element | Type | Description |
| Density | Cell | Real | Density per cell |
| Pressure | Cell | Real | Pressure per cell |
| CellMass | Cell | Real | Mass per cell |
| InternalEnergy | Cell | Real | Internal energy per cell |
| CellVolume | Cell | Real | Volume of the cell |
| OldCellVolume | Cell | Real | Volume of the cell at the previous iteration |
| Force | Node | Coordinate | Force at the nodes |
| Velocity | Node | Coordinate | Velocity at the nodes |
| NodeMass | Node | Real | Nodal mass |
| AdiabaticCst | Cell | Real | Adiabatic constant per cell |
| CaracteristicLength | Cell | Real | Characteristic length per cell |
| SoundSpeed | Cell | Real | Speed of sound in the cell |
| NodeCoord | Node | Coordinate | Coordinates of the nodes |
| CellCQs | Cell | Array of coordinates | Resultant at the vertices |
Application Design
- Prerequisites
-
- Actions to perform
- Based on the exercise statement and the documentation of the methods of the
MicroHydroModule class:
- Write the module descriptor:
- Provide the list of entry points. Each previously mentioned operation becomes an entry point and an initialization entry point is added,
- Provide the list of variables,
- Complete the configuration options for boundary conditions according to the
MicroHydro.arc dataset
- Then describe the sequence of entry points in the configuration file of the
MicroHydro.config application.
Equation of State Service
- Prerequisites
-
- Actions to perform
- Create a service capable of calculating the equation of state for a given group of cells:
- Look at the service interface in the
IEquationOfState file and the perfect gas and stiffened gas implementations,
- Register the 2 implementations in ARCANE using the macro,
- In the module descriptor (
MicroHydro.axl), enter the configuration options for the equation of state service according to the MicroHydro.arc dataset,
- Write the code for the perfect gas equation of state service in the
PerfectGasEOSService.cc file. The formulas are:
\[P = (\gamma - 1) \rho e\]
\[s = \sqrt{\gamma P / \rho} \]
with \(P\) = pressure, \(e\) = internal energy, \(s\) = speed of sound, \(\gamma\) = adiabatic constant, and \(\rho\) = density
- Write the code for the "stiffened gas" equation of state service in the
StiffenedGasEOSService.cc file. The formulas are:
\[P = ((\gamma - 1) \rho e) - (\gamma P_0)\]
\[s = \sqrt{(\gamma / \rho)(P+P_0)} \]
with \(P\) = pressure, \(P_0\) = limiting tension, \(e\) = internal energy, \(s\) = speed of sound, \(\gamma\) = adiabatic constant, and \(\rho\) = density
- Complete the calls to the equation of state service in the
MicroHydroModule.cc file
- Compile
- Choose the desired equation of state service in the
MicroHydro.arc dataset. Don't forget to specify the limiting tension in the case of the "stiffened gas" service.
- Run sequentially and in parallel and observe the results.
Handling Checkpoints/Resumptions
- Prerequisites
- This module, not using any internal data structure other than variables, has nothing to do to account for the saved checkpoints.
- Actions to perform
- Edit the
MicroHydro.config file and add the ArcaneCheckpoint module allowing checkpoints to be written.
- Run the code for 100 iterations: option -arcane_opt max_iteration 100.
- Resume execution: option -arcane_opt continue.
- No longer save the cell volume and add a new initialization entry point for resumption allowing the calculation of the cell volume from the node positions.