Arcane  4.1.15.0
User documentation
Loading...
Searching...
No Matches
MicroHydroModule.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2#ifndef MICROHYDROMODULE_H
3#define MICROHYDROMODULE_H
4
5#include "MicroHydro_axl.h"
6
7using namespace Arcane;
8
9/**
10 * Represents a highly simplified Lagrangian hydrodynamics module:
11 * - the only supported cell type is the hexahedron,
12 * - no pseudo-viscosity supported,
13 * - the only supported characteristic length calculation type is the one using medians,
14 * - the only supported boundary condition type is imposing a velocity component on a surface,
15 * - the nodal mass is assumed constant and is not recalculated at each iteration,
16 * - no value consistency test (positive pressure, positive volume, ...) is performed.
17 *
18 * The list of operations performed by the module is as follows:
19 * - calculation of pressure forces,
20 * - calculation of momentum,
21 * - taking into account boundary conditions,
22 * - node displacement,
23 * - calculation of new geometric values: cell volume, cell characteristic length, resultant forces at the vertices of each cell,
24 * - calculation of density,
25 * - calculation of pressure and energy using the equation of state. This calculation is performed by an ARCANE service.
26 * Two implementations are available for the service: perfect gas, and "stiffened" gas.
27 * - calculation of the new time step.
28 *
29 */
31: public ArcaneMicroHydroObject
32{
33 public:
34 /** Class constructor */
36 : ArcaneMicroHydroObject(mbi) {}
37 /** Class destructor */
39
40 public:
41 /**
42 * Initializes the module.
43 * The initialization consists of two distinct parts:
44 * - the first part where the size of the array variables must be specified.
45 * In our case, these are \c m_cell_cqs and
46 * \c m_viscosity_force, both of which are cell variables possessing a
47 * value for every node of every cell. Since we only support hexahedrons, there
48 * are 8 values per cell,
49 * - the second part which consists of initializing the variables with
50 * their starting value. For the variables \c Pressure, \c Density, and
51 * \c AdiabaticCst, ARCANE initializes them directly
52 * from the dataset. The \c NodeCoord variable is also
53 * initialized by the architecture when reading the mesh. The
54 * other variables are calculated as follows:
55 * - the initial time step is given by the dataset,
56 * - the geometric values (characteristic length, volume, and
57 * resultant forces at the vertices) are calculated from the node coordinates,
58 * - the cell mass is calculated from its density andvolume,
59 * - the cell mass and nodal mass. A cell's mass is calculated from its density and volume,
60 * - the nodal mass is calculated by adding the contributions of
61 * each cell connected to a given node. Each cell
62 * contributes 1/8th of its mass to the nodal mass of each of its
63 * vertices,
64 * - the internal energy and the speed of sound are calculated based on the equation of state.
65 */
66 virtual void hydroStartInit();
67
68 /**
69 * Calculates the contribution of pressure forces per node at the current
70 * time \f$t^{n}\f$. For each node of each cell,
71 * this is the pressure multiplied by the resultant force at that node.
72 * Calculates the pressure forces at the current time \f$t^{n}\f$.
73 */
74 virtual void computePressureForce();
75
76 /**
77 * Calculates the force (\c m_force) applied to the nodes by adding the
78 * possible contribution of pseudo-viscosity. Then calculates the new
79 * velocity (\c m_velocity) at the nodes.
80 */
81 virtual void computeVelocity();
82
83 /**
84 * Applies the boundary conditions.
85 * Boundary conditions depend on the dataset options. In this implementation,
86 * a boundary condition has the following properties:
87 * - a type: three types are supported: constraining the \f$x\f$ component
88 * of the velocity vector, constraining the \f$y\f$ component of the velocity
89 * vector, or constraining the \f$z\f$ component of the velocity vector,
90 * - a value: this is a real number indicating the value of the constraint,
91 * - a surface: this is the surface on which the constraint applies.
92 *
93 * Applying boundary conditions therefore consists of fixing a component of a
94 * velocity vector for every node of every face of every surface on which a
95 * boundary condition is imposed.
96 */
97 virtual void applyBoundaryCondition();
98
99 /**
100 * Modifies the coordinates (\c m_node_coord) of the nodes based on the
101 * velocity vector and the time step.
102 */
103 virtual void moveNodes();
104
105 /**
106 * This entry point groups all the geometric calculations useful for the
107 * scheme. In our case, this involves for each cell:
108 * - calculating its characteristic length,
109 * - calculating the resultant forces at its vertices,
110 * - calculating its volume.
111
112 * To optimize the calculation (cache usage), during each iteration on a cell,
113 * the coordinates of its nodes and those of the center of its faces are stored locally.
114 */
115 virtual void computeGeometricValues();
116
117 /**
118 * Calculates the new value of the cell density, assuming that the mass
119 * of a cell is constant over time. In this case, the new density is equal
120 * to the mass divided by the new volume.
121 */
122 virtual void updateDensity();
123
124 /**
125 * This entry point calculates the internal energy, pressure, and speed of
126 * sound within the cell by calling the equation of state service.
127 */
128 virtual void applyEquationOfState();
129
130 /**
131 * Determines the time step value for the next iteration.
132 * The time step is constrained by:
133 * - the CFL value,
134 * - the \c deltatMin() and \c deltatMax() values of the dataset,
135 * - the final time value. During the last iteration, the time step must
136 * be such that we stop exactly at the time specified in the dataset
137 * (\c finalTime()).
138 */
139 virtual void computeDeltaT();
140
141 /** Returns the version number of the module */
142 virtual VersionInfo versionInfo() const { return VersionInfo(1,0,0); }
143
144 private:
145 /**
146 * Calculates the resultant forces at the nodes of a hexahedral cell.
147 * The method used is that of dividing into four triangles.
148 * Method called by the \c computeGeometricValues() entry point
149 */
150 inline void computeCQs(Real3 node_coord[8],Real3 face_coord[6],const Cell& cell);
151};
152
153#endif
Cell of a mesh.
Definition Item.h:1300
Information for building a module.
Class managing a 3-dimensional real vector.
Definition Real3.h:132
Information about a version.
Definition VersionInfo.h:47
virtual void updateDensity()
virtual void computeVelocity()
virtual void computeGeometricValues()
virtual void computeDeltaT()
virtual VersionInfo versionInfo() const
virtual void applyBoundaryCondition()
virtual void hydroStartInit()
virtual void moveNodes()
virtual void applyEquationOfState()
MicroHydroModule(const ModuleBuildInfo &mbi)
virtual void computePressureForce()
-- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature --