Recover T from h and refresh cp/lambda/rho_thermo in one Cantera sync.
This is the preferred energy-step thermo sync routine:
(T, cp, lambda, rho_thermo) = sync(h, Y, p0). It preserves the
transported sensible enthalpy field and updates only derived thermo
state: T, cp, lambda, and diagnostic rho_thermo.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
subroutine recover_temperature_and_update_thermo_cantera(mesh,params,energy,species_Y)type(mesh_t),intent(in)::meshtype(case_params_t),intent(in)::paramstype(energy_fields_t),intent(inout)::energyreal(rk),intent(in),optional::species_Y(:,:)integer::n_lenreal(rk),allocatable::P_arr(:),Y_local(:,:)character(kind=c_char),allocatable::c_names_flat(:)if(.not.params%enable_cantera_thermo)return if(params%nspecies<=0)then call fatal_error('energy','enable_cantera_thermo requires at least one inert thermo species')end if allocate(P_arr(mesh%ncells))P_arr=params%background_presscall build_thermo_Y(params,mesh%ncells,Y_local,species_Y)call build_c_species_names(params,c_names_flat,n_len)call cantera_recover_temperature_and_update_thermo_c(mesh%ncells,&energy%h,&P_arr,¶ms%nspecies,&Y_local,&energy%T,&energy%cp,&energy%lambda,&energy%rho_thermo,¶ms%energy_reference_T,&c_names_flat,&n_len)deallocate(P_arr)deallocate(Y_local)deallocate(c_names_flat)end subroutine recover_temperature_and_update_thermo_cantera