Overview
Comment:Added DASSL as an option for solution of algebraic equations (-ae dassl).
Requires octave-2.1.35.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: 89dc73cd94e5563e8b8c6e95bf052e2000b14bdb973681d50cc1c2d9fe9af20b
User & Date: geraint@users.sourceforge.net on 2001-11-15 02:56:18
Other Links: branch diff | manifest | tags
Context
2001-11-15
06:24:11
Updated (-i dassl) residual function to use new DAEFunc (octave-2.1.35).
YZ residual dependency on Ui still requires some work.
check-in: c9686590ce user: geraint@users.sourceforge.net tags: origin/master, trunk
02:56:18
Added DASSL as an option for solution of algebraic equations (-ae dassl).
Requires octave-2.1.35.
check-in: 89dc73cd94 user: geraint@users.sourceforge.net tags: origin/master, trunk
2001-11-11
18:12:30
Moved fflush(structure_file) out of loop. check-in: d80310dd00 user: geraint@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/mtt from [ae857fca80] to [26eafa49b6].

13
14
15
16
17
18
19



20
21
22
23
24
25
26
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$



## Revision 1.325  2001/10/11 03:15:55  geraint
## Fixed make dependencies for c++ simulation code
## - re-simulation no longer required for different output format.
##
## Revision 1.324  2001/10/05 23:39:43  geraint
## Made odes.dat2 .PRECIOUS to prevent deletion when simulation receives ^C.
##







>
>
>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Copyright (C) 2001 by Peter J. Gawthrop

###############################################################
## Version control history
###############################################################
## $Header$
## $Log$
## Revision 1.326  2001/10/26 01:01:47  geraint
## fixcc when rdae_is_dae (-cr).
##
## Revision 1.325  2001/10/11 03:15:55  geraint
## Fixed make dependencies for c++ simulation code
## - re-simulation no longer required for different output format.
##
## Revision 1.324  2001/10/05 23:39:43  geraint
## Made odes.dat2 .PRECIOUS to prevent deletion when simulation receives ^C.
##
1233
1234
1235
1236
1237
1238
1239





1240
1241
1242
1243
1244
1245
1246
		    *)
			echo $1 is an unknown integration method - use dassl, euler, rk4 or implicit;
                        exit;;
		esac;;
	-ae )
                mtt_switches="$mtt_switches $1";
		case $2 in





		    fsolve | hybrd)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=Hybrd_Solver;
			shift;
			;;
		    hooke)
			mtt_switches="$mtt_switches $2";







>
>
>
>
>







1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
		    *)
			echo $1 is an unknown integration method - use dassl, euler, rk4 or implicit;
                        exit;;
		esac;;
	-ae )
                mtt_switches="$mtt_switches $1";
		case $2 in
		    dassl)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=Dassl_Solver;
			shift;
			;;
		    fsolve | hybrd)
			mtt_switches="$mtt_switches $2";
			algebraic_solver=Hybrd_Solver;
			shift;
			;;
		    hooke)
			mtt_switches="$mtt_switches $2";
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
    echo '         -c  c-code generation'
    echo '         -cc C++ code generation'
    echo '         -cr Use cr before resolving equations'
    echo '         -d  <dir>  use directory <dir>'
    echo '         -dc Maximise derivative (not integral) causality'
    echo '         -dc Maximise derivative (not integral) causality'
    echo '         -i <implicit|euler|rk4|dassl>   Use implicit, euler, rk4 or dassl integration'
    echo '         -ae <reduce|hybrd|hooke>   Solve algebraic equations with Reduce, hybrd (fsolve) or Hooke and Jeeves'
    echo '         -o ode is same as dae'
    echo '         -oct use oct files in place of m files where appropriate'
    echo '         -opt optimise code generation'
    echo '         -p  print environment variables'
    echo '         -partition partition hierachical system'
    echo '         -pdf generate pdf in place of ps'
    echo '         -r  reset time stamp on representation'







|







1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
    echo '         -c  c-code generation'
    echo '         -cc C++ code generation'
    echo '         -cr Use cr before resolving equations'
    echo '         -d  <dir>  use directory <dir>'
    echo '         -dc Maximise derivative (not integral) causality'
    echo '         -dc Maximise derivative (not integral) causality'
    echo '         -i <implicit|euler|rk4|dassl>   Use implicit, euler, rk4 or dassl integration'
    echo '         -ae <reduce|hybrd|dassl|hooke>   Solve algebraic equations with specified solver'
    echo '         -o ode is same as dae'
    echo '         -oct use oct files in place of m files where appropriate'
    echo '         -opt optimise code generation'
    echo '         -p  print environment variables'
    echo '         -partition partition hierachical system'
    echo '         -pdf generate pdf in place of ps'
    echo '         -r  reset time stamp on representation'

Added mttroot/mtt/lib/cc/mtt_Dassl_Solver.cc version [d98f27dba0].































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

#include "mtt_Dassl_Solver.hh"


// used by "-ae dassl" NOT "-i dassl"


MTT::Dassl_Solver *MTT::Dassl_Solver::static_ptr;

ColumnVector
MTT::Dassl_Solver::f_dassl (const ColumnVector &tryUi,
			    const ColumnVector &tryUidot,
			    double t, int &ires)
{
  static MTT::Dassl_Solver *p = MTT::Dassl_Solver::static_ptr;

  ColumnVector residual = p->eval(tryUi);
  ColumnVector uidoterr = (tryUi - p->_ui) - tryUidot;  
  p->_yz = residual + uidoterr;
  return p->_yz;
}

void
MTT::Dassl_Solver::Solve (void)
{
  const double t0 = 0.0;
  const double t1 = 1.0;
  DAEFunc fcn(&MTT::Dassl_Solver::f_dassl);
  DASSL   eqn(AlgebraicSolver::_ui,t0,fcn);
  AlgebraicSolver::_ui = eqn.do_integrate (t1);
}

Added mttroot/mtt/lib/cc/mtt_Dassl_Solver.hh version [29e194ac39].





























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62


#ifndef MTT_DASSLSOLVER
#define MTT_DASSLSOLVER


#include "mtt_AlgebraicSolver.hh"
#include <octave/DASSL.h>


#ifdef  OCTAVE_DEV
#include <octave/parse.h>
#define VECTOR_VALUE column_vector_value
#else   // !OCTAVE_DEV
#include <octave/toplev.h>
#define VECTOR_VALUE vector_value
#endif  // OCTAVE_DEV


// -ae dassl


namespace MTT
{
  class Dassl_Solver : public MTT::AlgebraicSolver {
    
    // used only when called because of "-ae dassl"
    // this is not used when called by "-i dassl"
    
  public:
    
    Dassl_Solver (const int npar,
		  const int nu,
		  const int nx,
		  const int ny,
		  const int nyz)
      : MTT::AlgebraicSolver (npar, nu, nx, ny, nyz)
    {
      static_ptr = this;
    }
    
    static ColumnVector
    f_dassl (const ColumnVector &tryUi,
	     const ColumnVector &tryUidot,
	     double t, int &ires);
    
    ~Dassl_Solver (void) {};
    
  protected:
    
    void
    Solve (void);
    
  public:
    
    static Dassl_Solver *static_ptr;
    
  };
}


#endif // MTT_DASSLSOLVER


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]