Solving nonlinear algebraic systems

Discussion in 'C++' started by Federico Zenith, Jun 18, 2008.

  1. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Hello everybody,
    I am looking into a problem that probably someone had before, so I hope
    I can avoid reinventing the wheel...

    I am looking into different alternatives to simulate a chemical process
    with a number of unit operations (heat exchangers, chemical reactors and
    so on). There are some commercial products (such as Hysys) that do this,
    but have a number of shortcomings: Hysys is overkill and is way too
    bloated, and Simulink has a nasty habit of crashing on algebraic loops.
    Therefore I am considering using C++ directly.

    Until now I considered formulating the problem as a list of objects I
    call UnitOps:

    class UnitOp {...};
    class HeatExchanger : public UnitOp {...};
    class Tank : public UnitOp {...};
    class Reactor : public UnitOp {...};

    Each of the sub-classes will have its own states (temperature, liquid
    level, whatever), but all should provide a list of parameters (contact
    area, height, volume, specific heat of the entering fluid...) and a list
    of functors in the form f(x) = 0 that describe the relations (in general
    non-linear, but usually not freakishly so) between those parameters.
    For instance, a heat exchanger would have a functor representing:

    Q - U×A×ΔT = 0

    don't worry about what that is if you don't know anything about heat
    exchangers, it's just an algebraic relation among its parameters.

    So, my idea would be to take a list of UnitOp*, merge all the parameters
    from these, take all their functors, add some more functors to account
    for the relations among different UnitOp (say we assign the entering
    temperature of a heat exchanger, or that the entering flow is equal to
    the one exiting from another unit - whatever), and when I have N
    parameters and N functors I should be able to feed all this to a
    root-finding algorithm as those I can find in the GSL.

    The problems at this point are:
    1) How do I make sure that the problem is well formed, and that the
    functors are actually independent from each other? The system is
    nonlinear, so checking a matrix' rank is no option. I cannot simply
    assume that the system _is_ well formed, since it will be the program's
    user's task to decide the equations determining the last functors, and I
    need to tell him if something is wrong (and possibly what).
    2) A lot of those functors represent explicit relations (like the heat
    exchanger formula above), but if I feed everything to a root-finding
    algorithm I would be using an implicit method. This is going to be a
    serious performance hit as I would be using a solution space with many
    more dimensions than strictly necessary. I cannot hard-code the direct
    relations since in general I do not know which these are.

    When I got to this point, I realised that I cannot be the first person
    with such an issue, so I was wondering whether anyone here saw some
    library or procedure that does something similar to what I described.

    Any thoughts, anyone?

    Cheers,
    - -Federico
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.5 (GNU/Linux)
    Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

    iD8DBQFIWRpSBIpu+y7DlLcRAovhAJ92VIdHh2dk1kWp4LiX3lNdlAqsOACfQqM/
    HnjvlbKuOY17E+Tp4jxY2EY=
    =pLrD
    -----END PGP SIGNATURE-----
    Federico Zenith, Jun 18, 2008
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Victor Bazarov wrote:
    > Federico Zenith wrote:
    >> [..]
    >> The problems at this point are:
    >> 1) How do I make sure that the problem is well formed, and that the
    >> functors are actually independent from each other? The system is
    >> nonlinear, so checking a matrix' rank is no option. I cannot simply
    >> assume that the system _is_ well formed, since it will be the program's
    >> user's task to decide the equations determining the last functors, and I
    >> need to tell him if something is wrong (and possibly what).

    >
    > Federico, that question has nothing to do with C++ *language*. You need
    > help with your math, please consider posting to 'sci.math.num-analysis'.


    Sorry, I obviously misunderstood the topic of the newsgroup. Please
    don't shoot the noob...

    Cheers,
    - -Federico
    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.5 (GNU/Linux)
    Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

    iD8DBQFIWhhlBIpu+y7DlLcRAoIcAJ45DlsO1nkpKft4fsRiZsdBcuA+wwCgsM9t
    7cCQ0VgJQfIJ1ei6Hfc/thQ=
    =T3v3
    -----END PGP SIGNATURE-----
    Federico Zenith, Jun 19, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Wahler
    Replies:
    1
    Views:
    382
    Razmig K
    Apr 1, 2004
  2. Michel Rosien
    Replies:
    0
    Views:
    356
    Michel Rosien
    Apr 22, 2004
  3. DennisNedry

    Algebraic Parser

    DennisNedry, Feb 2, 2005, in forum: C++
    Replies:
    6
    Views:
    873
    DennisNedry
    Feb 2, 2005
  4. steve
    Replies:
    3
    Views:
    263
    Paul Boddie
    Oct 23, 2006
  5. Lionel
    Replies:
    14
    Views:
    1,153
Loading...

Share This Page