Skip to content

Commit

Permalink
Make plugin set wall property (#405)
Browse files Browse the repository at this point in the history
* add set_wall_properties

* update parameters methods order

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
alexandrebbruno and pre-commit-ci[bot] authored Sep 23, 2024
1 parent 7e6e2ec commit a46dd8e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/source/plugins/99_1_solver_api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
41 changes: 41 additions & 0 deletions src/alfasim_sdk/alfasim_sdk_api/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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, "rho", new_rho, control_volume_id, layer_id);
~~~~~
@param[in] ctx ALFAsim's plugins context.
@param[in] prop_name String with the property name. See the list of possible values above.
@param[in] prop_value Property value that will be set.
@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, const char* prop_name, double prop_value, 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.
Expand Down
8 changes: 8 additions & 0 deletions src/alfasim_sdk/alfasim_sdk_api/detail/api_pointers.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ using get_wall_properties_func = int (*) (
int control_volume_id,
int* size
);
using set_wall_properties_func = int (*) (
void* ctx,
const char* prop_name,
double prop_value,
int control_volume_id,
int layer_id
);
using get_wall_material_names_func = int (*) (
void* ctx,
char*** wall_names,
Expand Down Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/alfasim_sdk/alfasim_sdk_api/detail/bootstrap_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a46dd8e

Please sign in to comment.