TAGGED: ansys-fluent, cfd, dpm, udf-fluent
-
-
December 2, 2020 at 10:47 pmalikuyukSubscriber
Dear ANSYS Community,
I hope you are all doing well.
I am trying to simulate a spray system to replicate a wind-tunnel + spray cooling experiment. Although, the DPM module is perfect and gives me good results, when I have to run some specific cooling conditions, I receive more than 100% RH at the outlet. After some research, I have come across the DPM_SWITCH code in the manual.
Nonetheless, I am having some trouble running the code. Even though it compiles fine under Fluent.
Here is some background information about my model:
Inlet air mass flow: 0.5 kg/s - RH: 51% @25 Deg C.
Water Injection: 0.27 kg/s @5 Deg C.
Geometry:
December 2, 2020 at 10:52 pmalikuyukSubscriberAlso, here is the code:n/**********************************************************************nConcatenated UDFs for the Discrete Phase Model includingnan implementation of a condensation modelnan example for the use of DPM_SWITCHn***********************************************************************/n#include "udf.h"n#include "dpm.h"n#define UDM_RH 0 /* no. of UDM holding relative humidity */n#define N_REQ_UDM 1 /* 1 more than UDM_RH */n#define CONDENS 1.0e-4 /* a condensation rate constant */nint h2o_index=0; /* index of water vapor species in mixture material */nreal mw_h2o=18.; /* molecular weight of water */nreal H2O_Saturation_Pressure(real T)n{nreal ratio, aTmTp;nT = MAX(T, 273);nT = MIN(T, 647.286);naTmTp = .01 * (T - 338.15);nratio = (647.286 / T - 1.) *n(-7.419242 + aTmTp * (.29721 +naTmTp * (-.1155286 +naTmTp * (8.685635e-3 +naTmTp * (1.094098e-3 +naTmTp * (-4.39993e-3 +naTmTp * (2.520658e-3 -naTmTp * 5.218684e-4)))))));nreturn (22.089e6 * exp(MIN(ratio, 35.)));n}nreal myHumidity(cell_t c, Thread *t)n{nint i;nMaterial *m = THREAD_MATERIAL(t), *sp;nreal yi_h2o = 0; /* water mass fraction */nreal r_mix = 0.0; /* sum of [mass fraction / mol. weight] over all species */nreal humidity;nif ((MATERIAL_TYPE(m) == MATERIAL_MIXTURE) && (FLUID_THREAD_P(t)))n{nyi_h2o = C_YI(c, t, h2o_index); /* water vapor mass fraction */nmixture_species_loop(m, sp, i)n{nr_mix += C_YI(c,t,i) / MATERIAL_PROP(sp, PROP_mwi);n}nhumidity = op_pres * yi_h2o / (mw_h2o * r_mix) /nH2O_Saturation_Pressure(C_T(c,t));nreturn humidity;n}nelsenreturn 0.;n}nDEFINE_DPM_LAW(condenshumidlaw, p, coupled)n{nreal area;nreal mp_dot;n/* Get Cell and Thread from Particle Structure */ncell_t c = P_CELL(p);nThread *t = P_CELL_THREAD(p);narea = 4.0 * M_PI * (P_DIAM(p) * P_DIAM(p));n/* Note This law only used if Humidity > 1.0 so mp_dot always positive*/nmp_dot = CONDENS * sqrt(area) * (myHumidity(c, t) - 1.0);nif (mp_dot > 0.0)n{nP_MASS(p) += mp_dot * P_DT(p);nP_DIAM(p) = pow(6.0 * P_MASS(p) / (P_RHO(p) * M_PI), 1./3.);n}n/* Assume condensing particle is in thermal equilibrium with fluid in cell */nP_T(p) = C_T(c,t);n}nDEFINE_DPM_SOURCE(dpm_source, c, t, S, strength, p)n{nreal mp_dot;n/* mp_dot is the mass source to the continuous phasen* (Difference in mass between entry and exit from cell)n* multiplied by strength (Number of particles/s in stream)n*/nmp_dot = (P_MASS0(p) - P_MASS(p)) * strength;nif (P_CURRENT_LAW(p) == DPM_LAW_USER_1)n{n/* Sources relevant to the user law 1:n* add the source to the condensing speciesn* equation and adjust the energy source byn* adding the latent heat at reference temperaturen*/nS->species[h2o_index] += mp_dot;nS->energy -= mp_dot * P_INJECTION(p)->latent_heat_ref;n}n}nDEFINE_DPM_SWITCH(dpm_switch, p, coupled)n{ncell_t c = P_CELL(p);nThread *t = P_CELL_THREAD(p);nMaterial *m = P_MATERIAL(p);n/* If the relative humidity is higher than 1n* and the particle temperature below the boiling temperaturen* switch to condensation lawn*/nif ((C_UDMI(c,t,UDM_RH) > 1.0) && (P_T(p) < DPM_BOILING_TEMPERATURE(p, m)))nP_CURRENT_LAW(p) = DPM_LAW_USER_1;nelsenP_CURRENT_LAW(p) = DPM_LAW_INITIAL_INERT_HEATING;n}nDEFINE_ADJUST(adj_relhum, domain)n{ncell_t cell;nThread *thread;nif(sg_udm < N_REQ_UDM)nMessage("\Not enough user defined memory allocated. %d required.\",nN_REQ_UDM);nelsen{nreal humidity, min, max;nmin = 1e10;nmax = 0.0;nthread_loop_c(thread, domain)n{n/* Check if thread is a Fluid thread and has UDMs set up on it */nif (FLUID_THREAD_P(thread) &&ULLP(THREAD_STORAGE(thread, SV_UDM_I)))n{nMaterial *m = THREAD_MATERIAL(thread), *sp;nint i;n/* Set the species index and molecular weight of water */nif (MATERIAL_TYPE(m) == MATERIAL_MIXTURE)nmixture_species_loop (m,sp,i)n{nif (0 == strcmp(MIXTURE_SPECIE_NAME(m,i),"h2o") ||n(0 == strcmp(MIXTURE_SPECIE_NAME(m,i),"H2O")))n{nh2o_index = i;nmw_h2o = MATERIAL_PROP(sp,PROP_mwi);n}n}nbegin_c_loop(cell,thread)n{nhumidity = myHumidity(cell, thread);nmin = MIN(min, humidity);nmax = MAX(max, humidity);nC_UDMI(cell, thread, UDM_RH) = humidity;n}nend_c_loop(cell, thread)n}n}nMessage("\Relative Humidity set in udm-%d", UDM_RH);nMessage(" range:(%f,%f)\", min, max);n}/* end if for enough UDSs and UDMs */n}nDEFINE_ON_DEMAND(set_relhum)n{nadj_relhum(Get_Domain(1));December 3, 2020 at 1:53 pmRobForum ModeratorI assume that you assigned enough UDM in the solver? I've not read, and am not going to, the rest of the code. nDecember 3, 2020 at 11:05 pmalikuyukSubscriberHey Rob, nThanks for the reply. Now that you are saying that, I think that might be my problem. Could you please help me on how to fix that one? nCheers,nDecember 4, 2020 at 10:44 amRobForum ModeratorIn User Defined you need to switch on the memory locations before loading the UDF. We assume zero by default as it saves memory/file size. You need a memory (and/or scalar) available for the above UDF. nDecember 4, 2020 at 8:15 pmAmine Ben Hadj AliAnsys EmployeeYou should in addition hook the dpm law. And update to a supported release.nViewing 5 reply threads- The topic ‘DPM Water Spray Model Customizing for ‘Condensation’ with DPM_SWITCH UDF’ is closed to new replies.
Ansys Innovation SpaceTrending discussions- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Cyclone (Stairmand) simulation using RSM
- error udf
- Diesel with Ammonia/Hydrogen blend combustion
- Fluent fails with Intel MPI protocol on 2 nodes
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Script error Code: 800a000d
- Encountering Error in Heterogeneous Surface Reaction
Top Contributors-
1191
-
513
-
488
-
225
-
209
Top Rated Tags© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
The Ansys Learning Forum is a public forum. You are prohibited from providing (i) information that is confidential to You, your employer, or any third party, (ii) Personal Data or individually identifiable health information, (iii) any information that is U.S. Government Classified, Controlled Unclassified Information, International Traffic in Arms Regulators (ITAR) or Export Administration Regulators (EAR) controlled or otherwise have been determined by the United States Government or by a foreign government to require protection against unauthorized disclosure for reasons of national security, or (iv) topics or information restricted by the People's Republic of China data protection and privacy laws.