82 template <
typename _Type>
84 std::cout <<
"PLAIN MESH version\n";
85 std::size_t Nx(source.get_nnodes().first);
86 std::size_t Ny(source.get_nnodes().second);
87 double dx(source.coord(1,1).first - source.coord(0,0).first);
88 double dy(source.coord(1,1).second - source.coord(0,0).second);
93 for(std::size_t j = 1; j < Ny - 1; ++j) {
94 uv(i, j, 0) = (source(i, j + 1, 0) - source(i, j - 1, 0)) / (2 * dy);
95 uv(i, j, 1) = -(-source(i + 2, j, 0) + 4. * source(i + 1, j, 0) - 3. * source(i, j, 0)) / (2 * dx);
100 std::size_t i(Nx - 1);
101 for(std::size_t j = 1; j < Ny - 1; ++j) {
102 uv(i, j, 0) = (source(i, j + 1, 0) - source(i, j - 1, 0)) / (2 * dy);
103 uv(i, j, 1) = -(source(i - 2, j, 0) - 4. * source(i - 1, j, 0) + 3. * source(i, j, 0)) / (2 * dx);
109 for(std::size_t i = 1; i < Nx - 1; ++i) {
110 uv(i, j, 0) = (-source(i, j + 2, 0) + 4. * source(i, j + 1, 0) - 3. * source(i, j, 0)) / (2 * dy);
111 uv(i, j, 1) = -(source(i + 1, j, 0) - source(i - 1, j, 0)) / (2 * dx);
116 std::size_t j(Ny - 1);
117 for(std::size_t i = 1; i < Nx - 1; ++i) {
118 uv(i, j, 0) = (source(i, j - 2, 0) - 4. * source(i, j - 1, 0) + 3. * source(i, j, 0)) / (2 * dy);
119 uv(i, j, 1) = -(source(i + 1, j, 0) - source(i - 1, j, 0)) / (2 * dx);
128 uv(i, j, 0) = (-source(i, j + 2, 0) + 4. * source(i, j + 1, 0) - 3. * source(i, j, 0)) / (2 * dy);
129 uv(i, j, 1) = -(-source(i + 2, j, 0) + 4. * source(i + 1, j, 0) - 3. * source(i, j, 0)) / (2 * dx);
134 std::size_t j(Ny - 1);
135 uv(i, j, 0) = (source(i, j - 2, 0) - 4. * source(i, j - 1, 0) + 3. * source(i, j, 0)) / (2 * dy);
136 uv(i, j, 1) = -(-source(i + 2, j, 0) + 4. * source(i + 1, j, 0) - 3. * source(i, j, 0)) / (2 * dx);
140 std::size_t i(Nx - 1);
141 std::size_t j(Ny - 1);
142 uv(i, j, 0) = (source(i, j - 2, 0) - 4. * source(i, j - 1, 0) + 3. * source(i, j, 0)) / (2 * dy);
143 uv(i, j, 1) = -(source(i - 2, j, 0) - 4. * source(i - 1, j, 0) + 3. * source(i, j, 0)) / (2 * dx);
147 std::size_t i(Nx - 1);
149 uv(i, j, 0) = (-source(i, j + 2, 0) + 4. * source(i, j + 1, 0) - 3. * source(i, j, 0)) / (2 * dy);
150 uv(i, j, 1) = -(source(i - 2, j, 0) - 4. * source(i - 1, j, 0) + 3. * source(i, j, 0)) / (2 * dx);
155 for(std::size_t i = 1; i < Nx - 1; ++i) {
156 for(std::size_t j = 1; j < Ny - 1; ++j) {
157 uv(i, j, 0) = (source(i, j + 1, 0) - source(i, j - 1, 0)) / (2 * dy);
158 uv(i, j, 1) = -(source(i + 1, j, 0) - source(i - 1, j, 0)) / (2 * dx);
165 template <
typename _Type>
167 std::cout <<
"MAPPED MESH version\n";
168 std::size_t Nx(source.get_nnodes().first);
169 std::size_t Ny(source.get_nnodes().second);
170 double dX( source.get_comp_step_sizes().first );
171 double dY( source.get_comp_step_sizes().second );
176 for(std::size_t j = 1; j < Ny - 1; ++j) {
177 double x = source.coord(i,j).first;
178 double Xd = source.FnComp_Xd(x);
179 double y = source.coord(i,j).second;
180 double Yd = source.FnComp_Yd(y);
181 uv(i, j, 0) = (source(i, j + 1, 0) - source(i, j - 1, 0)) * Yd / (2 * dY);
182 uv(i, j, 1) = -(-source(i + 2, j, 0) + 4. * source(i + 1, j, 0) - 3. * source(i, j, 0)) * Xd / (2 * dX);
187 std::size_t i(Nx - 1);
188 for(std::size_t j = 1; j < Ny - 1; ++j) {
189 double x = source.coord(i,j).first;
190 double Xd = source.FnComp_Xd(x);
191 double y = source.coord(i,j).second;
192 double Yd = source.FnComp_Yd(y);
193 uv(i, j, 0) = (source(i, j + 1, 0) - source(i, j - 1, 0)) * Yd / (2 * dY);
194 uv(i, j, 1) = -(source(i - 2, j, 0) - 4. * source(i - 1, j, 0) + 3. * source(i, j, 0)) * Xd / (2 * dX);
200 for(std::size_t i = 1; i < Nx - 1; ++i) {
201 double x = source.coord(i,j).first;
202 double Xd = source.FnComp_Xd(x);
203 double y = source.coord(i,j).second;
204 double Yd = source.FnComp_Yd(y);
205 uv(i, j, 0) = (-source(i, j + 2, 0) + 4. * source(i, j + 1, 0) - 3. * source(i, j, 0))* Yd / (2 * dY);
206 uv(i, j, 1) = -(source(i + 1, j, 0) - source(i - 1, j, 0)) * Xd / (2 * dX);
211 std::size_t j(Ny - 1);
212 for(std::size_t i = 1; i < Nx - 1; ++i) {
213 double x = source.coord(i,j).first;
214 double Xd = source.FnComp_Xd(x);
215 double y = source.coord(i,j).second;
216 double Yd = source.FnComp_Yd(y);
217 uv(i, j, 0) = (source(i, j - 2, 0) - 4. * source(i, j - 1, 0) + 3. * source(i, j, 0)) * Yd / (2 * dY);
218 uv(i, j, 1) = -(source(i + 1, j, 0) - source(i - 1, j, 0)) * Xd / (2 * dX);
227 double x = source.coord(i,j).first;
228 double Xd = source.FnComp_Xd(x);
229 double y = source.coord(i,j).second;
230 double Yd = source.FnComp_Yd(y);
231 uv(i, j, 0) = (-source(i, j + 2, 0) + 4. * source(i, j + 1, 0) - 3. * source(i, j, 0))* Xd / (2 * dY);
232 uv(i, j, 1) = -(-source(i + 2, j, 0) + 4. * source(i + 1, j, 0) - 3. * source(i, j, 0))* Yd / (2 * dY);
237 std::size_t j(Ny - 1);
238 double x = source.coord(i,j).first;
239 double Xd = source.FnComp_Xd(x);
240 double y = source.coord(i,j).second;
241 double Yd = source.FnComp_Yd(y);
242 uv(i, j, 0) = (source(i, j - 2, 0) - 4. * source(i, j - 1, 0) + 3. * source(i, j, 0)) * Yd / (2 * dY);
243 uv(i, j, 1) = -(-source(i + 2, j, 0) + 4. * source(i + 1, j, 0) - 3. * source(i, j, 0))* Xd / (2 * dX);
247 std::size_t i(Nx - 1);
248 std::size_t j(Ny - 1);
249 double x = source.coord(i,j).first;
250 double Xd = source.FnComp_Xd(x);
251 double y = source.coord(i,j).second;
252 double Yd = source.FnComp_Yd(y);
253 uv(i, j, 0) = (source(i, j - 2, 0) - 4. * source(i, j - 1, 0) + 3. * source(i, j, 0)) * Yd / (2 * dY);
254 uv(i, j, 1) = -(source(i - 2, j, 0) - 4. * source(i - 1, j, 0) + 3. * source(i, j, 0)) * Xd/ (2 * dX);
258 std::size_t i(Nx - 1);
260 double x = source.coord(i,j).first;
261 double Xd = source.FnComp_Xd(x);
262 double y = source.coord(i,j).second;
263 double Yd = source.FnComp_Yd(y);
264 uv(i, j, 0) = (-source(i, j + 2, 0) + 4. * source(i, j + 1, 0) - 3. * source(i, j, 0))* Yd / (2 * dY);
265 uv(i, j, 1) = -(source(i - 2, j, 0) - 4. * source(i - 1, j, 0) + 3. * source(i, j, 0)) * Xd / (2 * dX);
270 for(std::size_t i = 1; i < Nx - 1; ++i) {
271 for(std::size_t j = 1; j < Ny - 1; ++j) {
272 double x = source.coord(i,j).first;
273 double Xd = source.FnComp_Xd(x);
274 double y = source.coord(i,j).second;
275 double Yd = source.FnComp_Yd(y);
276 uv(i, j, 0) = (source(i, j + 1, 0) - source(i, j - 1, 0)) * Yd / (2 * dY);
277 uv(i, j, 1) = -(source(i + 1, j, 0) - source(i - 1, j, 0)) * Xd / (2 * dX);
313 template <
typename _Type>
317 problem =
"The Utilities::dot method has been called \n";
318 problem +=
"with two unequal length vectors.";
321 return inner_product(X.
begin(), X.
end(), Y.
begin(), _Type(0.0));
324 template <
typename _Type>
328 }
else if(a < (_Type)0) {
364 std::string
stringify(
const double &val,
int p);
The collection of CppNoddy exceptions.
Some interface definitions for calling external fortran routines from BLAS.
A specification for a one dimensional mesh object.
A base matrix class to ensure a consistent interface between the inheriting dense/banded matrix class...
A specification for a two dimensional mapped mesh object.
A specification for a two dimensional mesh object.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
An DenseVector class – a dense vector object.
std::size_t size() const
A pass-thru definition to get the size of the vector.
elt_iter begin()
Pass through to the storage container.
elt_iter end()
Pass through to the storage container.
An exception class to be thrown when a container of incorrect geometry used in any class/method.
A one dimensional mesh utility object.
A two dimensional (mapped) mesh utility object.
A two dimensional mesh utility object.
DenseVector< double > real(const DenseVector< D_complex > &X)
Return a double DENSE vector containing the real part of a complex DENSE vector.
DenseMatrix< double > multiply(DenseMatrix< double > &A, DenseMatrix< double > &B)
BLAS wrapper to do DOUBLE DENSE A_{MxK} * B_{KxN} = C_{MxN} Since this is a Fortran library,...
_Type dot(const DenseVector< _Type > &X, const DenseVector< _Type > &Y)
Templated dot product.
DenseVector< double > three_uniform_node_vector(const double &lower, const double &mid1, const double &mid2, const double &upper, const std::size_t &N1, const std::size_t &N2, const std::size_t &N3)
Return a dense vector with two uniform distributions in two separate regions.
DenseVector< double > power_node_vector(const double &lower, const double &upper, const std::size_t &N, const double &power)
Return a DENSE vector with the nodal points of a non-uniform mesh distributed between the upper/lower...
DenseVector< double > mid_weighted_node_vector(const double &lower, const double &upper, const std::size_t &N, const double &power)
Return a dense vector of nodal positions with more nodes concentrated at the mid point of the range.
void vels_from_streamfn_Cartesian(const TwoD_Node_Mesh< _Type > &source, TwoD_Node_Mesh< _Type > &uv)
DenseVector< double > two_uniform_node_vector(const double &lower, const double &mid, const double &upper, const std::size_t &N1, const std::size_t &N2)
Return a dense vector with two uniform distributions in two separate regions.
double max_abs_location(OneD_Node_Mesh< double > &mesh, unsigned var)
DenseVector< double > imag(const DenseVector< D_complex > &X)
Return a double DENSE vector containing the imaginary part of a complex DENSE vector.
double max_abs_location_range(OneD_Node_Mesh< double > &mesh, unsigned var, double left, double right)
std::string stringify(const int &val)
Return an integer value as a string - useful for file naming.
DenseVector< double > uniform_node_vector(const double &lower, const double &upper, const std::size_t &N)
Return a DENSE vector with the nodal points of a uniform mesh distributed between the upper/lower bou...
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...