stardis

Perform coupled heat transfer calculations
git clone git://git.meso-star.fr/stardis.git
Log | Files | Refs | README | LICENSE

commit 5b6a9d7c56232f898838bfa18960c77a7eb5260c
parent 83d0b4abddd3a40ae1756d3848ebbac8b5fb7acf
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Mon, 14 Mar 2022 15:53:29 +0100

Use a cleaner way to install public header for programmed properties

Diffstat:
Mcmake/CMakeLists.txt | 20++++++++++++++------
Acmake/stardis-prog-properties/CMakeLists.txt | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/stardis-description.c | 2+-
Msrc/stardis-description.h | 2+-
Msrc/stardis-fbound-prog.c | 2+-
Msrc/stardis-fbound-prog.h | 2+-
Msrc/stardis-fluid-prog.c | 2+-
Msrc/stardis-fluid-prog.h | 2+-
Msrc/stardis-hbound-prog.c | 2+-
Msrc/stardis-hbound-prog.h | 2+-
Msrc/stardis-hbound.h | 2+-
Msrc/stardis-intface.c | 2+-
Msrc/stardis-parsing.c | 2+-
Asrc/stardis-prog-properties.h.in | 501+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsrc/stardis-prog.h | 499-------------------------------------------------------------------------------
Msrc/stardis-program.h | 2+-
Msrc/stardis-sfconnect-prog.c | 2+-
Msrc/stardis-sfconnect-prog.h | 2+-
Msrc/stardis-solid-prog.c | 2+-
Msrc/stardis-solid-prog.h | 2+-
Msrc/stardis-ssconnect-prog.c | 2+-
Msrc/stardis-ssconnect-prog.h | 2+-
Msrc/stardis-tbound-prog.c | 2+-
Msrc/stardis-tbound-prog.h | 2+-
Astardis-prog-properties/stardis-prog-properties-config-version.cmake.in | 22++++++++++++++++++++++
Astardis-prog-properties/stardis-prog-properties-config.cmake | 28++++++++++++++++++++++++++++
26 files changed, 638 insertions(+), 525 deletions(-)

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -17,6 +17,7 @@ cmake_minimum_required(VERSION 3.0) project(stardis C) set(SDIS_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) +set(SDIS_PRG_DIR ${PROJECT_SOURCE_DIR}/../stardis-prog-properties) if(CMAKE_HOST_UNIX) set(STARDIS_DOC "TROFF" CACHE STRING @@ -66,6 +67,14 @@ configure_file(${SDIS_SOURCE_DIR}/stardis-default.h.in configure_file(${SDIS_SOURCE_DIR}/stardis-version.h.in ${CMAKE_CURRENT_BINARY_DIR}/stardis-version.h @ONLY) +set(STARDIS_PROG_PROPERTIES_VERSION "1") + +configure_file(${SDIS_SOURCE_DIR}/stardis-prog-properties.h.in + ${CMAKE_CURRENT_BINARY_DIR}/stardis-prog-properties/stardis-prog-properties.h @ONLY) + +configure_file(${SDIS_PRG_DIR}/stardis-prog-properties-config-version.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/stardis-prog-properties/stardis-prog-properties-config-version.cmake @ONLY) + ############################################################################### # Check dependencies ############################################################################### @@ -89,7 +98,8 @@ include_directories( ${Stardis_INCLUDE_DIR} ${StarSTL_INCLUDE_DIR} ${StarSP_INCLUDE_DIR} - ${CMAKE_CURRENT_BINARY_DIR}) + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/stardis-prog-properties) if(MSVC) include_directories(${MuslGetopt_INCLUDE_DIR}) endif() @@ -114,6 +124,8 @@ if(NOT STARDIS_DOC STREQUAL "NONE") add_subdirectory(doc) endif() +add_subdirectory(stardis-prog-properties) + ############################################################################### # Configure and define targets ############################################################################### @@ -142,9 +154,6 @@ set(SDIS_FILES_SRC stardis-tbound.c stardis-tbound-prog.c) -set(SDIS_FILES_INC_API - stardis-prog.h) - set(SDIS_FILES_INC stardis-app.h stardis-args.h @@ -161,6 +170,7 @@ set(SDIS_FILES_INC stardis-output.h stardis-parsing.h stardis-program.h + stardis-prog-properties.h.in stardis-sfconnect.h stardis-sfconnect-prog.h stardis-ssconnect.h @@ -176,7 +186,6 @@ set(SDIS_FILES_DOC COPYING README.md) # Prepend each file by `SDIS_SOURCE_DIR' rcmake_prepend_path(SDIS_FILES_SRC ${SDIS_SOURCE_DIR}) rcmake_prepend_path(SDIS_FILES_INC ${SDIS_SOURCE_DIR}) -rcmake_prepend_path(SDIS_FILES_INC_API ${SDIS_SOURCE_DIR}) rcmake_prepend_path(SDIS_FILES_DOC ${PROJECT_SOURCE_DIR}/../) add_executable(stardis @@ -203,7 +212,6 @@ install(TARGETS stardis LIBRARY DESTINATION lib RUNTIME DESTINATION bin) -install(FILES ${SDIS_FILES_INC_API} DESTINATION include/) install(FILES ${SDIS_FILES_DOC} DESTINATION share/doc/stardis) rcmake_copy_runtime_libraries(stardis) diff --git a/cmake/stardis-prog-properties/CMakeLists.txt b/cmake/stardis-prog-properties/CMakeLists.txt @@ -0,0 +1,53 @@ +# Copyright (C) 2018-2021 |Meso|Star> (contact@meso-star.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +cmake_minimum_required(VERSION 3.0) + +set(STARDIS_SPROG_DIR ${PROJECT_SOURCE_DIR}/../stardis-prog-properties) + +################################################################################ +# Copy stardis-prog-properties CMake files +################################################################################ +set(SPROG_NAMES + stardis-prog-properties-config) + +set(SPROG_FILES) +foreach(_name IN LISTS SPROG_NAMES) + set(_src ${STARDIS_SPROG_DIR}/${_name}.cmake) + set(_dst ${CMAKE_CURRENT_BINARY_DIR}/${_name}.cmake) + add_custom_command( + OUTPUT ${_dst} + COMMAND ${CMAKE_COMMAND} -E copy ${_src} ${_dst} + DEPENDS ${_src} + COMMENT "Copy the CMake file ${_src}" + VERBATIM) + list(APPEND SPROG_FILES ${_dst}) +endforeach() +add_custom_target(stardis-prog-cmake ALL DEPENDS ${SPROG_FILES}) + +################################################################################ +# Install stardis-prog-properties CMake Files +################################################################################ +list(APPEND SPROG_FILES ${CMAKE_CURRENT_BINARY_DIR}/stardis-prog-properties-config-version.cmake) + +install(FILES ${SPROG_FILES} + DESTINATION lib/cmake/stardis-prog-properties) + +################################################################################ +# Install stardis-prog-properties header Files +################################################################################ +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/stardis-prog-properties.h + DESTINATION include/stardis/) diff --git a/src/stardis-description.c b/src/stardis-description.c @@ -15,7 +15,7 @@ #include "stardis-app.h" #include "stardis-description.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-solid.h" #include "stardis-solid-prog.h" #include "stardis-fluid.h" diff --git a/src/stardis-description.h b/src/stardis-description.h @@ -16,7 +16,7 @@ #ifndef STARDIS_DESCRIPTION_H #define STARDIS_DESCRIPTION_H -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include <rsys/rsys.h> #include <rsys/dynamic_array.h> diff --git a/src/stardis-fbound-prog.c b/src/stardis-fbound-prog.c @@ -15,7 +15,7 @@ #include "stardis-app.h" #include "stardis-fbound-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-intface.h" #include <rsys/rsys.h> diff --git a/src/stardis-fbound-prog.h b/src/stardis-fbound-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct stardis; struct mem_allocator; diff --git a/src/stardis-fluid-prog.c b/src/stardis-fluid-prog.c @@ -15,7 +15,7 @@ #include "stardis-fluid-prog.h" #include "stardis-app.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-app.h" #include <rsys/mem_allocator.h> diff --git a/src/stardis-fluid-prog.h b/src/stardis-fluid-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct stardis; struct mem_allocator; diff --git a/src/stardis-hbound-prog.c b/src/stardis-hbound-prog.c @@ -16,7 +16,7 @@ #include "stardis-app.h" #include "stardis-hbound-prog.h" #include "stardis-fluid-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-intface.h" #include <rsys/rsys.h> diff --git a/src/stardis-hbound-prog.h b/src/stardis-hbound-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct mem_allocator; struct fluid_prog; diff --git a/src/stardis-hbound.h b/src/stardis-hbound.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct mem_allocator; struct fluid; diff --git a/src/stardis-intface.c b/src/stardis-intface.c @@ -28,7 +28,7 @@ #include "stardis-ssconnect-prog.h" #include "stardis-sfconnect.h" #include "stardis-sfconnect-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include <sdis.h> diff --git a/src/stardis-parsing.c b/src/stardis-parsing.c @@ -16,7 +16,7 @@ #define _POSIX_C_SOURCE 200809L /* strdup */ #include "stardis-parsing.h" #include "stardis-app.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-args.h" #include "stardis-description.h" #include "stardis-hbound.h" diff --git a/src/stardis-prog-properties.h.in b/src/stardis-prog-properties.h.in @@ -0,0 +1,501 @@ +/* Copyright (C) 2018-2021 |Meso|Star> (contact@meso-star.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. */ + +#ifndef STARDIS_PROG_H__ +#define STARDIS_PROG_H__ + +/* This header file is intended for inclusion in shared libraries defining + * programmed descriptions used in stardis model files. + * Please refer to stardis(1) and stardis-input(5) man pages for additional + * information. */ + +#define STARDIS_PROG_PROPERTIES_VERSION @STARDIS_PROG_PROPERTIES_VERSION@ + +/*****************************************************************************/ +/* API types. */ +/* The various functions defining programmed descriptions receive arguments */ +/* of the following types when called from the stardis simulation. */ +/*****************************************************************************/ + +struct stardis_vertex { + double P[3]; /* World space position */ + double time; /* "Time" of the vertex */ +}; + +enum stardis_side { + FRONT, + BACK +}; + +struct stardis_interface_fragment { + double P[3]; /* World space position */ + double Ng[3]; /* Normalized world space geometry normal at the interface */ + double uv[2]; /* Parametric coordinates of the interface */ + double time; /* Current time */ + enum stardis_side side; +}; + +enum stardis_return_status { + STARDIS_SUCCESS, + STARDIS_FAILURE +}; + +enum stardis_verbosity_levels { + STARDIS_VERBOSE_NONE, + STARDIS_VERBOSE_ERROR, + STARDIS_VERBOSE_WARNING, + STARDIS_VERBOSE_INFO +}; + +struct stardis_program_context { + const char* name; /* Program name */ + enum stardis_verbosity_levels verbosity_level; +}; + +struct stardis_description_create_context { + const char* name; /* Description name */ +}; + +/******************************************************************************/ +/* Optional functions for any programmed library. */ +/* Either all 3 or none of the 3 following functions must be defined. */ +/* If a libray doesn't need its own data, just let these functions undefined. */ +/******************************************************************************/ + +/* Create the data attached to a given libray. + * A NULL result is interpreted as an error and ends the program. + * This function is called the first time a description using this library is + * processed. + * Args is the end of the description line that was following the library path + * (if any). */ +extern void* +stardis_create_library_data + (const struct stardis_program_context* ctx, + char* args); + +/* Finalize the data created by the successive stardis_create_data calls for + * the descriptions created using this library. + * A STARDIS_FAILURE result ends the program. + * This function is called after descriptions creation, before simulation + * starts. + * Data is the pointer returned by stardis_create_library_data for this + * library. */ +enum stardis_return_status +stardis_finalize_library_data + (void* data); + +/* Release the data created by stardis_create_library_data. + * This function is called after the simulation finished and after releasing + * descriptions data. + * Data is the pointer returned by stardis_create_library_data for this + * library. */ +extern void +stardis_release_library_data + (void* data); + +/******************************************************************************/ +/* Mandatory functions for any programmed description regardless of its type. */ +/******************************************************************************/ + +/* Create the data attached to a given description. + * A NULL result is interpreted as an error and ends the program. + * This function is called every time a description using this library is + * processed. + * Data is the pointer returned by stardis_create_library_data for the library + * or NULL if stardis_create_library_data is not defined. + * Args is the end of the description line that was following the PROG_PARAM + * keyword (if any). */ +extern void* +stardis_create_data + (const struct stardis_description_create_context *ctx, + void* data, + char* args); + +/* Release the data created by stardis_create_data. + * This function is called after the simulation finished. + * Data is the pointer returned by stardis_create_data for the description. */ +extern void +stardis_release_data + (void* data); + +/* Get the copyright notice. + * A NULL result is interpreted as an error and ends the program. + * Data is the pointer returned by stardis_create_data for the description. */ +const char* +get_copyright_notice + (void* data); + +/* Get single-line (name and link?) version of the license. + * A NULL result is interpreted as an error and ends the program. + * Data is the pointer returned by stardis_create_data for the description. */ +const char* +get_license_short + (void* data); + +/* Get full license text. + * A NULL result is interpreted as an error and ends the program. + * Data is the pointer returned by stardis_create_data for the description. */ +const char* +get_license_text + (void* data); + +/*****************************************************************************/ +/* Additional mandatory function declarations (sorted by description type). */ +/* Some functions appear multiple times as they are part of more than one */ +/* description requirement. */ +/*****************************************************************************/ + +/*********************************************************/ +/* Additional mandatory functions for a programmed solid */ +/*********************************************************/ + +/* Returns the calorific capacity at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this solid. + * Data is the pointer returned by stardis_create_data for this solid. */ +extern double +stardis_calorific_capacity + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the volumic mass at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this solid. + * Data is the pointer returned by stardis_create_data for this solid. */ +extern double +stardis_volumic_mass + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the conductivity at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this solid. + * Data is the pointer returned by stardis_create_data for this solid. */ +extern double +stardis_conductivity + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the delta numerical parameter at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this solid. + * Data is the pointer returned by stardis_create_data for this solid. */ +extern double +stardis_delta_solid + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the volumic power at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this solid. + * Data is the pointer returned by stardis_create_data for this solid. */ +extern double +stardis_volumic_power + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the temperature at a given vertex. + * If the temperature is not known/imposed the expected return value is -1. + * This functions is called at every vertex of every path of the computation + * crossing this solid. + * Data is the pointer returned by stardis_create_data for this solid. */ +extern double +stardis_medium_temperature + (const struct stardis_vertex* vtx, + void* data); + +/* Computes the expected temperature range for this solid. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this solid. + * Returns its modified range argument. */ +extern double* +stardis_t_range + (void* data, + double range[2]); + +/*********************************************************/ +/* Additional mandatory functions for a programmed fluid */ +/*********************************************************/ + +/* Returns the calorific capacity at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this fluid. + * Data is the pointer returned by stardis_create_data for this fluid. */ +extern double +stardis_calorific_capacity + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the volumic mass at a given vertex. + * This functions is called at every vertex of every path of the computation + * crossing this fluid. + * Data is the pointer returned by stardis_create_data for this fluid. */ +extern double +stardis_volumic_mass + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the temperature at a given vertex. + * If the temperature is not known/imposed the expected return value is -1. + * This functions is called at every vertex of every path of the computation + * crossing this fluid. + * Data is the pointer returned by stardis_create_data for this fluid. */ +extern double +stardis_medium_temperature + (const struct stardis_vertex* vtx, + void* data); + +/* Computes the expected temperature range for this fluid. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this fluid. + * Returns its modified range argument. */ +extern double* +stardis_t_range + (void* data, + double range[2]); + +/**************************************************************************/ +/* Additional mandatory functions for a programmed H boundary for a fluid */ +/**************************************************************************/ + +/* Returns the boundary temperature at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_boundary_temperature + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the emissivity at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_emissivity + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the specular fraction at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_specular_fraction + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the convection coefficient at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_convection_coefficient + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the reference temperature at a given fragment. + * This temperature is used as a reference to linearize radiative transfer + * in Picard computations. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_reference_temperature + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the upper bound of the convection coefficient accross this boundary. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_max_convection_coefficient + (void* data); + +/* Computes the expected temperature range for this boundary. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this boundary. + * Returns its modified range argument. */ +extern double* +stardis_t_range + (void* data, + double range[2]); + +/**************************************************************************/ +/* Additional mandatory functions for a programmed H boundary for a solid */ +/**************************************************************************/ + +/* Returns the emissivity at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_emissivity + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the specular fraction at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_specular_fraction + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the convection coefficient at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_convection_coefficient + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the reference temperature at a given fragment. + * This temperature is used as a reference to linearize radiative transfer + * in Picard computations. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_reference_temperature + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the temperature at a given vertex. + * The intent is to return the temperature in an implicit fluid enclosing this + * solid. + * This functions is called at every vertex of every path of the computation + * crossing this fluid. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_medium_temperature + (const struct stardis_vertex* vtx, + void* data); + +/* Returns the upper bound of the convection coefficient accross this boundary. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_max_convection_coefficient + (void* data); + +/* Computes the expected temperature range for this boundary. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this boundary. + * Returns its modified range argument. */ +extern double* +stardis_t_range + (void* data, + double range[2]); + +/**************************************************************/ +/* Additional mandatory functions for a programmed T boundary */ +/**************************************************************/ + +/* Returns the boundary temperature at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_boundary_temperature + (const struct stardis_interface_fragment* frag, + void* data); + +/* Computes the expected temperature range for this boundary. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this boundary. + * Returns its modified range argument. */ +extern double* +stardis_t_range + (void* data, + double range[2]); + +/**************************************************************/ +/* Additional mandatory functions for a programmed F boundary */ +/**************************************************************/ + +/* Returns the flux at the boundary at a given fragment. + * This functions is called every time a path of the computation reaches + * this boundary. + * Data is the pointer returned by stardis_create_data for this boundary. */ +extern double +stardis_boundary_flux + (const struct stardis_interface_fragment* frag, + void* data); + +/**************************************************************************/ +/* Additional mandatory functions for a programmed Solid-Solid connection */ +/**************************************************************************/ + +/* Returns the thermal contact resistance at a given fragment. + * This functions is called every time a path of the computation reaches + * this connection. + * Data is the pointer returned by stardis_create_data for this connection. */ +extern double +stardis_thermal_contact_resistance + (const struct stardis_interface_fragment* frag, + void* data); + +/**************************************************************************/ +/* Additional mandatory functions for a programmed Solid-Fluid connection */ +/**************************************************************************/ + +/* Returns the emissivity at a given fragment. + * This functions is called every time a path of the computation reaches + * this connection. + * Data is the pointer returned by stardis_create_data for this connection. */ +extern double +stardis_emissivity + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the specular fraction at a given fragment. + * This functions is called every time a path of the computation reaches + * this connection. + * Data is the pointer returned by stardis_create_data for this connection. */ +extern double +stardis_specular_fraction + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the convection coefficient at a given fragment. + * This functions is called every time a path of the computation reaches + * this connection. + * Data is the pointer returned by stardis_create_data for this connection. */ +extern double +stardis_convection_coefficient + (const struct stardis_interface_fragment* frag, + void* data); + +/* Returns the upper bound of the convection coefficient accross this connection. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this connection. */ +extern double +stardis_max_convection_coefficient + (void* data); + +/* Computes the expected temperature range for this connection. + * This functions is called once when initializing the computation. + * Data is the pointer returned by stardis_create_data for this connection. + * Returns its modified range argument. */ +extern double* +stardis_t_range + (void* data, + double range[2]); + +#endif + diff --git a/src/stardis-prog.h b/src/stardis-prog.h @@ -1,499 +0,0 @@ -/* Copyright (C) 2018-2021 |Meso|Star> (contact@meso-star.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - -#ifndef STARDIS_PROG_H__ -#define STARDIS_PROG_H__ - -/* This header file is intended for inclusion in shared libraries defining - * programmed descriptions used in stardis model files. - * Please refer to stardis(1) and stardis-input(5) man pages for additional - * information. */ - -/*****************************************************************************/ -/* API types. */ -/* The various functions defining programmed descriptions receive arguments */ -/* of the following types when called from the stardis simulation. */ -/*****************************************************************************/ - -struct stardis_vertex { - double P[3]; /* World space position */ - double time; /* "Time" of the vertex */ -}; - -enum stardis_side { - FRONT, - BACK -}; - -struct stardis_interface_fragment { - double P[3]; /* World space position */ - double Ng[3]; /* Normalized world space geometry normal at the interface */ - double uv[2]; /* Parametric coordinates of the interface */ - double time; /* Current time */ - enum stardis_side side; -}; - -enum stardis_return_status { - STARDIS_SUCCESS, - STARDIS_FAILURE -}; - -enum stardis_verbosity_levels { - STARDIS_VERBOSE_NONE, - STARDIS_VERBOSE_ERROR, - STARDIS_VERBOSE_WARNING, - STARDIS_VERBOSE_INFO -}; - -struct stardis_program_context { - const char* name; /* Program name */ - enum stardis_verbosity_levels verbosity_level; -}; - -struct stardis_description_create_context { - const char* name; /* Description name */ -}; - -/******************************************************************************/ -/* Optional functions for any programmed library. */ -/* Either all 3 or none of the 3 following functions must be defined. */ -/* If a libray doesn't need its own data, just let these functions undefined. */ -/******************************************************************************/ - -/* Create the data attached to a given libray. - * A NULL result is interpreted as an error and ends the program. - * This function is called the first time a description using this library is - * processed. - * Args is the end of the description line that was following the library path - * (if any). */ -extern void* -stardis_create_library_data - (const struct stardis_program_context* ctx, - char* args); - -/* Finalize the data created by the successive stardis_create_data calls for - * the descriptions created using this library. - * A STARDIS_FAILURE result ends the program. - * This function is called after descriptions creation, before simulation - * starts. - * Data is the pointer returned by stardis_create_library_data for this - * library. */ -enum stardis_return_status -stardis_finalize_library_data - (void* data); - -/* Release the data created by stardis_create_library_data. - * This function is called after the simulation finished and after releasing - * descriptions data. - * Data is the pointer returned by stardis_create_library_data for this - * library. */ -extern void -stardis_release_library_data - (void* data); - -/******************************************************************************/ -/* Mandatory functions for any programmed description regardless of its type. */ -/******************************************************************************/ - -/* Create the data attached to a given description. - * A NULL result is interpreted as an error and ends the program. - * This function is called every time a description using this library is - * processed. - * Data is the pointer returned by stardis_create_library_data for the library - * or NULL if stardis_create_library_data is not defined. - * Args is the end of the description line that was following the PROG_PARAM - * keyword (if any). */ -extern void* -stardis_create_data - (const struct stardis_description_create_context *ctx, - void* data, - char* args); - -/* Release the data created by stardis_create_data. - * This function is called after the simulation finished. - * Data is the pointer returned by stardis_create_data for the description. */ -extern void -stardis_release_data - (void* data); - -/* Get the copyright notice. - * A NULL result is interpreted as an error and ends the program. - * Data is the pointer returned by stardis_create_data for the description. */ -const char* -get_copyright_notice - (void* data); - -/* Get single-line (name and link?) version of the license. - * A NULL result is interpreted as an error and ends the program. - * Data is the pointer returned by stardis_create_data for the description. */ -const char* -get_license_short - (void* data); - -/* Get full license text. - * A NULL result is interpreted as an error and ends the program. - * Data is the pointer returned by stardis_create_data for the description. */ -const char* -get_license_text - (void* data); - -/*****************************************************************************/ -/* Additional mandatory function declarations (sorted by description type). */ -/* Some functions appear multiple times as they are part of more than one */ -/* description requirement. */ -/*****************************************************************************/ - -/*********************************************************/ -/* Additional mandatory functions for a programmed solid */ -/*********************************************************/ - -/* Returns the calorific capacity at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this solid. - * Data is the pointer returned by stardis_create_data for this solid. */ -extern double -stardis_calorific_capacity - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the volumic mass at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this solid. - * Data is the pointer returned by stardis_create_data for this solid. */ -extern double -stardis_volumic_mass - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the conductivity at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this solid. - * Data is the pointer returned by stardis_create_data for this solid. */ -extern double -stardis_conductivity - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the delta numerical parameter at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this solid. - * Data is the pointer returned by stardis_create_data for this solid. */ -extern double -stardis_delta_solid - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the volumic power at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this solid. - * Data is the pointer returned by stardis_create_data for this solid. */ -extern double -stardis_volumic_power - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the temperature at a given vertex. - * If the temperature is not known/imposed the expected return value is -1. - * This functions is called at every vertex of every path of the computation - * crossing this solid. - * Data is the pointer returned by stardis_create_data for this solid. */ -extern double -stardis_medium_temperature - (const struct stardis_vertex* vtx, - void* data); - -/* Computes the expected temperature range for this solid. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this solid. - * Returns its modified range argument. */ -extern double* -stardis_t_range - (void* data, - double range[2]); - -/*********************************************************/ -/* Additional mandatory functions for a programmed fluid */ -/*********************************************************/ - -/* Returns the calorific capacity at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this fluid. - * Data is the pointer returned by stardis_create_data for this fluid. */ -extern double -stardis_calorific_capacity - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the volumic mass at a given vertex. - * This functions is called at every vertex of every path of the computation - * crossing this fluid. - * Data is the pointer returned by stardis_create_data for this fluid. */ -extern double -stardis_volumic_mass - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the temperature at a given vertex. - * If the temperature is not known/imposed the expected return value is -1. - * This functions is called at every vertex of every path of the computation - * crossing this fluid. - * Data is the pointer returned by stardis_create_data for this fluid. */ -extern double -stardis_medium_temperature - (const struct stardis_vertex* vtx, - void* data); - -/* Computes the expected temperature range for this fluid. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this fluid. - * Returns its modified range argument. */ -extern double* -stardis_t_range - (void* data, - double range[2]); - -/**************************************************************************/ -/* Additional mandatory functions for a programmed H boundary for a fluid */ -/**************************************************************************/ - -/* Returns the boundary temperature at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_boundary_temperature - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the emissivity at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_emissivity - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the specular fraction at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_specular_fraction - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the convection coefficient at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_convection_coefficient - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the reference temperature at a given fragment. - * This temperature is used as a reference to linearize radiative transfer - * in Picard computations. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_reference_temperature - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the upper bound of the convection coefficient accross this boundary. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_max_convection_coefficient - (void* data); - -/* Computes the expected temperature range for this boundary. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this boundary. - * Returns its modified range argument. */ -extern double* -stardis_t_range - (void* data, - double range[2]); - -/**************************************************************************/ -/* Additional mandatory functions for a programmed H boundary for a solid */ -/**************************************************************************/ - -/* Returns the emissivity at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_emissivity - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the specular fraction at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_specular_fraction - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the convection coefficient at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_convection_coefficient - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the reference temperature at a given fragment. - * This temperature is used as a reference to linearize radiative transfer - * in Picard computations. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_reference_temperature - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the temperature at a given vertex. - * The intent is to return the temperature in an implicit fluid enclosing this - * solid. - * This functions is called at every vertex of every path of the computation - * crossing this fluid. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_medium_temperature - (const struct stardis_vertex* vtx, - void* data); - -/* Returns the upper bound of the convection coefficient accross this boundary. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_max_convection_coefficient - (void* data); - -/* Computes the expected temperature range for this boundary. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this boundary. - * Returns its modified range argument. */ -extern double* -stardis_t_range - (void* data, - double range[2]); - -/**************************************************************/ -/* Additional mandatory functions for a programmed T boundary */ -/**************************************************************/ - -/* Returns the boundary temperature at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_boundary_temperature - (const struct stardis_interface_fragment* frag, - void* data); - -/* Computes the expected temperature range for this boundary. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this boundary. - * Returns its modified range argument. */ -extern double* -stardis_t_range - (void* data, - double range[2]); - -/**************************************************************/ -/* Additional mandatory functions for a programmed F boundary */ -/**************************************************************/ - -/* Returns the flux at the boundary at a given fragment. - * This functions is called every time a path of the computation reaches - * this boundary. - * Data is the pointer returned by stardis_create_data for this boundary. */ -extern double -stardis_boundary_flux - (const struct stardis_interface_fragment* frag, - void* data); - -/**************************************************************************/ -/* Additional mandatory functions for a programmed Solid-Solid connection */ -/**************************************************************************/ - -/* Returns the thermal contact resistance at a given fragment. - * This functions is called every time a path of the computation reaches - * this connection. - * Data is the pointer returned by stardis_create_data for this connection. */ -extern double -stardis_thermal_contact_resistance - (const struct stardis_interface_fragment* frag, - void* data); - -/**************************************************************************/ -/* Additional mandatory functions for a programmed Solid-Fluid connection */ -/**************************************************************************/ - -/* Returns the emissivity at a given fragment. - * This functions is called every time a path of the computation reaches - * this connection. - * Data is the pointer returned by stardis_create_data for this connection. */ -extern double -stardis_emissivity - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the specular fraction at a given fragment. - * This functions is called every time a path of the computation reaches - * this connection. - * Data is the pointer returned by stardis_create_data for this connection. */ -extern double -stardis_specular_fraction - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the convection coefficient at a given fragment. - * This functions is called every time a path of the computation reaches - * this connection. - * Data is the pointer returned by stardis_create_data for this connection. */ -extern double -stardis_convection_coefficient - (const struct stardis_interface_fragment* frag, - void* data); - -/* Returns the upper bound of the convection coefficient accross this connection. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this connection. */ -extern double -stardis_max_convection_coefficient - (void* data); - -/* Computes the expected temperature range for this connection. - * This functions is called once when initializing the computation. - * Data is the pointer returned by stardis_create_data for this connection. - * Returns its modified range argument. */ -extern double* -stardis_t_range - (void* data, - double range[2]); - -#endif - diff --git a/src/stardis-program.h b/src/stardis-program.h @@ -18,7 +18,7 @@ #include "stardis-app.h" -#include <stardis-prog.h> +#include <stardis-prog-properties.h> #include <rsys/rsys.h> #include <rsys/str.h> diff --git a/src/stardis-sfconnect-prog.c b/src/stardis-sfconnect-prog.c @@ -15,7 +15,7 @@ #include "stardis-app.h" #include "stardis-sfconnect-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-intface.h" #include <rsys/rsys.h> diff --git a/src/stardis-sfconnect-prog.h b/src/stardis-sfconnect-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct stardis; struct mem_allocator; diff --git a/src/stardis-solid-prog.c b/src/stardis-solid-prog.c @@ -14,7 +14,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "stardis-solid-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-app.h" #include <rsys/mem_allocator.h> diff --git a/src/stardis-solid-prog.h b/src/stardis-solid-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct stardis; struct mem_allocator; diff --git a/src/stardis-ssconnect-prog.c b/src/stardis-ssconnect-prog.c @@ -15,7 +15,7 @@ #include "stardis-app.h" #include "stardis-ssconnect-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-intface.h" #include <rsys/rsys.h> diff --git a/src/stardis-ssconnect-prog.h b/src/stardis-ssconnect-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct stardis; struct mem_allocator; diff --git a/src/stardis-tbound-prog.c b/src/stardis-tbound-prog.c @@ -15,7 +15,7 @@ #include "stardis-app.h" #include "stardis-tbound-prog.h" -#include "stardis-prog.h" +#include "stardis-prog-properties.h" #include "stardis-intface.h" #include <rsys/rsys.h> diff --git a/src/stardis-tbound-prog.h b/src/stardis-tbound-prog.h @@ -19,7 +19,7 @@ #include <rsys/rsys.h> #include <rsys/str.h> -#include "stardis-prog.h" +#include "stardis-prog-properties.h" struct mem_allocator; struct program; diff --git a/stardis-prog-properties/stardis-prog-properties-config-version.cmake.in b/stardis-prog-properties/stardis-prog-properties-config-version.cmake.in @@ -0,0 +1,22 @@ +# Copyright (C) 2018-2022 |Meso|Star> (contact@meso-star.com) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +SET(PACKAGE_VERSION @STARDIS_PROG_PROPERTIES_VERSION@) + +IF (${PACKAGE_FIND_VERSION_MAJOR} EQUAL @STARDIS_PROG_PROPERTIES_VERSION@) + SET(PACKAGE_VERSION_COMPATIBLE 1) +ELSE() + SET(PACKAGE_VERSION_UNSUITABLE 1) +ENDIF() diff --git a/stardis-prog-properties/stardis-prog-properties-config.cmake b/stardis-prog-properties/stardis-prog-properties-config.cmake @@ -0,0 +1,28 @@ +# Copyright (C) 2013-2017, 2021 Vincent Forest (vaplv@free.fr) +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +cmake_minimum_required(VERSION 3.1) +include(SelectLibraryConfigurations) + +# Try to find stardis-prog-properties + +# Look for stardis-prog-properties header +find_path(SPROG_INCLUDE_DIR stardis/stardis-prog-properties.h) + +# Check the package +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(stardis-prog-properties DEFAULT_MSG + SPROG_INCLUDE_DIR) +