Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PartialNTU outlet enthalpy filter fix #206

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

RaphaelGebhart
Copy link
Contributor

@RaphaelGebhart RaphaelGebhart commented Aug 14, 2024

ThermofluidStream.HeatExchangers.Internal.PartialNTU filters outlet enthalpy:

  if noEvent(C_A < C_B) then

    ...

    der(h_out_A)*TC = h_in_A - dh_A - h_out_A;
    der(h_out_B)*TC = h_in_B - dh_B - h_out_B;

  else

    ...

    der(h_out_A)*TC = h_in_A - dh_A - h_out_A;
    der(h_out_B)*TC = h_in_B - dh_B - h_out_B;

  end if;
  • For Dymola 2024x moving the outlet enthalpy filter equation out of the if clause can have a huge impact on simulation time:
  if noEvent(C_A < C_B) then
    ...
  else
    ...
  end if;
  der(h_out_A)*TC = h_in_A - dh_A - h_out_A;
  der(h_out_B)*TC = h_in_B - dh_B - h_out_B;  
  • The if clause could be further simplified (move the heat flow rates q_flowA and q_flowB out of the if clause):
  q_flowA = q_flow;
  q_flowB = -q_flowA;

  if noEvent(inletA.m_flow < m_flow_reg) and noEvent(inletB.m_flow < m_flow_reg) then
      dh_A = 0;
      dh_B = 0;
  else
    if noEvent(C_A < C_B) then
      dh_A = Delta_T_max*cp_A*effectiveness;
      dh_B = (m_flow_B*q_flowB)/(m_flow_B^2 + (m_flow_reg/10)^2);
    else
      dh_B = -Delta_T_max*cp_B*effectiveness;
      dh_A = (m_flow_A*q_flowA)/(m_flow_A^2 + (m_flow_reg/10)^2);
    end if;
  end if;

but for my tests this caused no obvious improvements.

I would personally only apply the first change der(h_out_A)*TC ..., since for me it seems to solve the issue with slow simulation.

@RaphaelGebhart
Copy link
Contributor Author

Currently it seems like this is not the main issue.

@tobolar tobolar removed their request for review September 13, 2024 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant