diff --git a/docs/source/plugins/99_1_solver_api_reference.rst b/docs/source/plugins/99_1_solver_api_reference.rst index a91a50d5..32b1beb6 100644 --- a/docs/source/plugins/99_1_solver_api_reference.rst +++ b/docs/source/plugins/99_1_solver_api_reference.rst @@ -155,6 +155,8 @@ ALFAsim's Solver Data Changing the contents retrieved by this function (`out` array) has **UNDEFINED BEHAVIOR**. The plugin must **NEVER** change the contents returned by this function. +.. doxygenfunction:: set_wall_properties + .. doxygenfunction:: get_wall_material_type .. doxygenfunction:: get_tracer_id diff --git a/src/alfasim_sdk/alfasim_sdk_api/api.h b/src/alfasim_sdk/alfasim_sdk_api/api.h index 72a8358b..6489ec17 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/api.h +++ b/src/alfasim_sdk/alfasim_sdk_api/api.h @@ -880,6 +880,47 @@ DLL_EXPORT int get_liq_liq_flow_pattern_input_variable( DLL_EXPORT int get_wall_properties(void* ctx, double** prop_values, const char* prop_name, int control_volume_id, int* size); +/*! + Sets a property value in a given control value and layer. + + List of `prop_name`: + - `"rho"`: Wall Density [kg/m3] + - `"cp"`: Wall Specific Heat Capacity [J/kg.K] + - `"volumetric_thermal_expansion"`: Wall Volumetric Thermal Expansion [1/K] + - `"mu"`: Wall dynamic viscosity [Pa.s] + - `"k"` : Wall Thermal Conductivity [W/m.degC] + + Example of usage: + + ~~~~~{.cpp} + + [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} + double new_rho = 800; + int control_volume_id = control_volume_1; + int layer_id = prop_wall_1; + + errcode = set_wall_properties( + ctx, new_rho, "rho", control_volume_id, layer_id); + ~~~~~ + + @param[in] ctx ALFAsim's plugins context. + @param[in] prop_value Property value that will be set + @param[in] prop_name String with the property name. See the list of possible values above. + @param[in] control_volume_id Control volume id. + @param[in] layer_id Layer id. + @return An #error_code value. +*/ +DLL_EXPORT int set_wall_properties(void* ctx, double prop_value, const char* prop_name, int control_volume_id, int layer_id); + /*! Gets the names of the materials presented in each layer of the wall for a given control volume. The names will be given as an array of char pointers. 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 18397503..43fa2036 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h @@ -81,6 +81,13 @@ using get_wall_properties_func = int (*) ( int control_volume_id, int* size ); +using set_wall_properties_func = int (*) ( + void* ctx, + double prop_value, + const char* prop_name, + int control_volume_id, + int layer_id + ); using get_wall_material_names_func = int (*) ( void* ctx, char*** wall_names, @@ -179,6 +186,7 @@ struct ALFAsimSDK_API { get_wall_interfaces_temperature_func get_wall_interfaces_temperature; get_wall_properties_func get_wall_properties; + set_wall_properties_func set_wall_properties; get_wall_material_names_func get_wall_material_names; get_wall_material_type_func get_wall_material_type; 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 2b6b98cc..02b00791 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h @@ -78,6 +78,7 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api) 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->set_wall_properties = (set_wall_properties_func)dlsym(api->handle, "set_wall_properties"); api->get_wall_material_names = (get_wall_material_names_func)dlsym(api->handle, "get_wall_material_names"); api->get_wall_material_type = (get_wall_material_type_func)dlsym(api->handle, "get_wall_material_type"); api->get_flow_pattern = (get_flow_pattern_func)dlsym(api->handle, "get_flow_pattern"); 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 e1206dc2..9b56fce0 100644 --- a/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h +++ b/src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h @@ -102,6 +102,7 @@ inline int alfasim_sdk_open(ALFAsimSDK_API* api) 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->set_wall_properties = (set_wall_properties_func)GetProcAddress(api->handle, "set_wall_properties"); api->get_wall_material_names = (get_wall_material_names_func)GetProcAddress(api->handle, "get_wall_material_names"); api->get_wall_material_type = (get_wall_material_type_func)GetProcAddress(api->handle, "get_wall_material_type"); api->get_flow_pattern = (get_flow_pattern_func)GetProcAddress(api->handle, "get_flow_pattern");