From 45f922c4294f6e87ad94b986b3fd4799d5f29a65 Mon Sep 17 00:00:00 2001 From: Alexandre Barbosa Bruno Date: Wed, 21 Aug 2024 10:30:48 -0300 Subject: [PATCH] add get_wall_properties --- src/alfasim_sdk/alfasim_sdk_api/api.h | 45 +++++++++++++++++++ .../alfasim_sdk_api/detail/api_pointers.h | 10 +++++ .../alfasim_sdk_api/detail/bootstrap_linux.h | 1 + .../alfasim_sdk_api/detail/bootstrap_win.h | 1 + 4 files changed, 57 insertions(+) diff --git a/src/alfasim_sdk/alfasim_sdk_api/api.h b/src/alfasim_sdk/alfasim_sdk_api/api.h index af807a6f..a2ea880d 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/api.h +++ b/src/alfasim_sdk/alfasim_sdk_api/api.h @@ -812,6 +812,51 @@ DLL_EXPORT int get_liq_liq_flow_pattern_input_variable( void* ctx, double* out, const char* var_name, int phase_id ); +/*! + Gets the wall names and wall properties for a given control volume. The wall names will be given + as an array of char pointers and the properties by an array data pointer. This method also provide the + size of the given arrays. + + IMPORTANT: + The given wall can be a fluid or solid, be aware of this when you start to use the properties. + List of fluid properties: + - Volumetric Thermal Expansion + - Dynamic Viscosity + + List of `prop_name`: + - `"layer_thickness"`: Wall Layer Thickness [m] + - `"rho"`: Wall Density [kg/m3] + - `"cp"`: Wall Specific Heat Capacity [J/kg.K] + - `"volumetric_thermal_expansion"`: Wall Volumetric Thermal Expansion [1/K] + - `"cP"`: Wall dynamic viscosity [cP] + - `"k"` : Wall Thermal Conductivity [W/m.degC] + - `"layer_is_fluid"`: Informs if the wall is a fluid [1 - is fluid; 0 - is not fluid] + + Example of usage: + + [prop_wall_4] + [prop_wall_3] [prop_wall_3] + [prop_wall_2] [prop_wall_2] [prop_wall_2] + [prop_wall_1] [prop_wall_1] [prop_wall_1] + [prop_wall_0] [prop_wall_0] [prop_wall_0] + | | | + ---[control_volume_1]--[control_volume_2]--[control_volume_3]--> (Pipe) + + ~~~~~{.cpp} + errcode = get_wall_properties( + ctx, &wall_names, &prop_values, "layer_thickness", control_volume_id, &size_wall); + ~~~~~ + + @param[in] ctx ALFAsim's plugins context. + @param[out] wall_names Wall names values array. + @param[out] prop_values Wall properties values array. + @param[in] prop_name String with the property name. See the list of possible values above. + @param[in] control_volume Control volume id. + @param[out] size Size of the `wall_names` and `prop_values` array of values. + @return An #error_code value. +*/ +DLL_EXPORT int get_wall_properties(void* ctx, char*** wall_names, void** prop_values, const char* prop_name, int control_volume, int* size); + /*! Gets the current input data for liquid effective viscosity calculation. Any available variable by this function is considered for a control volume, which means that there are variables with one diff --git a/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h b/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h index e0b39789..8147a43e 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h @@ -74,6 +74,14 @@ using get_wall_interfaces_temperature_func = int (*)( enum TimestepScope ts_scope, int* size ); +using get_wall_properties_func = int (*) ( + void* ctx, + char*** wall_names, + void** prop_values, + const char* prop_name, + int control_volume, + int* size + ); using get_flow_pattern_func = int (*)( void* ctx, int** out, @@ -154,6 +162,8 @@ struct ALFAsimSDK_API { get_wall_interfaces_temperature_func get_wall_interfaces_temperature; + get_wall_properties_func get_wall_properties; + get_input_variable_func get_ucm_friction_factor_input_variable; get_ucm_fluid_geometrical_properties_func get_ucm_fluid_geometrical_properties; get_input_variable_func get_liq_liq_flow_pattern_input_variable; diff --git a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h index 44285089..3d3aad80 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h @@ -77,6 +77,7 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api) api->get_simulation_tracer_array = (get_simulation_tracer_array_func)dlsym(api->handle, "get_simulation_tracer_array"); api->get_simulation_quantity = (get_simulation_quantity_func)dlsym(api->handle, "get_simulation_quantity"); api->get_wall_interfaces_temperature = (get_wall_interfaces_temperature_func)dlsym(api->handle, "get_wall_interfaces_temperature"); + api->get_wall_properties = (get_wall_properties_func)dlsym(api->handle, "get_wall_properties"); api->get_flow_pattern = (get_flow_pattern_func)dlsym(api->handle, "get_flow_pattern"); api->get_liqliq_flow_pattern = (get_flow_pattern_func)dlsym(api->handle, "get_liqliq_flow_pattern"); api->get_deposition_thickness = (get_deposition_thickness_func)dlsym(api->handle, "get_deposition_thickness"); diff --git a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h index 797eb24b..7d05c332 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h @@ -101,6 +101,7 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api) api->get_simulation_tracer_array = (get_simulation_tracer_array_func)GetProcAddress(api->handle, "get_simulation_tracer_array"); api->get_simulation_quantity = (get_simulation_quantity_func)GetProcAddress(api->handle, "get_simulation_quantity"); api->get_wall_interfaces_temperature = (get_wall_interfaces_temperature_func)GetProcAddress(api->handle, "get_wall_interfaces_temperature"); + api->get_wall_properties = (get_wall_properties_func)GetProcAddress(api->handle, "get_wall_properties"); api->get_flow_pattern = (get_flow_pattern_func)GetProcAddress(api->handle, "get_flow_pattern"); api->get_liqliq_flow_pattern = (get_flow_pattern_func)GetProcAddress(api->handle, "get_liqliq_flow_pattern"); api->get_deposition_thickness = (get_deposition_thickness_func)GetProcAddress(api->handle, "get_deposition_thickness");