Building a Fluid Flow Simulation App: Seeking Advice on Pipe Network Architecture

I’m working on creating a web application to simulate piping systems, where you can place pipes precisely and track the fluid flow theoretically (using thermodynamic calculations), including pressure losses, etc. However, as I started coding this feature, I wondered if there’s an existing architecture that could handle elements like branches, separations, bends, elevations, descents, and so on.

So far, I’ve come up with this structure to represent my pipes:

pipe = {
    from: { 
        position: [0.25, 1.25, 0], 
        connected: false 
    }, 
    to: { 
        position: [5, 1.25, 0],
        connected: false
    },
    id: 2164514,
    stage: -4
};

But I feel like this setup could quickly become overly complex.
Do you have any suggestions or ideas for an architecture that would be more suitable for this type of simulation?

What I’ve tried so far is creating a structure where each pipe has a from and to position, along with an ID and other details. I hoped this would be a flexible way to represent different pipe segments and their connections, allowing for easy modifications and extensions to handle things like branches, bends, and other features.

However, I’m finding that this approach might quickly get overly complicated, especially when dealing with more complex networks involving separations, multiple branches, or different elevations. I was expecting the structure to be scalable, but it seems like it could become difficult to manage and maintain as the system grows.

New contributor

hichem moumni is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

An Object Orientated approach would work, where Pipes are defined as classes/objects. You can define the properties you need in a pipe, such as it’s length, diameter, etc.

You can then define logic, probably a couple of types of logic: logic to help manage how pipes can be assembled, and another for performing the simulations.

I would focus on the logic you need to perform first, and use this to guide your class/object design; I would worry about data structures (for persisting the data) later.

Are you familiar with Design Patterns? If not, you may find one or several that help you in aspects of your project. I’m not thinking of a specific one for you right now, but some of the structural and behavioral pattern may be of use to you at some point.

A way to test your object and logic design is to come up with a list of functional scenarios, and use each of them to “test” your design – at the initial stages your first tests might be on a whiteboard – to see if an idea is then worth prototyping in code.

Have you built a web application before? How long do you think this system will be in operation for and who will maintain it? (I’m wondering how much engineering and architecture to put into this, like is this for a personal hobby project or a ‘serious’ professional product?).

One random thought – if you are trying to simulate behavior, maybe focus on using relative values rather than absolute ones e.g. variables like pipe length rather that start/end coordinates; as it’s easier to add pipe lengths together than workout distances between coordinates.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật