/[escript]/branches/pasoc/paso/src/Transport.h
ViewVC logotype

Contents of /branches/pasoc/paso/src/Transport.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6562 - (show annotations)
Fri May 12 08:15:37 2017 UTC (7 months ago) by jfenwick
File MIME type: text/plain
File size: 3935 byte(s)
little progress
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2017 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 #ifndef __PASO_TRANSPORT_H__
19 #define __PASO_TRANSPORT_H__
20
21 #define DT_FACTOR_MAX 100000.
22
23 #include "Paso.h"
24 #include "Options.h"
25 #include "SystemMatrix.h"
26
27 #include <escript/AbstractTransportProblem.h>
28
29 namespace paso {
30
31 template <class T>
32 class TransportProblem;
33
34 template <class T>
35 using TransportProblem_ptr = boost::shared_ptr<TransportProblem<T> >;
36
37 template <class T>
38 using const_TransportProblem_ptr = boost::shared_ptr<const TransportProblem<T> >;
39
40 template <class T>
41 class TransportProblem : public escript::AbstractTransportProblem,
42 public boost::enable_shared_from_this<TransportProblem<T> >
43 {
44 public:
45 /// Default constructor - throws exception
46 TransportProblem();
47
48 TransportProblem(SystemMatrixPattern_ptr pattern, int blocksize,
49 const escript::FunctionSpace& functionspace);
50
51 ~TransportProblem();
52
53 virtual void resetTransport(bool preserveSolverData) const;
54
55 void solve(double* u, double dt, double* u0, double* q, Options* options);
56
57 virtual double getSafeTimeStepSize() const;
58
59 virtual double getUnlimitedTimeStepSize() const;
60
61 void insertConstraint(const double* r, double* source) const;
62
63 void setUpConstraint(const double* q);
64
65 inline dim_t getBlockSize() const
66 {
67 return transport_matrix->row_block_size;
68 }
69
70 inline SystemMatrix_ptr<T> borrowTransportMatrix() const
71 {
72 return transport_matrix;
73 }
74
75 inline SystemMatrix_ptr<T> borrowMassMatrix() const
76 {
77 return mass_matrix;
78 }
79
80 inline double* borrowLumpedMassMatrix() const
81 {
82 return lumped_mass_matrix;
83 }
84
85 inline dim_t getTotalNumRows() const
86 {
87 return transport_matrix->getTotalNumRows();
88 }
89
90 inline Connector_ptr borrowConnector() const
91 {
92 return transport_matrix->pattern->col_connector;
93 }
94
95 inline index_t* borrowMainDiagonalPointer() const
96 {
97 return mass_matrix->mainBlock->borrowMainDiagonalPointer();
98 }
99
100 inline static int getTypeId(int solver, int preconditioner,
101 int package, bool symmetry,
102 const escript::JMPI& mpi_info)
103 {
104 return MATRIX_FORMAT_DEFAULT + MATRIX_FORMAT_BLK1;
105 }
106
107 SystemMatrix_ptr<T> transport_matrix;
108 SystemMatrix_ptr<T> mass_matrix;
109 SystemMatrix_ptr<T> iteration_matrix;
110
111 mutable bool valid_matrices;
112 /// safe time step size for reactive part
113 mutable double dt_max_R;
114 /// safe time step size for transport part
115 mutable double dt_max_T;
116 mutable double* constraint_mask;
117
118 double* main_diagonal_low_order_transport_matrix;
119 /// 'relevant' lumped mass matrix is assumed to be positive.
120 /// Values with corresponding constraint_mask > 0 value are set to -1
121 /// to indicate the value infinity
122 double* lumped_mass_matrix;
123 double* reactive_matrix;
124 double* main_diagonal_mass_matrix;
125
126 escript::JMPI mpi_info;
127
128 private:
129 virtual void setToSolution(escript::Data& out, escript::Data& u0,
130 escript::Data& source, double dt,
131 boost::python::object& options);
132
133 virtual void copyConstraint(escript::Data& source, escript::Data& q,
134 escript::Data& r);
135 };
136
137 } // namespace paso
138
139 #endif // __PASO_TRANSPORT_H__
140

  ViewVC Help
Powered by ViewVC 1.1.26