Discontinuous Galerkin Library
#include "dg/algorithm.h"
Loading...
Searching...
No Matches
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
10#endif
11#include "topology/geometry.h"
12
17namespace dg
18{
19// Note that there are many tests for this file : elliptic2d_b,
20// elliptic2d_mpib, elliptic_b, elliptic_mpib, ellipticX2d_b
21// And don't forget inc/geometries/elliptic3d_t (testing alignment and
22// projection tensors as Chi) geometry_elliptic_b, geometry_elliptic_mpib,
23// and geometryX_elliptic_b and geometryX_refined_elliptic_b
24
25
26// NOTE: Direct applications of Elliptic converge with n-2
27
77template <class Geometry, class Matrix, class Container, class ContainerTmp = Container>
79{
80 public:
81 using geometry_type = Geometry;
86 Elliptic1d() = default;
98 Elliptic1d( const Geometry& g,
99 direction dir = forward, value_type jfactor=1.):
100 Elliptic1d( g, g.bcx(), dir, jfactor)
101 {
102 }
103
114 Elliptic1d( const Geometry& g, bc bcx,
115 direction dir = forward,
116 value_type jfactor=1.)
117 {
118 m_jfactor=jfactor;
119 dg::blas2::transfer( dg::create::dx( g, inverse( bcx), inverse(dir)), m_leftx);
120 dg::blas2::transfer( dg::create::dx( g, bcx, dir), m_rightx);
122
123 dg::assign( dg::create::weights(g), m_weights);
124 dg::assign( dg::evaluate( dg::one, g), m_precond);
125 dg::assign( m_precond, m_sigma);
126 dg::assign( m_precond, m_tempx);
127 }
128
130 template<class ...Params>
131 void construct( Params&& ...ps)
132 {
133 //construct and swap
134 *this = Elliptic1d( std::forward<Params>( ps)...);
135 }
136
148 template<class ContainerType0>
149 void set_chi( const ContainerType0& sigma)
150 {
151 dg::blas1::copy( sigma, m_sigma);
152 //update preconditioner
153 dg::blas1::pointwiseDivide( 1., sigma, m_precond);
154 // sigma is possibly zero, which will invalidate the preconditioner
155 // it is important to call this blas1 function because it can
156 // overwrite NaN in m_precond in the next update
157 }
158
163 const Container& get_chi() const { return m_sigma;}
164
169 const Container& weights()const {
170 return m_weights;
171 }
180 const Container& precond()const {
181 return m_precond;
182 }
184 void set_jfactor( value_type new_jfactor) {m_jfactor = new_jfactor;}
186 value_type get_jfactor() const {return m_jfactor;}
188 template<class ContainerType0, class ContainerType1>
189 void operator()( const ContainerType0& x, ContainerType1& y) const {
190 symv( 1, x, 0, y);
191 }
192
194 template<class ContainerType0, class ContainerType1>
195 void symv( const ContainerType0& x, ContainerType1& y) const {
196 symv( 1, x, 0, y);
197 }
199 template<class ContainerType0, class ContainerType1>
200 void symv( value_type alpha, const ContainerType0& x, value_type beta, ContainerType1& y) const
201 {
202 symv( alpha, x, m_jfactor, m_sigma, beta, y);
203 }
206 template<class ContainerType0, class ContainerType1, class ContainerType2>
207 void symv( value_type alpha, const ContainerType0& x, value_type jfactor, const ContainerType2& sigma, value_type beta, ContainerType1& y) const
208 {
209 dg::blas2::gemv( m_rightx, x, m_tempx);
210 dg::blas1::pointwiseDot( m_tempx, sigma, m_tempx);
211 dg::blas2::symv( -alpha, m_leftx, m_tempx, beta, y);
212 //add jump terms
213 if( 0.0 != jfactor )
214 {
215 dg::blas2::symv( jfactor*alpha, m_jumpX, x, 1., y);
216 }
217 }
218
219 private:
220 Matrix m_leftx, m_rightx, m_jumpX;
221 Container m_weights, m_precond;
222 mutable ContainerTmp m_tempx; // could be complex
223 Container m_sigma;
224 value_type m_jfactor;
225};
226
261template <class Geometry, class Matrix, class Container, class ContainerTmp = Container>
263{
264 public:
265 using geometry_type = Geometry;
270 Elliptic2d() = default;
286 Elliptic2d( const Geometry& g,
287 direction dir = forward, value_type jfactor=1., bool chi_weight_jump = false):
288 Elliptic2d( g, g.bcx(), g.bcy(), dir, jfactor, chi_weight_jump)
289 {
290 }
291
308 Elliptic2d( const Geometry& g, bc bcx, bc bcy,
309 direction dir = forward,
310 value_type jfactor=1., bool chi_weight_jump = false)
311 {
312 m_jfactor=jfactor;
313 m_chi_weight_jump = chi_weight_jump;
314 dg::blas2::transfer( dg::create::dx( g, inverse( bcx), inverse(dir)), m_leftx);
315 dg::blas2::transfer( dg::create::dy( g, inverse( bcy), inverse(dir)), m_lefty);
316 dg::blas2::transfer( dg::create::dx( g, bcx, dir), m_rightx);
317 dg::blas2::transfer( dg::create::dy( g, bcy, dir), m_righty);
320
321 dg::assign( dg::create::volume(g), m_weights);
322 dg::assign( dg::evaluate( dg::one, g), m_precond);
323 dg::assign( m_weights, m_temp);
324 m_tempx = m_tempy = m_temp;
325 m_chi=g.metric();
326 m_sigma = m_vol = dg::tensor::volume(m_chi);
327 }
328
330 template<class ...Params>
331 void construct( Params&& ...ps)
332 {
333 //construct and swap
334 *this = Elliptic2d( std::forward<Params>( ps)...);
335 }
336
353 template<class ContainerType0>
354 void set_chi( const ContainerType0& sigma)
355 {
356 dg::blas1::pointwiseDot( sigma, m_vol, m_sigma);
357 //update preconditioner
358 dg::blas1::pointwiseDivide( 1., sigma, m_precond);
359 // sigma is possibly zero, which will invalidate the preconditioner
360 // it is important to call this blas1 function because it can
361 // overwrite NaN in m_precond in the next update
362 }
376 template<class ContainerType0>
378 {
380 }
381
387 const SparseTensor<Container>& get_tau() const { return m_chi;}
393 const Container& get_sigma() const { return m_sigma;}
394
401 const Container& weights()const {
402 return m_weights;
403 }
412 const Container& precond()const {
413 return m_precond;
414 }
419 void set_jfactor( value_type new_jfactor) {m_jfactor = new_jfactor;}
424 value_type get_jfactor() const {return m_jfactor;}
429 void set_jump_weighting( bool jump_weighting) {m_chi_weight_jump = jump_weighting;}
434 bool get_jump_weighting() const {return m_chi_weight_jump;}
443 template<class ContainerType0, class ContainerType1>
444 void operator()( const ContainerType0& x, ContainerType1& y) const {
445 symv( 1, x, 0, y);
446 }
447
456 template<class ContainerType0, class ContainerType1>
457 void symv( const ContainerType0& x, ContainerType1& y) const {
458 symv( 1, x, 0, y);
459 }
470 template<class ContainerType0, class ContainerType1>
471 void symv( value_type alpha, const ContainerType0& x, value_type beta, ContainerType1& y) const
472 {
473 symv( alpha, x, m_jfactor, m_sigma, beta, y);
474 }
500 template<class ContainerType0, class ContainerType1, class ContainerType2>
501 void symv( value_type alpha, const ContainerType0& x, value_type jfactor, const ContainerType2& sigma, value_type beta, ContainerType1& y) const
502 {
503 //compute gradient
504 dg::blas2::gemv( m_rightx, x, m_tempx); //R_x*f
505 dg::blas2::gemv( m_righty, x, m_tempy); //R_y*f
506
507 //multiply with tensor (note the alias)
508 dg::tensor::multiply2d(sigma, m_chi, m_tempx, m_tempy, 0., m_tempx, m_tempy);
509
510 //now take divergence
511 dg::blas2::symv( m_lefty, m_tempy, m_temp);
512 dg::blas2::symv( -1., m_leftx, m_tempx, -1., m_temp);
513
514 //add jump terms
515 if( 0.0 != jfactor )
516 {
517 if(m_chi_weight_jump)
518 {
519 dg::blas2::symv( jfactor, m_jumpX, x, 0., m_tempx);
520 dg::blas2::symv( jfactor, m_jumpY, x, 0., m_tempy);
521 dg::tensor::multiply2d(sigma, m_chi, m_tempx, m_tempy, 0., m_tempx, m_tempy);
522 dg::blas1::axpbypgz(1.0,m_tempx,1.0,m_tempy,1.0,m_temp);
523 }
524 else
525 {
526 dg::blas2::symv( jfactor, m_jumpX, x, 1., m_temp);
527 dg::blas2::symv( jfactor, m_jumpY, x, 1., m_temp);
528 }
529 }
530 dg::blas1::pointwiseDivide( alpha, m_temp, m_vol, beta, y);
531 }
532
541 template<class ContainerType0, class ContainerType1>
542 void variation(const ContainerType0& phi, ContainerType1& sigma) const{
543 variation(1., 1., phi, 0., sigma);
544 }
554 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
555 void variation(const ContainerTypeL& lambda, const ContainerType0& phi, ContainerType1& sigma) const{
556 variation(1.,lambda, phi, 0., sigma);
557 }
569 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
570 void variation(value_type alpha, const ContainerTypeL& lambda, const ContainerType0& phi, value_type beta, ContainerType1& sigma) const
571 {
572 dg::blas2::gemv( m_rightx, phi, m_tempx); //R_x*f
573 dg::blas2::gemv( m_righty, phi, m_tempy); //R_y*f
574 dg::tensor::scalar_product2d(alpha, lambda, m_tempx, m_tempy, m_chi, lambda, m_tempx, m_tempy, beta, sigma);
575 }
576
577
578 private:
579 Matrix m_leftx, m_lefty, m_rightx, m_righty, m_jumpX, m_jumpY;
580 Container m_weights, m_precond;
581 mutable ContainerTmp m_tempx, m_tempy, m_temp;
583 Container m_sigma, m_vol;
584 value_type m_jfactor;
585 bool m_chi_weight_jump;
586};
587
590template <class Geometry, class Matrix, class Container, class ContainerTmp = Container>
592
593//Elliptic3d is tested in inc/geometries/elliptic3d_b.cpp
631template <class Geometry, class Matrix, class Container, class ContainerTmp = Container>
633{
634 public:
635 using geometry_type = Geometry;
640 Elliptic3d() = default;
652 Elliptic3d( const Geometry& g, direction dir = forward, value_type jfactor=1., bool chi_weight_jump = false):
653 Elliptic3d( g, g.bcx(), g.bcy(), g.bcz(), dir, jfactor, chi_weight_jump)
654 {
655 }
656
670 Elliptic3d( const Geometry& g, bc bcx, bc bcy, bc bcz, direction dir = forward, value_type jfactor = 1., bool chi_weight_jump = false)
671 {
672 // MW we should create an if guard for nx, ny, or nz = 1 and periodic boundaries
673 m_jfactor=jfactor;
674 m_chi_weight_jump = chi_weight_jump;
675 dg::blas2::transfer( dg::create::dx( g, inverse( bcx), inverse(dir)), m_leftx);
676 dg::blas2::transfer( dg::create::dy( g, inverse( bcy), inverse(dir)), m_lefty);
677 dg::blas2::transfer( dg::create::dx( g, bcx, dir), m_rightx);
678 dg::blas2::transfer( dg::create::dy( g, bcy, dir), m_righty);
681 if( g.nz() == 1)
682 {
683 dg::blas2::transfer( dg::create::dz( g, bcz, dg::centered), m_rightz);
685 m_addJumpZ = false;
686 }
687 else
688 {
689 dg::blas2::transfer( dg::create::dz( g, bcz, dir), m_rightz);
690 dg::blas2::transfer( dg::create::dz( g, inverse( bcz), inverse(dir)), m_leftz);
691 dg::blas2::transfer( dg::create::jumpZ( g, bcz), m_jumpZ);
692 m_addJumpZ = true;
693 }
694
695 dg::assign( dg::create::volume(g), m_weights);
696 dg::assign( dg::evaluate( dg::one, g), m_precond);
697 dg::assign( m_weights, m_temp);
698 m_tempx = m_tempy = m_tempz = m_temp;
699 m_chi=g.metric();
700 m_sigma = m_vol = dg::tensor::volume(m_chi);
701 }
703 template<class ...Params>
704 void construct( Params&& ...ps)
705 {
706 //construct and swap
707 *this = Elliptic3d( std::forward<Params>( ps)...);
708 }
709
711 template<class ContainerType0>
712 void set_chi( const ContainerType0& sigma)
713 {
714 dg::blas1::pointwiseDot( sigma, m_vol, m_sigma);
715 //update preconditioner
716 dg::blas1::pointwiseDivide( 1., sigma, m_precond);
717 // sigma is possibly zero, which will invalidate the preconditioner
718 // it is important to call this blas1 function because it can
719 // overwrite NaN in m_precond in the next update
720 }
721
723 template<class ContainerType0>
725 {
727 }
729 const SparseTensor<Container>& get_tau() const { return m_chi;}
731 const Container& get_sigma() const { return m_sigma;}
732
734 const Container& weights()const {
735 return m_weights;
736 }
738 const Container& precond()const {
739 return m_precond;
740 }
742 void set_jfactor( value_type new_jfactor) {m_jfactor = new_jfactor;}
744 value_type get_jfactor() const {return m_jfactor;}
746 void set_jump_weighting( bool jump_weighting) {m_chi_weight_jump = jump_weighting;}
748 bool get_jump_weighting() const {return m_chi_weight_jump;}
749
757 void set_compute_in_2d( bool compute_in_2d ) {
758 m_multiplyZ = !compute_in_2d;
759 }
760
762 template<class ContainerType0, class ContainerType1>
763 void symv( const ContainerType0& x, ContainerType1& y) const {
764 symv( 1, x, 0, y);
765 }
767 template<class ContainerType0, class ContainerType1>
768 void symv( value_type alpha, const ContainerType0& x, value_type beta, ContainerType1& y) const
769 {
770 symv( alpha, x, m_jfactor, m_sigma, beta, y);
771 }
773 template<class ContainerType0, class ContainerType1, class ContainerType2>
774 void symv( value_type alpha, const ContainerType0& x, value_type jfactor, const ContainerType2& sigma, value_type beta, ContainerType1& y) const
775 {
776 //compute gradient
777 dg::blas2::gemv( m_rightx, x, m_tempx); //R_x*f
778 dg::blas2::gemv( m_righty, x, m_tempy); //R_y*f
779 if( m_multiplyZ )
780 {
781 dg::blas2::gemv( m_rightz, x, m_tempz); //R_z*f
782
783 //multiply with tensor (note the alias)
784 dg::tensor::multiply3d(sigma, m_chi, m_tempx, m_tempy, m_tempz, 0., m_tempx, m_tempy, m_tempz);
785 //now take divergence
786 dg::blas2::symv( -1., m_leftz, m_tempz, 0., m_temp);
787 dg::blas2::symv( -1., m_lefty, m_tempy, 1., m_temp);
788 }
789 else
790 {
791 dg::tensor::multiply2d(sigma, m_chi, m_tempx, m_tempy, 0., m_tempx, m_tempy);
792 dg::blas2::symv( -1.,m_lefty, m_tempy, 0., m_temp);
793 }
794 dg::blas2::symv( -1., m_leftx, m_tempx, 1., m_temp);
795
796 //add jump terms
797 if( 0 != jfactor )
798 {
799 if(m_chi_weight_jump)
800 {
801 dg::blas2::symv( jfactor, m_jumpX, x, 0., m_tempx);
802 dg::blas2::symv( jfactor, m_jumpY, x, 0., m_tempy);
803 if( m_addJumpZ)
804 {
805 dg::blas2::symv( jfactor, m_jumpZ, x, 0., m_tempz);
806 dg::tensor::multiply3d(sigma, m_chi, m_tempx, m_tempy,
807 m_tempz, 0., m_tempx, m_tempy, m_tempz);
808 }
809 else
810 dg::tensor::multiply2d(sigma, m_chi, m_tempx, m_tempy,
811 0., m_tempx, m_tempy);
812
813 dg::blas1::axpbypgz(1., m_tempx, 1., m_tempy, 1., m_temp);
814 if( m_addJumpZ)
815 dg::blas1::axpby( 1., m_tempz, 1., m_temp);
816 }
817 else
818 {
819 dg::blas2::symv( jfactor, m_jumpX, x, 1., m_temp);
820 dg::blas2::symv( jfactor, m_jumpY, x, 1., m_temp);
821 if( m_addJumpZ)
822 dg::blas2::symv( jfactor, m_jumpZ, x, 1., m_temp);
823 }
824 }
825 dg::blas1::pointwiseDivide( alpha, m_temp, m_vol, beta, y);
826 }
827
829 template<class ContainerType0, class ContainerType1>
830 void variation(const ContainerType0& phi, ContainerType1& sigma)const{
831 variation(1.,1., phi, 0., sigma);
832 }
834 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
835 void variation(const ContainerTypeL& lambda, const ContainerType0& phi, ContainerType1& sigma)const{
836 variation(1.,lambda, phi, 0., sigma);
837 }
839 template<class ContainerTypeL, class ContainerType0, class ContainerType1>
840 void variation(value_type alpha, const ContainerTypeL& lambda, const ContainerType0& phi, value_type beta, ContainerType1& sigma)const
841 {
842 dg::blas2::gemv( m_rightx, phi, m_tempx); //R_x*f
843 dg::blas2::gemv( m_righty, phi, m_tempy); //R_y*f
844 if( m_multiplyZ)
845 dg::blas2::gemv( m_rightz, phi, m_tempz); //R_y*f
846 else
847 dg::blas1::scal( m_tempz, 0.);
848 dg::tensor::scalar_product3d(alpha, lambda, m_tempx, m_tempy, m_tempz, m_chi, lambda, m_tempx, m_tempy, m_tempz, beta, sigma);
849 }
850
851 private:
852 Matrix m_leftx, m_lefty, m_leftz, m_rightx, m_righty, m_rightz, m_jumpX, m_jumpY, m_jumpZ;
853 Container m_weights, m_precond;
854 mutable ContainerTmp m_tempx, m_tempy, m_tempz, m_temp;
856 Container m_sigma, m_vol;
857 value_type m_jfactor;
858 bool m_multiplyZ = true, m_addJumpZ = false;
859 bool m_chi_weight_jump;
860};
862template< class G, class M, class V, class V2>
863struct TensorTraits< Elliptic1d<G, M, V, V2> >
864{
866 using tensor_category = SelfMadeMatrixTag;
867};
868template< class G, class M, class V, class V2>
869struct TensorTraits< Elliptic2d<G, M, V, V2> >
870{
872 using tensor_category = SelfMadeMatrixTag;
873};
874
875template< class G, class M, class V, class V2>
876struct TensorTraits< Elliptic3d<G, M, V, V2> >
877{
879 using tensor_category = SelfMadeMatrixTag;
880};
882
883} //namespace dg
A 1d negative elliptic differential operator .
Definition elliptic.h:79
Geometry geometry_type
Definition elliptic.h:81
Container container_type
Definition elliptic.h:83
void set_chi(const ContainerType0 &sigma)
Change scalar part Chi.
Definition elliptic.h:149
void operator()(const ContainerType0 &x, ContainerType1 &y) const
Compute elliptic term and store in output.
Definition elliptic.h:189
Elliptic1d(const Geometry &g, bc bcx, direction dir=forward, value_type jfactor=1.)
Construct from grid and boundary conditions.
Definition elliptic.h:114
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition elliptic.h:131
get_value_type< Container > value_type
Definition elliptic.h:84
void symv(const ContainerType0 &x, ContainerType1 &y) const
Compute elliptic term and store in output.
Definition elliptic.h:195
Elliptic1d()=default
empty object ( no memory allocation)
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y) const
Compute elliptic term and add to output.
Definition elliptic.h:200
void symv(value_type alpha, const ContainerType0 &x, value_type jfactor, const ContainerType2 &sigma, value_type beta, ContainerType1 &y) const
Compute elliptic term and add to output.
Definition elliptic.h:207
const Container & get_chi() const
Return the scalar part Chi.
Definition elliptic.h:163
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition elliptic.h:184
Elliptic1d(const Geometry &g, direction dir=forward, value_type jfactor=1.)
Construct from Grid.
Definition elliptic.h:98
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition elliptic.h:180
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition elliptic.h:169
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition elliptic.h:186
A 2d negative elliptic differential operator .
Definition elliptic.h:263
void symv(const ContainerType0 &x, ContainerType1 &y) const
Compute elliptic term and store in output.
Definition elliptic.h:457
void variation(const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma) const
Definition elliptic.h:555
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y) const
Compute elliptic term and add to output.
Definition elliptic.h:471
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition elliptic.h:424
const SparseTensor< Container > & get_tau() const
Get tensor part of Chi tensor.
Definition elliptic.h:387
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition elliptic.h:412
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition elliptic.h:419
void symv(value_type alpha, const ContainerType0 &x, value_type jfactor, const ContainerType2 &sigma, value_type beta, ContainerType1 &y) const
Compute elliptic term and add to output.
Definition elliptic.h:501
get_value_type< Container > value_type
Definition elliptic.h:268
Geometry geometry_type
Definition elliptic.h:265
void set_chi(const SparseTensor< ContainerType0 > &tau)
Change tensor part in Chi tensor.
Definition elliptic.h:377
void set_jump_weighting(bool jump_weighting)
Set the chi weighting of jump terms.
Definition elliptic.h:429
Elliptic2d(const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from Grid.
Definition elliptic.h:286
Container container_type
Definition elliptic.h:267
void variation(value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma) const
Definition elliptic.h:570
void set_chi(const ContainerType0 &sigma)
Change scalar part in Chi tensor.
Definition elliptic.h:354
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition elliptic.h:331
bool get_jump_weighting() const
Get the current state of chi weighted jump terms.
Definition elliptic.h:434
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition elliptic.h:401
Elliptic2d()=default
empty object ( no memory allocation)
void variation(const ContainerType0 &phi, ContainerType1 &sigma) const
Definition elliptic.h:542
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:308
void operator()(const ContainerType0 &x, ContainerType1 &y) const
Compute elliptic term and store in output.
Definition elliptic.h:444
const Container & get_sigma() const
Get scalar part of Chi tensor.
Definition elliptic.h:393
A 3d negative elliptic differential operator .
Definition elliptic.h:633
const Container & get_sigma() const
Get scalar part of Chi tensor.
Definition elliptic.h:731
get_value_type< Container > value_type
Definition elliptic.h:638
void set_compute_in_2d(bool compute_in_2d)
Restrict the problem to the first 2 dimensions.
Definition elliptic.h:757
const Container & weights() const
Return the weights making the operator self-adjoint.
Definition elliptic.h:734
const SparseTensor< Container > & get_tau() const
Get tensor part of Chi tensor.
Definition elliptic.h:729
bool get_jump_weighting() const
Get the current state of chi weighted jump terms.
Definition elliptic.h:748
void set_chi(const SparseTensor< ContainerType0 > &tau)
Change tensor part in Chi tensor.
Definition elliptic.h:724
void symv(const ContainerType0 &x, ContainerType1 &y) const
Compute elliptic term and store in output.
Definition elliptic.h:763
void set_chi(const ContainerType0 &sigma)
Change scalar part in Chi tensor.
Definition elliptic.h:712
void symv(value_type alpha, const ContainerType0 &x, value_type beta, ContainerType1 &y) const
Compute elliptic term and add to output.
Definition elliptic.h:768
void set_jump_weighting(bool jump_weighting)
Set the chi weighting of jump terms.
Definition elliptic.h:746
void construct(Params &&...ps)
Perfect forward parameters to one of the constructors.
Definition elliptic.h:704
const Container & precond() const
Return the default preconditioner to use in conjugate gradient.
Definition elliptic.h:738
void set_jfactor(value_type new_jfactor)
Set the currently used jfactor ( )
Definition elliptic.h:742
value_type get_jfactor() const
Get the currently used jfactor ( )
Definition elliptic.h:744
void symv(value_type alpha, const ContainerType0 &x, value_type jfactor, const ContainerType2 &sigma, value_type beta, ContainerType1 &y) const
Compute elliptic term and add to output.
Definition elliptic.h:774
Container container_type
Definition elliptic.h:637
Elliptic3d()=default
empty object ( no memory allocation)
void variation(const ContainerTypeL &lambda, const ContainerType0 &phi, ContainerType1 &sigma) const
Definition elliptic.h:835
Elliptic3d(const Geometry &g, direction dir=forward, value_type jfactor=1., bool chi_weight_jump=false)
Construct from Grid.
Definition elliptic.h:652
void variation(value_type alpha, const ContainerTypeL &lambda, const ContainerType0 &phi, value_type beta, ContainerType1 &sigma) const
Definition elliptic.h:840
Geometry geometry_type
Definition elliptic.h:635
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:670
void variation(const ContainerType0 &phi, ContainerType1 &sigma) const
Definition elliptic.h:830
enums
Function discretization routines.
DG_DEVICE T one(T, Ts ...)
Definition functions.h:24
void copy(const ContainerTypeIn &source, ContainerTypeOut &target)
Definition blas1.h:243
void axpbypgz(value_type alpha, const ContainerType1 &x, value_type1 beta, const ContainerType2 &y, value_type2 gamma, ContainerType &z)
Definition blas1.h:337
void axpby(value_type alpha, const ContainerType1 &x, value_type1 beta, ContainerType &y)
Definition blas1.h:306
void pointwiseDot(value_type alpha, const ContainerType1 &x1, const ContainerType2 &x2, value_type1 beta, ContainerType &y)
Definition blas1.h:406
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:767
void scal(ContainerType &x, value_type alpha)
Definition blas1.h:263
void pointwiseDivide(value_type alpha, const ContainerType1 &x1, const ContainerType2 &x2, value_type1 beta, ContainerType &y)
Definition blas1.h:495
void gemv(get_value_type< ContainerType1 > alpha, MatrixType &&M, const ContainerType1 &x, get_value_type< ContainerType1 > beta, ContainerType2 &y)
Alias for blas2::symv ;.
Definition blas2.h:345
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:479
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
Definition blas2.h:331
auto dx(const Topology &g, dg::bc bc, dg::direction dir=centered)
Definition derivativesT.h:14
auto dy(const Topology &g, dg::bc bc, dg::direction dir=centered)
Short for dg::create::derivative( 1, g, bc, dir);
Definition derivativesT.h:21
auto jumpY(const Topology &g, bc bc)
Short for dg::create::jump( 1, g, bc);
Definition derivativesT.h:43
bc
Switch between boundary conditions.
Definition enums.h:15
auto jumpZ(const Topology &g, bc bc)
Short for dg::create::jump( 2, g, bc);
Definition derivativesT.h:50
direction
Direction of a discrete derivative.
Definition enums.h:97
auto dz(const Topology &g, dg::bc bc, dg::direction dir=centered)
Short for dg::create::derivative( 2, g, bc, dir);
Definition derivativesT.h:28
bc inverse(bc bound)
invert boundary condition
Definition enums.h:87
auto jumpX(const Topology &g, bc bc)
Short for dg::create::jump( 0, g, bc);
Definition derivativesT.h:36
@ 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
typename TensorTraits< std::decay_t< Vector > >::value_type get_value_type
Definition tensor_traits.h:45
auto weights(const Topology &g)
Nodal weight coefficients.
Definition weights.h:62
auto evaluate(Functor &&f, const Topology &g)
Evaluate a function on grid coordinates
Definition evaluation.h:74
Geometry::host_vector volume(const Geometry &g)
Create the volume element on the grid (including weights!!)
Definition transform.h:192
void scalar_product2d(value_type0 alpha, const ContainerTypeL &lambda, const ContainerType0 &v0, const ContainerType1 &v1, const SparseTensor< ContainerType2 > &t, const ContainerTypeM &mu, const ContainerType3 &w0, const ContainerType4 &w1, value_type1 beta, ContainerType5 &y)
Definition multiply.h:493
void scalar_product3d(value_type0 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, value_type1 beta, ContainerType7 &y)
Definition multiply.h:533
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:215
ContainerType volume(const SparseTensor< ContainerType > &t)
Definition multiply.h:389
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:240
dg::bc bcy
dg::DVec Container
dg::bc bcx
const double alpha
Function discretization routines for mpi vectors.
This is the namespace for all functions and classes defined and used by the discontinuous Galerkin li...
const double beta
const double tau
Ell Sparse Block Matrix format.
Definition sparseblockmat.h:46
Class for 2x2 and 3x3 matrices sharing elements.
Definition tensor.h:51
NotATensorTag tensor_category
Definition tensor_traits.h:40
double value_type