commit 472547ca2d29a5340bf03cfe3c1cc101e13f8ab2
parent a16447a8f2adc2f0ca910ac923f2fb44c0eb01fb
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 4 Mar 2026 10:35:14 +0100
Improve comments of in the test program
Diffstat:
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/src/test_sgas.c b/src/test_sgas.c
@@ -29,6 +29,13 @@ enum { PRESSURE, TEMPERATURE, XH2O, XCO2, XCO };
* tetrahedron to which it is attached and the time to which it is defined */
#define PROP_VAL(Prop, Tetra, Time) ((double)(Prop+Tetra*100+Time*10))
+/* Vertices of the volumetric mesh of a unit cube with a lower corner in
+ * (0.0.0), and therefore its upper corner in (1.1.1). The vertices are those
+ * meshes of a cube to which is added an additional vertex in its center. So
+ * the base of the tetrahedra are the original triangles and have a shared
+ * vertex in the center of the cube. Adding a vertex to the centre of the cybe
+ * is not necessary but simplifies the volumetric mesh of the cube and the
+ * indentification of the tetraheron in which a position lies. */
static const double box_vertices[9/*#vertices*/*3/*#coords per vertex*/] = {
0.0, 0.0, 0.0,
1.0, 0.0, 0.0,
@@ -184,55 +191,63 @@ test_gas_creation(void)
FILE* fp_props = NULL;
FILE* fp_props_list = NULL;
+ /* Create the gas mesh */
CHK(fp_mesh = fopen(name_mesh, "w+"));
write_smsh(fp_mesh, box_vertices, box_nverts, box_indices, box_ntetras);
+ /* Create one set of thermodynamic properties */
CHK(fp_props = fopen(name_props, "w"));
write_atrtp(fp_props, box_ntetras, 0/*time step*/);
CHK(fclose(fp_props) == 0);
+ /* List the thermodynamic properties, actually only one */
CHK(fp_props_list = fopen(name_props_list, "w+"));
- CHK(fprintf(fp_props_list, "0 %s\n", name_props));
+ CHK(fprintf(fp_props_list, "#time thermo_properties\n"));
+ CHK(fprintf(fp_props_list, "0 %s\n", name_props));
CHK(fflush(fp_props_list) == 0);
args.mesh.name = name_mesh;
args.therm_props_list.name = name_props_list;
- args.verbose = 3;
+ args.verbose = 1;
+ /* Check the gas creation API */
CHK(sgas_create(NULL, &gas) == RES_BAD_ARG);
CHK(sgas_create(&args, NULL) == RES_BAD_ARG);
CHK(sgas_create(&args, &gas) == RES_OK);
+ /* Check the reference counting API */
CHK(sgas_ref_get(NULL) == RES_BAD_ARG);
CHK(sgas_ref_get(gas) == RES_OK);
CHK(sgas_ref_put(NULL) == RES_BAD_ARG);
CHK(sgas_ref_put(gas) == RES_OK);
CHK(sgas_ref_put(gas) == RES_OK);
- /* Missing mesh */
+ /* The mesh is missing. */
args.mesh.name = NULL;
CHK(sgas_create(&args, &gas) == RES_BAD_ARG);
- /* Missing therm props list */
+ /* The list of thermodynamic properties is missing */
args.mesh.name = name_mesh;
args.therm_props_list.name = NULL;
CHK(sgas_create(&args, &gas) == RES_BAD_ARG);
- /* Invalid stream of therm propos list */
+ /* Invalid stream for the list of thermodynamic properties */
args.mesh.name = name_mesh;
args.therm_props_list.name = NULL;
args.therm_props_list.stream = fp_props_list;
CHK(sgas_create(&args, &gas) == RES_BAD_ARG);
+ /* The stream for the list of properties becomes valid */
rewind(fp_props_list);
CHK(sgas_create(&args, &gas) == RES_OK);
CHK(sgas_ref_put(gas) == RES_OK);
- /* Invalid stream of mesh */
+ /* Invalid stream for the gas mesh */
rewind(fp_props_list);
args.mesh.stream = fp_mesh;
CHK(sgas_create(&args, &gas) != RES_OK);
+ /* The stream for the mesh becomes valid */
rewind(fp_mesh);
CHK(sgas_create(&args, &gas) == RES_OK);
CHK(sgas_ref_put(gas) == RES_OK);