loops - Modelica: Program a static solver to converge to a solution during the simulation. CFD example -
loops - Modelica: Program a static solver to converge to a solution during the simulation. CFD example -
generic question:
i work on modelica openmodelica. programme own solver in modelica converge solution because think openmodelica can't solve problem. possible?
specific case:
i developed model of separation of air in fluid dynamic component. model based on info table provide coefficient of pressure level loss each branche depending of velocities in component , parameter "section". model works when utilize massflow sources not when utilize pressure level source. see pictures below understand connection component:
http://www.casimages.com/img.php?i=140620024048704083.png
http://www.casimages.com/img.php?i=140620024137384886.png
the code of model "separation" one:
model separation replaceable bundle medium = modelica.media.interfaces.partialmedium "medium in component"; modelica.fluid.interfaces.fluidport_a port_a(redeclare bundle medium = medium); modelica.fluid.interfaces.fluidport_b port_b2(redeclare bundle medium = medium); modelica.fluid.interfaces.fluidport_b port_b1(redeclare bundle medium = medium); modelica.blocks.tables.combitable2d coeff_pdc1(table = [0, 0, 0.4, 0.5, 0.6, 0.7, 0.8, 1; 0, 1, 1, 1, 1, 1, 1, 1; 0.1, 0.81, 0.81, 0.81, 0.81, 0.81, 0.81, 0.81; 0.2, 0.64, 0.64, 0.64, 0.64, 0.64, 0.64, 0.64; 0.3, 0.5, 0.5, 0.52, 0.52, 0.5, 0.5, 0.5; 0.4, 0.36, 0.36, 0.4, 0.38, 0.37, 0.36, 0.36; 0.5, 0.25, 0.25, 0.3, 0.28, 0.26, 0.25, 0.25; 0.6, 0.16, 0.16, 0.23, 0.2, 0.18, 0.16, 0.16; 0.8, 0.04, 0.04, 0.16, 0.12, 0.07, 0.04, 0.04; 1, 0.001, 0.001, 0.2, 0.1, 0.05, 0.001, 0.001; 1.2, 0.07, 0.07, 0.36, 0.21, 0.14, 0.07, 0.07; 1.4, 0.39, 0.39, 0.78, 0.59, 0.49, 50, 50; 1.6, 0.9, 0.9, 1.36, 1.15, 50, 50, 50; 1.8, 1.78, 1.78, 2.43, 50, 50, 50, 50; 2, 3.2, 3.2, 4, 50, 50, 50, 50]); modelica.blocks.tables.combitable1ds coeff_pdc2( table = [0.1, 1; 0.2, 1; 0.3, 1; 0.4, 1; 0.5, 1; 0.6, 1; 0.8, 1; 1,1; 1.2, 1; 1.4, 1; 1.6, 1; 1.8, 1; 2, 1]); real dp_b1 "en pa, perte de charge entre les ports a1 et b"; real dp_b2 "en pa, perte de charge entre les ports a2 et b"; modelica.siunits.velocity v_a(start = 0); modelica.siunits.velocity v_b1(start = 0); modelica.siunits.velocity v_b2(start = 0); parameter real rho=1.2; parameter modelica.siunits.area surface_b1 = 1; parameter modelica.siunits.area surface_b2 = 1; parameter modelica.siunits.area surface_a = 2; equation coeff_pdc1.u1 = if noevent(abs(v_a) > 0) v_b1/v_a else 1; coeff_pdc1.u2 = surface_b1/surface_a; coeff_pdc2.u = if noevent(abs(v_a) > 0) v_b2/v_a else 1; v_a = abs(port_a.m_flow)/rho/surface_a; v_b1 = abs(port_b1.m_flow)/rho/surface_b1; v_b2 = abs(port_b2.m_flow)/rho/surface_b2; port_b1.p - port_a.p = dp_b1; dp_b1 = 1/2*coeff_pdc1.y*port_b1.m_flow^2/surface_b1^2/rho; port_b2.p - port_a.p = dp_b2; dp_b2 = 1/2*coeff_pdc2.y[1]*port_b2.m_flow^2/surface_b2^2/rho; port_b1.m_flow + port_b2.m_flow + port_a.m_flow = 0; port_b1.xi_outflow = instream(port_a.xi_outflow); port_b2.xi_outflow = instream(port_a.xi_outflow); port_a.xi_outflow = instream(port_b1.xi_outflow); port_b1.c_outflow = instream(port_a.c_outflow); port_b2.c_outflow = instream(port_a.c_outflow); port_a.c_outflow = instream(port_b1.c_outflow); port_b1.h_outflow = instream(port_a.h_outflow); port_b2.h_outflow = instream(port_a.h_outflow); port_a.h_outflow = instream(port_b1.h_outflow); end separation;
it's "nonlinear system" error when connect model 3 pressure level components (set patm +10000pa source , patm sink). model works massflow sink. why? should develop own solver solve it? if yes how?
your question not clear. but, think asking if given value of dp, @ time, can modelica solve v, when there table relationship of k , v? if understand variables correctly, should it:
model test5 real v "fluid velocity"; real k "pressure loss coefficient"; real dp =0.5 "pressure drop"; //example value real rho = 1.0 "density" ; modelica.blocks.tables.combitable2d coeff_pdc1(table = [0, 0, 0.4, 0.5, 0.6, 0.7, 0.8, 1; 0, 1, 1, 1, 1, 1, 1, 1; 0.1, 0.81, 0.81, 0.81, 0.81, 0.81, 0.81, 0.81; 0.2, 0.64, 0.64, 0.64, 0.64, 0.64, 0.64, 0.64; 0.3, 0.5, 0.5, 0.52, 0.52, 0.5, 0.5, 0.5; 0.4, 0.36, 0.36, 0.4, 0.38, 0.37, 0.36, 0.36; 0.5, 0.25, 0.25, 0.3, 0.28, 0.26, 0.25, 0.25; 0.6, 0.16, 0.16, 0.23, 0.2, 0.18, 0.16, 0.16; 0.8, 0.04, 0.04, 0.16, 0.12, 0.07, 0.04, 0.04; 1, 0, 0, 0.2, 0.1, 0.05, 0, 0; 1.2, 0.07, 0.07, 0.36, 0.21, 0.14, 0.07, 0.07; 1.4, 0.39, 0.39, 0.78, 0.59, 0.49, 50, 50; 1.6, 0.9, 0.9, 1.36, 1.15, 50, 50, 50; 1.8, 1.78, 1.78, 2.43, 50, 50, 50, 50; 2, 3.2, 3.2, 4, 50, 50, 50, 50]); equation coeff_pdc1.u2 = 0.5; dp = 0.5 * k * rho * v ^ 2; v = coeff_pdc1.u1; k = coeff_pdc1.y; end test5;
when run this, solves v, given value of dp. want?
loops static modelica fluid-dynamics
Comments
Post a Comment