Discontinuous Galerkin Library
#include "dg/algorithm.h"
elliptic.h
Go to the documentation of this file.
1#pragma once
2
3#include "blas.h"
4#include "enums.h"
5#include "backend/memory.h"
8#ifdef MPI_VERSION
11#endif
12#include "topology/geometry.h"
13
18namespace dg
19{
20// Note that there are many tests for this file : elliptic2d_b,
21// elliptic2d_mpib, elliptic_b, elliptic_mpib, ellipticX2d_b
22// And don't forget inc/geometries/elliptic3d_t (testing alignment and
23// projection tensors as Chi) geometry_elliptic_b, geometry_elliptic_mpib,
24// and geometryX_elliptic_b and geometryX_refined_elliptic_b
25
26
64template <class Geometry, class Matrix, class Container>
66{
67 public:
68 using geometry_type = Geometry;
69 using matrix_type = Matrix;
70 using container_type = Container;
73 Elliptic1d() = default;
83 Elliptic1d( const Geometry& g,
84 direction dir = forward, value_type jfactor=1.):
85 Elliptic1d( g, g.bcx(), dir, jfactor)
86 {
87 }
88
98 Elliptic1d( const Geometry& g, bc bcx,
99 direction dir = forward,
100 value_type jfactor=1.)
101 {
102 m_jfactor=jfactor;
103 dg::blas2::transfer( dg::create::dx( g, inverse( bcx), inverse(dir)), m_leftx);
104 dg::blas2::transfer( dg::create::dx( g, bcx, dir), m_rightx);
105 dg::blas2::transfer( dg::create::jump( g, bcx), m_jumpX);
106
107 dg::assign( dg::create::weights(g), m_weights);
108 dg::assign( dg::evaluate( dg::one, g), m_precond);
109 m_tempx = m_sigma = m_precond;
110 }
111
113 template<class ...Params>
114 void construct( Params&& ...ps)
115 {
116 //construct and swap
117 *this = Elliptic1d( std::forward<Params>( ps)...);
118 }
119
131 template<class ContainerType0>
132 void set_chi( const ContainerType0& sigma)
133 {
134 dg::blas1::copy( sigma, m_sigma);
135 //update preconditioner
136 dg::blas1::pointwiseDivide( 1., sigma, m_precond);
137 // sigma is possibly zero, which will invalidate the preconditioner
138 // it is important to call this blas1 function because it can
139 // overwrite NaN in m_precond in the next update
140 }
141
146 const Container& weights()const {
147 return m_weights;
148 }
157 const Container& precond()const {
158 return m_precond;
159 }
161 void set_jfactor( value_type new_jfactor) {m_jfactor = new_jfactor;}
163 value_type get_jfactor() const {return m_jfactor;}
165 template<class ContainerType0, class ContainerType1>
166 void operator()( const ContainerType0& x, ContainerType1& y){
167 symv( 1, x, 0, y);
168 }
169
171 template<class ContainerType0, class ContainerType1>
172 void symv( const ContainerType0& x, ContainerType1& y){
173 symv( 1, x, 0, y);
174 }
176 template<class ContainerType0, class ContainerType1>
177 void symv( value_type alpha, const ContainerType0& x, value_type beta, ContainerType1& y)
178 {
179 dg::blas2::gemv( m_rightx, x, m_tempx);
180 dg::blas1::pointwiseDot( m_tempx, m_sigma, m_tempx);
181 dg::blas2::symv( -alpha, m_leftx, m_tempx, beta, y);
182 //add jump terms
183 if( 0.0 != m_jfactor )
184 {
185 dg::blas2::symv( m_jfactor*alpha, m_jumpX, x, 1., y);
186 }
187 }
188
189 private:
190 Matrix m_leftx, m_rightx, m_jumpX;
191 Container m_weights, m_precond;
192 Container m_tempx;
193 Container m_sigma;
194 value_type m_jfactor;
195};
196
229template <class Geometry, class Matrix, class Container>
231{
232 public:
233 using geometry_type = Geometry;
234 using matrix_type = Matrix;
235 using container_type = Container;
238 Elliptic2d() = default;
249 Elliptic2d( const Geometry& g,
250 direction dir = forward, value_type jfactor=1., bool chi_weight_jump = false):
251 Elliptic2d( g, g.bcx(), g.bcy(), dir, jfactor, chi_weight_jump)
252 {
253 }
254
266 Elliptic2d( const Geometry& g, bc bcx, bc bcy,
267 direction dir = forward,
268 value_type jfactor=1., bool chi_weight_jump = false)
269 {
270 m_jfactor=jfactor;
271 m_chi_weight_jump = chi_weight_jump;
272 dg::blas2::transfer( dg::create::dx( g, inverse( bcx), inverse(dir)), m_leftx);
273 dg::blas2::transfer( dg::create::dy( g, inverse( bcy), inverse(dir)), m_lefty);
274 dg::blas2::transfer( dg::create::dx( g, bcx, dir), m_rightx);
275 dg::blas2::transfer( dg::create::dy( g, bcy, dir), m_righty);
276 dg::blas2::transfer( dg::create::jumpX( g, bcx), m_jumpX);
277 dg::blas2::transfer( dg::create::jumpY( g, bcy), m_jumpY);
278
279 dg::assign( dg::create::volume(g), m_weights);
280 dg::assign( dg::evaluate( dg::one, g), m_precond);
281 m_temp = m_tempx = m_tempy = m_weights;
282 m_chi=g.metric();
283 m_sigma = m_vol = dg::tensor::volume(m_chi);
284 }
285
287 template<class ...Params>
288 void construct( Params&& ...ps)
289 {
290 //construct and swap
291 *this = Elliptic2d( std::forward<Params>( ps)...);
292 }
293
310 template<class ContainerType0>
311 void set_chi( const ContainerType0& sigma)
312 {
313 dg::blas1::pointwiseDot( sigma, m_vol, m_sigma);
314 //update preconditioner
315 dg::blas1::pointwiseDivide( 1., sigma, m_precond);
316 // sigma is possibly zero, which will invalidate the preconditioner
317 // it is important to call this blas1 function because it can
318 // overwrite NaN in m_precond in the next update
319 }
333 template<class ContainerType0>
335 {
336 m_chi = SparseTensor<Container>(tau);
337 }
338
345 const Container& weights()const {
346 return m_weights;
347 }
356 const Container& precond()const {
357 return m_precond;
358 }
363 void set_jfactor( value_type new_jfactor) {m_jfactor = new_jfactor;}
368 value_type get_jfactor() const {return m_jfactor;}
373 void set_jump_weighting( bool jump_weighting) {m_chi_weight_jump = jump_weighting;}
378 bool get_jump_weighting() const {return m_chi_weight_jump;}
387 template<class ContainerType0, class ContainerType1>
388 void operator()( const ContainerType0& x, ContainerType1& y){
389 symv( 1, x, 0, y);
390 }
391
400 template<class ContainerType0, class ContainerType1>
401 void symv( const ContainerType0& x, ContainerType1& y){
402 symv( 1, x, 0, y);
403 }
414 template<class ContainerType0, class ContainerType1>
415 void symv( value_type alpha, const ContainerType0& x, value_type beta, ContainerType1& y)
416 {
417 //compute gradient
418 dg::blas2::gemv( m_rightx, x, m_tempx); //R_x*f
419 dg::blas2::gemv( m_righty, x, m_tempy); //R_y*f
420
421 //multiply with tensor (note the alias)
422 dg::tensor::multiply2d(m_sigma, m_chi, m_tempx, m_tempy, 0., m_tempx, m_tempy);
423
424 //now take divergence
425 dg::blas2::symv( m_lefty, m_tempy, m_temp);
426 dg::blas2::symv( -1., m_leftx, m_tempx, -1., m_temp);
427
428 //add jump terms
429 if( 0.0 != m_jfactor )
430 {
431 if(m_chi_weight_jump)
432 {
433 dg::blas2::symv( m_jfactor, m_jumpX, x, 0., m_tempx);
434 dg::blas2::symv( m_jfactor, m_jumpY, x, 0., m_tempy);
435 dg::tensor::multiply2d(m_sigma, m_chi, m_tempx, m_tempy, 0., m_tempx, m_tempy);
436 dg::blas1::axpbypgz(1.0,m_tempx,1.0,m_tempy,1.0,m_temp);
437 }
438 else
439 {
440 dg::blas2::symv( m_jfactor, m_jumpX, x, 1., m_temp);
441 dg::blas2::symv( m_jfactor, m_jumpY, x, 1., m_temp);
442 }
443 }
444 dg::blas1::pointwiseDivide( alpha, m_temp, m_vol, beta, y);
445 }
446
455 template<class ContainerType0, class ContainerType1>
456 void variation(const ContainerType0& phi, ContainerType1& sigma){
457 variation(1., 1., phi, 0., sigma);
458 }
468 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
469 void variation(const ContainerTypeL& lambda, const ContainerType0& phi, ContainerType1& sigma){
470 variation(1.,lambda, phi, 0., sigma);
471 }
483 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
484 void variation(value_type alpha, const ContainerTypeL& lambda, const ContainerType0& phi, value_type beta, ContainerType1& sigma)
485 {
486 dg::blas2::gemv( m_rightx, phi, m_tempx); //R_x*f
487 dg::blas2::gemv( m_righty, phi, m_tempy); //R_y*f
488 dg::tensor::scalar_product2d(alpha, lambda, m_tempx, m_tempy, m_chi, lambda, m_tempx, m_tempy, beta, sigma);
489 }
490
491
492 private:
493 Matrix m_leftx, m_lefty, m_rightx, m_righty, m_jumpX, m_jumpY;
494 Container m_weights, m_precond;
495 Container m_tempx, m_tempy, m_temp;
497 Container m_sigma, m_vol;
498 value_type m_jfactor;
499 bool m_chi_weight_jump;
500};
501
504template <class Geometry, class Matrix, class Container>
506
507//Elliptic3d is tested in inc/geometries/elliptic3d_t.cu
543template <class Geometry, class Matrix, class Container>
545{
546 public:
547 using geometry_type = Geometry;
548 using matrix_type = Matrix;
549 using container_type = Container;
552 Elliptic3d() = default;
564 Elliptic3d( const Geometry& g, direction dir = forward, value_type jfactor=1., bool chi_weight_jump = false):
565 Elliptic3d( g, g.bcx(), g.bcy(), g.bcz(), dir, jfactor, chi_weight_jump)
566 {
567 }
568
582 Elliptic3d( const Geometry& g, bc bcx, bc bcy, bc bcz, direction dir = forward, value_type jfactor = 1., bool chi_weight_jump = false)
583 {
584 // MW we should create an if guard for nx, ny, or nz = 1 and periodic boundaries
585 m_jfactor=jfactor;
586 m_chi_weight_jump = chi_weight_jump;
587 dg::blas2::transfer( dg::create::dx( g, inverse( bcx), inverse(dir)), m_leftx);
588 dg::blas2::transfer( dg::create::dy( g, inverse( bcy), inverse(dir)), m_lefty);
589 dg::blas2::transfer( dg::create::dx( g, bcx, dir), m_rightx);
590 dg::blas2::transfer( dg::create::dy( g, bcy, dir), m_righty);
591 dg::blas2::transfer( dg::create::jumpX( g, bcx), m_jumpX);
592 dg::blas2::transfer( dg::create::jumpY( g, bcy), m_jumpY);
593 if( g.nz() == 1)
594 {
595 dg::blas2::transfer( dg::create::dz( g, bcz, dg::centered), m_rightz);
597 m_addJumpZ = false;
598 }
599 else
600 {
601 dg::blas2::transfer( dg::create::dz( g, bcz, dir), m_rightz);
602 dg::blas2::transfer( dg::create::dz( g, inverse( bcz), inverse(dir)), m_leftz);
603 dg::blas2::transfer( dg::create::jumpZ( g, bcz), m_jumpZ);
604 m_addJumpZ = true;
605 }
606
607 dg::assign( dg::create::volume(g), m_weights);
608 dg::assign( dg::evaluate( dg::one, g), m_precond);
609 m_temp = m_tempx = m_tempy = m_tempz = m_weights;
610 m_chi=g.metric();
611 m_sigma = m_vol = dg::tensor::volume(m_chi);
612 }
614 template<class ...Params>
615 void construct( Params&& ...ps)
616 {
617 //construct and swap
618 *this = Elliptic3d( std::forward<Params>( ps)...);
619 }
620
622 template<class ContainerType0>
623 void set_chi( const ContainerType0& sigma)
624 {
625 dg::blas1::pointwiseDot( sigma, m_vol, m_sigma);
626 //update preconditioner
627 dg::blas1::pointwiseDivide( 1., sigma, m_precond);
628 // sigma is possibly zero, which will invalidate the preconditioner
629 // it is important to call this blas1 function because it can
630 // overwrite NaN in m_precond in the next update
631 }
632
634 template<class ContainerType0>
636 {
637 m_chi = SparseTensor<Container>(tau);
638 }
639
641 const Container& weights()const {
642 return m_weights;
643 }
645 const Container& precond()const {
646 return m_precond;
647 }
649 void set_jfactor( value_type new_jfactor) {m_jfactor = new_jfactor;}
651 value_type get_jfactor() const {return m_jfactor;}
653 void set_jump_weighting( bool jump_weighting) {m_chi_weight_jump = jump_weighting;}
655 bool get_jump_weighting() const {return m_chi_weight_jump;}
656
664 void set_compute_in_2d( bool compute_in_2d ) {
665 m_multiplyZ = !compute_in_2d;
666 }
667
669 template<class ContainerType0, class ContainerType1>
670 void symv( const ContainerType0& x, ContainerType1& y){
671 symv( 1, x, 0, y);
672 }
674 template<class ContainerType0, class ContainerType1>
675 void symv( value_type alpha, const ContainerType0& x, value_type beta, ContainerType1& y)
676 {
677 //compute gradient
678 dg::blas2::gemv( m_rightx, x, m_tempx); //R_x*f
679 dg::blas2::gemv( m_righty, x, m_tempy); //R_y*f
680 if( m_multiplyZ )
681 {
682 dg::blas2::gemv( m_rightz, x, m_tempz); //R_z*f
683
684 //multiply with tensor (note the alias)
685 dg::tensor::multiply3d(m_sigma, m_chi, m_tempx, m_tempy, m_tempz, 0., m_tempx, m_tempy, m_tempz);
686 //now take divergence
687 dg::blas2::symv( -1., m_leftz, m_tempz, 0., m_temp);
688 dg::blas2::symv( -1., m_lefty, m_tempy, 1., m_temp);
689 }
690 else
691 {
692 dg::tensor::multiply2d(m_sigma, m_chi, m_tempx, m_tempy, 0., m_tempx, m_tempy);
693 dg::blas2::symv( -1.,m_lefty, m_tempy, 0., m_temp);
694 }
695 dg::blas2::symv( -1., m_leftx, m_tempx, 1., m_temp);
696
697 //add jump terms
698 if( 0 != m_jfactor )
699 {
700 if(m_chi_weight_jump)
701 {
702 dg::blas2::symv( m_jfactor, m_jumpX, x, 0., m_tempx);
703 dg::blas2::symv( m_jfactor, m_jumpY, x, 0., m_tempy);
704 if( m_addJumpZ)
705 {
706 dg::blas2::symv( m_jfactor, m_jumpZ, x, 0., m_tempz);
707 dg::tensor::multiply3d(m_sigma, m_chi, m_tempx, m_tempy,
708 m_tempz, 0., m_tempx, m_tempy, m_tempz);
709 }
710 else
711 dg::tensor::multiply2d(m_sigma, m_chi, m_tempx, m_tempy,
712 0., m_tempx, m_tempy);
713
714 dg::blas1::axpbypgz(1., m_tempx, 1., m_tempy, 1., m_temp);
715 if( m_addJumpZ)
716 dg::blas1::axpby( 1., m_tempz, 1., m_temp);
717 }
718 else
719 {
720 dg::blas2::symv( m_jfactor, m_jumpX, x, 1., m_temp);
721 dg::blas2::symv( m_jfactor, m_jumpY, x, 1., m_temp);
722 if( m_addJumpZ)
723 dg::blas2::symv( m_jfactor, m_jumpZ, x, 1., m_temp);
724 }
725 }
726 dg::blas1::pointwiseDivide( alpha, m_temp, m_vol, beta, y);
727 }
728
730 template<class ContainerType0, class ContainerType1>
731 void variation(const ContainerType0& phi, ContainerType1& sigma){
732 variation(1.,1., phi, 0., sigma);
733 }
735 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
736 void variation(const ContainerTypeL& lambda, const ContainerType0& phi, ContainerType1& sigma){
737 variation(1.,lambda, phi, 0., sigma);
738 }
740 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
741 void variation(value_type alpha, const ContainerTypeL& lambda, const ContainerType0& phi, value_type beta, ContainerType1& sigma)
742 {
743 dg::blas2::gemv( m_rightx, phi, m_tempx); //R_x*f
744 dg::blas2::gemv( m_righty, phi, m_tempy); //R_y*f
745 if( m_multiplyZ)
746 dg::blas2::gemv( m_rightz, phi, m_tempz); //R_y*f
747 else
748 dg::blas1::scal( m_tempz, 0.);
749 dg::tensor::scalar_product3d(alpha, lambda, m_tempx, m_tempy, m_tempz, m_chi, lambda, m_tempx, m_tempy, m_tempz, beta, sigma);
750 }
751
752 private:
753 Matrix m_leftx, m_lefty, m_leftz, m_rightx, m_righty, m_rightz, m_jumpX, m_jumpY, m_jumpZ;
754 Container m_weights, m_precond;
755 Container m_tempx, m_tempy, m_tempz, m_temp;
757 Container m_sigma, m_vol;
758 value_type m_jfactor;
759 bool m_multiplyZ = true, m_addJumpZ = false;
760 bool m_chi_weight_jump;
761};
763template< class G, class M, class V>
764struct TensorTraits< Elliptic1d<G, M, V> >
765{
766 using value_type = get_value_type<V>;
767 using tensor_category = SelfMadeMatrixTag;
768};
769template< class G, class M, class V>
770struct TensorTraits< Elliptic2d<G, M, V> >
771{
772 using value_type = get_value_type<V>;
773 using tensor_category = SelfMadeMatrixTag;
774};
775
776template< class G, class M, class V>
777struct TensorTraits< Elliptic3d<G, M, V> >
778{
779 using value_type = get_value_type<V>;
780 using tensor_category = SelfMadeMatrixTag;
781};
783
784} //namespace dg
A 1d negative elliptic differential operator .
Definition: elliptic.h:66
Container container_type
Definition: elliptic.h:70
void operator()(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:166
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition: elliptic.h:161
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition: elliptic.h:157
Elliptic1d(const Geometry &g, direction dir=forward, value_type jfactor=1.)
Construct from Grid.
Definition: elliptic.h:83
Elliptic1d(const Geometry &g, bc bcx, direction dir=forward, value_type jfactor=1.)
Construct from grid and boundary conditions.
Definition: elliptic.h:98
Elliptic1d()=default
empty object ( no memory allocation)
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition: elliptic.h:146
Geometry geometry_type
Definition: elliptic.h:68
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
Compute elliptic term and add to output.
Definition: elliptic.h:177
void set_chi(const ContainerType0 &sigma)
Change scalar part Chi.
Definition: elliptic.h:132
get_value_type< Container > value_type
Definition: elliptic.h:71
Matrix matrix_type
Definition: elliptic.h:69
void symv(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:172
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: elliptic.h:114
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition: elliptic.h:163
A 2d negative elliptic differential operator .
Definition: elliptic.h:231
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition: elliptic.h:363
void symv(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:401
get_value_type< Container > value_type
Definition: elliptic.h:236
void operator()(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:388
Matrix matrix_type
Definition: elliptic.h:234
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: elliptic.h:288
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition: elliptic.h:345
void set_jump_weighting(bool jump_weighting)
Set the chi weighting of jump terms.
Definition: elliptic.h:373
void set_chi(const ContainerType0 &sigma)
Change scalar part in Chi tensor.
Definition: elliptic.h:311
void variation(value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma)
Definition: elliptic.h:484
Elliptic2d(const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from Grid.
Definition: elliptic.h:249
Elliptic2d()=default
empty object ( no memory allocation)
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition: elliptic.h:356
Geometry geometry_type
Definition: elliptic.h:233
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
Compute elliptic term and add to output.
Definition: elliptic.h:415
void variation(const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:469
void set_chi(const SparseTensor< ContainerType0 > &tau)
Change tensor part in Chi tensor.
Definition: elliptic.h:334
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition: elliptic.h:368
Elliptic2d(const Geometry &g, bc bcx, bc bcy, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from grid and boundary conditions.
Definition: elliptic.h:266
void variation(const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:456
Container container_type
Definition: elliptic.h:235
bool get_jump_weighting() const
Get the current state of chi weighted jump terms.
Definition: elliptic.h:378
A 3d negative elliptic differential operator .
Definition: elliptic.h:545
void variation(const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:736
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition: elliptic.h:645
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y)
Compute elliptic term and add to output.
Definition: elliptic.h:675
void variation(const ContainerType0 &phi, ContainerType1 &sigma)
Definition: elliptic.h:731
void set_chi(const SparseTensor< ContainerType0 > &tau)
Change tensor part in Chi tensor.
Definition: elliptic.h:635
void variation(value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma)
Definition: elliptic.h:741
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition: elliptic.h:615
get_value_type< Container > value_type
Definition: elliptic.h:550
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition: elliptic.h:651
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition: elliptic.h:649
Elliptic3d()=default
empty object ( no memory allocation)
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition: elliptic.h:641
Elliptic3d(const Geometry &g, bc bcx, bc bcy, bc bcz, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from grid and boundary conditions.
Definition: elliptic.h:582
void set_compute_in_2d(bool compute_in_2d)
Restrict the problem to the first 2 dimensions.
Definition: elliptic.h:664
void set_chi(const ContainerType0 &sigma)
Change scalar part in Chi tensor.
Definition: elliptic.h:623
Elliptic3d(const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from Grid.
Definition: elliptic.h:564
void symv(const ContainerType0 &x, ContainerType1 &y)
Compute elliptic term and store in output.
Definition: elliptic.h:670
void set_jump_weighting(bool jump_weighting)
Set the chi weighting of jump terms.
Definition: elliptic.h:653
Container container_type
Definition: elliptic.h:549
Matrix matrix_type
Definition: elliptic.h:548
Geometry geometry_type
Definition: elliptic.h:547
bool get_jump_weighting() const
Get the current state of chi weighted jump terms.
Definition: elliptic.h:655
Convenience functions to create 2D derivatives.
enums
Function discretization routines.
void assign(const from_ContainerType &from, ContainerType &to, Params &&... ps)
Generic way to assign the contents of a from_ContainerType object to a ContainerType object optionall...
Definition: blas1.h:665
static DG_DEVICE double one(double x)
Definition: functions.h:20
void copy(const ContainerTypeIn &source, ContainerTypeOut &target)
Definition: blas1.h:164
void axpbypgz(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, const ContainerType2 &y, get_value_type< ContainerType > gamma, ContainerType &z)
Definition: blas1.h:265
void axpby(get_value_type< ContainerType > alpha, const ContainerType1 &x, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:231
void scal(ContainerType &x, get_value_type< ContainerType > alpha)
Definition: blas1.h:185
void pointwiseDivide(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:428
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
Definition: blas1.h:336
void gemv(get_value_type< ContainerType1 > alpha, MatrixType &&M, const ContainerType1 &x, get_value_type< ContainerType1 > beta, ContainerType2 &y)
; (alias for symv)
Definition: blas2.h:299
void transfer(const MatrixType &x, AnotherMatrixType &y)
; Generic way to copy and/or convert a Matrix type to a different Matrix type
Definition: blas2.h:443
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition: blas2.h:287
EllSparseBlockMat< real_type > dz(const aRealTopology3d< real_type > &g, bc bcz, direction dir=centered)
Create 3d derivative in z-direction.
Definition: derivatives.h:308
EllSparseBlockMat< real_type > dx(const aRealTopology2d< real_type > &g, bc bcx, direction dir=centered)
Create 2d derivative in x-direction.
Definition: derivatives.h:33
EllSparseBlockMat< real_type > jumpZ(const aRealTopology3d< real_type > &g, bc bcz)
Matrix that contains jump terms in Z direction in 3D.
Definition: derivatives.h:190
static bc inverse(bc bound)
invert boundary condition
Definition: enums.h:87
bc
Switch between boundary conditions.
Definition: enums.h:15
EllSparseBlockMat< real_type > jumpX(const aRealTopology2d< real_type > &g, bc bcx)
Matrix that contains 2d jump terms in X direction.
Definition: derivatives.h:95
EllSparseBlockMat< real_type > dy(const aRealTopology2d< real_type > &g, bc bcy, direction dir=centered)
Create 2d derivative in y-direction.
Definition: derivatives.h:65
direction
Direction of a discrete derivative.
Definition: enums.h:97
EllSparseBlockMat< real_type > jumpY(const aRealTopology2d< real_type > &g, bc bcy)
Matrix that contains 2d jump terms in Y direction.
Definition: derivatives.h:112
@ forward
forward derivative (cell to the right and current cell)
Definition: enums.h:98
@ centered
centered derivative (cell to the left and right and current cell)
Definition: enums.h:100
@ y
y direction
@ x
x direction
thrust::host_vector< real_type > evaluate(UnaryOp f, const RealGrid1d< real_type > &g)
Evaluate a 1d function on grid coordinates.
Definition: evaluation.h:67
MPI_Vector< thrust::host_vector< real_type > > weights(const aRealMPITopology2d< real_type > &g)
Nodal weight coefficients.
Definition: mpi_weights.h:22
EllSparseBlockMat< real_type > jump(int n, int N, real_type h, bc bcx)
Create and assemble a host Matrix for the jump terms in 1d.
Definition: dx.h:310
get_host_vector< Geometry > volume(const Geometry &g)
Create the volume element on the grid (including weights!!)
Definition: transform.h:225
void scalar_product2d(get_value_type< ContainerType0 > alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const SparseTensor< ContainerType2 > &t, const ContainerTypeM &mu, const ContainerType3 &w0, const ContainerType4 &w1, get_value_type< ContainerType0 > beta, ContainerType5 &y)
Definition: multiply.h:510
void multiply2d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerTypeM &mu, ContainerType3 &out0, ContainerType4 &out1)
Definition: multiply.h:230
ContainerType volume(const SparseTensor< ContainerType > &t)
Definition: multiply.h:406
void multiply3d(const ContainerTypeL &lambda, const SparseTensor< ContainerType0 > &t, const ContainerType1 &in0, const ContainerType2 &in1, const ContainerType3 &in2, const ContainerTypeM &mu, ContainerType4 &out0, ContainerType5 &out1, ContainerType6 &out2)
Definition: multiply.h:256
void scalar_product3d(get_value_type< ContainerType0 > alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const ContainerType2 &v2, const SparseTensor< ContainerType3 > &t, const ContainerTypeM &mu, const ContainerType4 &w0, const ContainerType5 &w1, const ContainerType6 &w2, get_value_type< ContainerType0 > beta, ContainerType7 &y)
Definition: multiply.h:552
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition: tensor_traits.h:38
Function discretization routines for mpi vectors.
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
Class for 2x2 and 3x3 matrices sharing elements.
Definition: tensor.h:66
NotATensorTag tensor_category
Definition: tensor_traits.h:33
void value_type
Definition: tensor_traits.h:32