Is there a way to update the source term for each cell in a cell zone based on temperature?

Josip Zlatic
Josip Zlatic Member Posts: 1 **

I want to update the Source Term value at each time step for cells in a specific cell zone. Each cell should have its own Source Term, which is dependent on the cell's temperature.

The current path I have so far is outlined below. I’m open to alternative approaches or suggestions.

I can successfully extract temperature values for a particular cell zone:

solution_variable_data = solver.fields.solution_variable_data 
temperature_variable_name = "SV_T" 
zone_name_of_interest = "solid-domain" 

solid_temperature_data = solution_variable_data.get_data( solution_variable_name=temperature_variable_name, zone_names=[zone_name_of_interest] ) 

solid_temperature_array = solid_temperature_data[zone_name_of_interest] 

print(f"Temperature values per cell for '{zone_name_of_interest}' zone:") 
print(solid_temperature_array) 

This gives me a temperature array, for example:

Temperature values per cell for 'solid-domain' zone:
[330.0174514 320.83986487 319.86347747 318.75959484 317.74848136
316.74672008 315.74109096 314.68934224 313.20305164 312.63215653]

I want to compute a source term by multiplying each of these temperatures by specific coefficients (dependent on the temperature value), resulting in an array of the same size.

The challenge:
Is there a straightforward way to apply this computed array as a source term for the exact same cells from which the temperature data was extracted?

Tagged: