CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Main CFD Forum (
-   -   2-d NS solver OO design ? (

thampy June 27, 1999 05:18

2-d NS solver OO design ?

I'm designing a 2d NS solver using structured cartesian mesh using the object oriented approach. Could someone help me out with the design or give me some sort of a refernence to related work ?

John C. Chien June 28, 1999 00:52

Re: 2-d NS solver OO design ?
(1).I think there are many ways to write a program in the object-oriented approach. (2). The first thing you need is a working program. This is important because you need to have a program which can do something for you in the first place. In other word, you need to know how to write a program to solve a 2-D Navier-Stokes equations, with some boundary conditions and mesh in a conventional way first. (3). Once you have this part working, the next step is to identify the data and the subroutines. (4). In the subroutine, you perform operations on data to do different things, such as I/O, mathematical operations, logical operations, etc. At this point, you can define a class or classes with data and functions included to perform certain tasks. Then, in the main function, you can create some objects from the defined classes to solve your 2-D Navier-Stokes equations. (5). I think, if you write down a step-by-step operation of your 2-D Navier-Stokes solver in plane English, then you can replace it by "action" (performed by an object ) on "data" (the private data member) and turn the description into the OOP code. (6). One of the main purpose of using OOP appraoch is to protect the data ( by hiding the data inside the object as data member, so that functions of other objects can not easily access it.) (7). I don't think there is a universal approach to write OOP programs. If you can wrap the functions which operate on specific sets of data into a class definition, and try to carry out solver tasks by sending commands to these objects, then you have a working OOP program.

All times are GMT -4. The time now is 11:00.