36 #ifndef __H__UG__PLUGINS__D3F__EMBASS__
37 #define __H__UG__PLUGINS__D3F__EMBASS__
62 template <
typename TDomain,
typename TAlgebra>
99 {
UG_THROW (
"IInterfaceExtrapolation: Virtual functions are not implemented in the base class.");}
111 {
UG_THROW (
"IInterfaceExtrapolation: Virtual functions are not implemented in the base class.");}
121 {
UG_THROW (
"IInterfaceExtrapolation: Virtual functions are not implemented in the base class.");}
130 {
UG_THROW (
"IInterfaceExtrapolation: Virtual functions are not implemented in the base class.");}
137 {
UG_THROW (
"IInterfaceExtrapolation: Virtual functions are not implemented in the base class.");}
144 {
UG_THROW (
"IInterfaceExtrapolation: Virtual functions are not implemented in the base class.");}
157 template <
typename TDomain,
typename TAlgebra,
typename TExtrapolation>
204 template <
typename TElem,
typename TIterator>
211 int si,
bool bNonRegularGrid,
216 template <
typename TElem,
typename TIterator>
223 int si,
bool bNonRegularGrid,
228 template <
typename TElem,
typename TIterator>
235 int si,
bool bNonRegularGrid,
240 template <
typename TElem,
typename TIterator>
247 int si,
bool bNonRegularGrid,
253 template <
typename TElem,
typename TIterator>
260 int si,
bool bNonRegularGrid,
265 template <
typename TElem,
typename TIterator>
272 int si,
bool bNonRegularGrid,
275 const std::vector<number>& vScaleMass,
276 const std::vector<number>& vScaleStiff,
279 template <
typename TElem,
typename TIterator>
286 int si,
bool bNonRegularGrid,
291 template <
typename TElem,
typename TIterator>
298 int si,
bool bNonRegularGrid,
302 const std::vector<number>& vScaleMass,
303 const std::vector<number>& vScaleStiff,
312 template <
typename TElem,
typename TIterator>
319 int si,
bool bNonRegularGrid,
324 UG_THROW (
"LSGFGlobAssembler::AssembleRhs: Cannot assemble the RHS in GF independently of the matrix");
327 template <
typename TElem,
typename TIterator>
334 int si,
bool bNonRegularGrid,
337 const std::vector<number>& vScaleMass,
338 const std::vector<number>& vScaleStiff,
341 UG_THROW (
"LSGFGlobAssembler::AssembleRhs: Cannot assemble the RHS in GF independently of the matrix");
364 bool bNonRegularGrid,
370 template <
typename TElem,
typename TIterator>
377 int si,
bool bNonRegularGrid,
395 bool bNonRegularGrid,
400 template <
typename TElem,
typename TIterator>
407 int si,
bool bNonRegularGrid,
417 template <
typename TElem,
typename TIterator>
427 bool bNonRegularGrid,
431 UG_THROW (
"AssembleErrorEstimator: No error estimator implemented for the Ghost-Fluid method.");
434 template <
typename TElem,
typename TIterator>
444 bool bNonRegularGrid,
445 std::vector<number> vScaleMass,
446 std::vector<number> vScaleStiff,
450 UG_THROW (
"AssembleErrorEstimator: No error estimator implemented for the Ghost-Fluid method.");
486 m_extrapol.prepare_interface_bc (spApproxSpace);
493 const char* fct_name,
497 m_extrapol.set_Dirichlet_for (spApproxSpace, fct_name, value);
504 const char* fct_name,
515 const char* fct_name,
519 m_extrapol.set_plain_Dirichlet_for (spApproxSpace, fct_name,
func);
526 const char* fct_name,
530 m_extrapol.set_plain_Dirichlet_for (spApproxSpace, fct_name, value);
540 m_extrapol.set_Neumann0_for (spApproxSpace, fct_name);
547 const char* subset_names
550 m_extrapol.exclude_subsets (spApproxSpace, subset_names);
580 return m_extrapol.check_elem_lsf (n_co, pElem, si, g_level, use_hanging, vCornerCoords, time);
592 m_extrapol.extrapolate_by_lsf (num_co, base_co, u, fct);
603 m_extrapol.extrapolate_by_lsf (num_co, u, fct);
656 template <
typename TDomain,
typename TAlgebra,
typename TExtrapolation>
712 const std::vector<number> * vScaleMass = NULL,
713 const std::vector<number> * vScaleStiff = NULL
775 template <
typename TDomain,
typename TAlgebra,
typename TExtrapolation>
841 const char* fct_name,
851 const char* fct_name,
861 const char* fct_name,
871 const char* fct_name,
883 const char* fct_name,
884 const char* func_name
893 const char* fct_name,
894 LuaFunctionHandle
func
903 const char* fct_name,
904 const char* func_name
913 const char* fct_name,
914 LuaFunctionHandle
func
934 const char* subset_names
979 int g_level = mg->get_level (pElem);
980 UG_ASSERT (g_level >= 0,
"LSGFDomainDiscretization: Grid element without grid level.");
Definition: smart_pointer.h:108
base class for approximation spaces without type of algebra or dof distribution
Definition: approximation_space.h:279
The AssemblingTuner class combines tools to adapt the assembling routine.
Definition: ass_tuner.h:90
Type based UserData.
Definition: user_data.h:501
Definition: dof_distribution.h:51
generic domain discretization implementing the interface
Definition: domain_disc.h:81
void add(SmartPtr< IElemDisc< TDomain > > elem)
adds an element discretization to the assembling process
Definition: domain_disc.h:333
SmartPtr< approx_space_type > m_spApproxSpace
current approximation space
Definition: domain_disc.h:520
The base class for all geometric objects, such as vertices, edges, faces, volumes,...
Definition: grid_base_objects.h:157
TAlgebra algebra_type
Algebra type.
Definition: assemble_interface.h:113
algebra_type::vector_type vector_type
Type of algebra vector.
Definition: constraint_interface.h:72
algebra_type::matrix_type matrix_type
Type of algebra matrix.
Definition: constraint_interface.h:69
Definition: constraint_interface.h:162
ConstSmartPtr< DoFDistribution > dd(const GridLevel &gl) const
returns the level dof distribution
Definition: constraint_interface.h:242
Definition: elem_disc_interface.h:800
Definition: elem_disc_interface.h:760
a special constraint that sets functions and matrices in the outer subdomain to given values
Definition: dom_disc_embb.h:659
TExtrapolation extrapolation_type
Extrapolation type.
Definition: dom_disc_embb.h:675
algebra_type::matrix_type matrix_type
Matrix type in the algebra.
Definition: dom_disc_embb.h:672
TAlgebra algebra_type
Algebra type.
Definition: dom_disc_embb.h:666
TDomain domain_type
Domain type.
Definition: dom_disc_embb.h:663
int type() const
returns the type of the constraints
Definition: dom_disc_embb.h:759
algebra_type::vector_type vector_type
Vector type in the algebra.
Definition: dom_disc_embb.h:669
extrapolation_type & m_rExtrapolation
Extrapolation in the GF method.
Definition: dom_disc_embb.h:764
void adjust_jacobian(matrix_type &J, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=SPNULL, const number s_a0=1.0)
sets a unity row for all conductor indices
Definition: dom_disc_embb.h:690
void adjust_rhs(vector_type &b, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the dirichlet value in the right-hand side
Definition: dom_disc_embb.h:747
LSGFConstraint(extrapolation_type &rExtrapolation)
class constructor
Definition: dom_disc_embb.h:679
void adjust_solution(vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets the value in the solution for all conductor indices
Definition: dom_disc_embb.h:721
void adjust_linear(matrix_type &A, vector_type &b, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0)
sets unity rows in A and dirichlet values in right-hand side b
Definition: dom_disc_embb.h:733
void adjust_defect(vector_type &d, const vector_type &u, ConstSmartPtr< DoFDistribution > dd, int type, number time=0.0, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol=SPNULL, const std::vector< number > *vScaleMass=NULL, const std::vector< number > *vScaleStiff=NULL)
sets a zero value in the defect for all conductor indices
Definition: dom_disc_embb.h:705
virtual ~LSGFConstraint()
virtual destructor
Definition: dom_disc_embb.h:686
domain discretization for the Level-Set Ghost-Fluid method
Definition: dom_disc_embb.h:779
virtual int check_elem_lsf(size_t n_co, GridObject *pElem, int si, bool use_hanging, const MathVector< dim > vCornerCoords[], number time)
(slow version) checks whether the element is intersected by the interface, or what,...
Definition: dom_disc_embb.h:969
TDomain::grid_type grid_type
Type of the grid.
Definition: dom_disc_embb.h:797
static const int dim
world dimension
Definition: dom_disc_embb.h:812
void set_plain_Dirichlet_on_if_for(const char *fct_name, number value)
sets the 'plain' Dirichlet boundary condition at the interface for a component of the solution
Definition: dom_disc_embb.h:860
void set_Neumann0_on_if_for(const char *fct_name)
sets the Neumann-0 boundary condition at the interface for a component of the solution
Definition: dom_disc_embb.h:924
void project_LSF()
project the level-set function to the coarse levels
Definition: dom_disc_embb.h:947
DomainDiscretizationBase< TDomain, TAlgebra, gass_type > base_type
Type of the base class.
Definition: dom_disc_embb.h:784
void set_Dirichlet_on_if_for(const char *fct_name, SmartPtr< CplUserData< number, dim > > func)
sets the Dirichlet boundary condition at the interface for a component of the solution
Definition: dom_disc_embb.h:850
virtual int check_elem_lsf(size_t n_co, GridObject *pElem, int si, int g_level, bool use_hanging, const MathVector< dim > vCornerCoords[], number time)
checks whether the element is intersected by the interface, or what, and prepares the data
Definition: dom_disc_embb.h:954
gass_type::ls_grid_func_type ls_grid_func_type
Type of the LSF grid functions.
Definition: dom_disc_embb.h:809
virtual void extrapolate_by_lsf(size_t num_co, number *u, size_t fct) const
extrapolates a component of the solution to the vertices behind the interface (by averaging)
Definition: dom_disc_embb.h:998
TAlgebra algebra_type
Type of algebra.
Definition: dom_disc_embb.h:794
virtual number lsf_at(size_t co) const
returns the effective value of the LSF at a corner (use after check_elem_lsf)
Definition: dom_disc_embb.h:1016
LSGFDomainDiscretization(SmartPtr< approx_space_type > pApproxSpace)
default Constructor
Definition: dom_disc_embb.h:816
virtual ~LSGFDomainDiscretization()
virtual destructor
Definition: dom_disc_embb.h:827
void set_assemble_only_cut(bool b)
set the "assemble only in cut elements" flag
Definition: dom_disc_embb.h:941
virtual bool corner_inside(size_t co) const
returns true if the corner is "inside" (use after check_elem_lsf)
Definition: dom_disc_embb.h:1009
algebra_type::vector_type vector_type
Type of algebra vector.
Definition: dom_disc_embb.h:803
void set_plain_Dirichlet_on_if_for(const char *fct_name, SmartPtr< CplUserData< number, dim > > func)
sets the 'plain' Dirichlet boundary condition at the interface for a component of the solution
Definition: dom_disc_embb.h:870
LSGFConstraint< TDomain, TAlgebra, TExtrapolation > ls_constraint_type
Type of the constraint.
Definition: dom_disc_embb.h:787
virtual void extrapolate_by_lsf(size_t num_co, size_t base_co, number *u, size_t fct) const
extrapolates a component of the solution to the vertices behind the interface (w.r....
Definition: dom_disc_embb.h:986
TDomain domain_type
Type of Domain.
Definition: dom_disc_embb.h:791
void exclude_subsets(const char *subset_names)
excludes a (boundary) subsets from the extrapolation
Definition: dom_disc_embb.h:933
SmartPtr< ls_constraint_type > m_spLSFGFConstraint
the Level-Set Function constraint
Definition: dom_disc_embb.h:1023
ApproximationSpace< TDomain > approx_space_type
Type of approximation space.
Definition: dom_disc_embb.h:806
LSGFGlobAssembler< TDomain, TAlgebra, TExtrapolation > gass_type
Type of the global assembler.
Definition: dom_disc_embb.h:781
void set_LSF(SmartPtr< ls_grid_func_type > spLSF)
set the level-set function and check it
Definition: dom_disc_embb.h:831
void set_Dirichlet_on_if_for(const char *fct_name, number value)
sets the Dirichlet boundary condition at the interface for a component of the solution
Definition: dom_disc_embb.h:840
algebra_type::matrix_type matrix_type
Type of algebra matrix.
Definition: dom_disc_embb.h:800
Global assembler based on the ghost-fluid method with a level-set function.
Definition: dom_disc_embb.h:159
extrapolation_type::ls_grid_func_type ls_grid_func_type
Grid function type for the LSF.
Definition: dom_disc_embb.h:181
void FinishTimestep(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:1870
void set_Dirichlet_on_if_for(SmartPtr< approx_space_type > spApproxSpace, const char *fct_name, SmartPtr< CplUserData< number, dim > > func)
adds a Dirichlet BC with a given value on the interface
Definition: dom_disc_embb.h:502
void PrepareTimestep(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< DoFDistribution > dd, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, number future_time, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:1720
static const int dim
world dimension
Definition: dom_disc_embb.h:184
TDomain domain_type
Domain type.
Definition: dom_disc_embb.h:163
virtual void clear_outer_values(vector_type &d, const DoFDistribution *dd) const
sets the values at the outer vertices to 0
Definition: dom_disc_embb.h:622
TAlgebra algebra_type
Algebra type.
Definition: dom_disc_embb.h:166
void set_Dirichlet_on_if_for(SmartPtr< approx_space_type > spApproxSpace, const char *fct_name, number value)
adds a Dirichlet BC with a given value on the interface
Definition: dom_disc_embb.h:491
void AssembleMassMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &M, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:218
void extrapolate_by_lsf(size_t num_co, size_t base_co, number *u, size_t fct) const
extrapolates a component the solution to the vertices behind the interface (w.r.t....
Definition: dom_disc_embb.h:585
virtual ~LSGFGlobAssembler()
virtual destructor
Definition: dom_disc_embb.h:196
void set_plain_Dirichlet_on_if_for(SmartPtr< approx_space_type > spApproxSpace, const char *fct_name, number value)
adds a "plain" Dirichlet BC with a given value on the interface
Definition: dom_disc_embb.h:524
void project_LSF()
project the level-set function to the coarse levels
Definition: dom_disc_embb.h:560
number lsf_at(size_t co) const
returns the effective value of the LSF at a corner (use after check_elem_lsf)
Definition: dom_disc_embb.h:615
void AssembleDefect(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &d, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:747
void set_assemble_only_cut(bool b)
set the "assemble only in cut elements" flag
Definition: dom_disc_embb.h:554
static void AssembleRhs(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &rhs, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb.h:314
void set_Neumann0_on_if_for(SmartPtr< approx_space_type > spApproxSpace, const char *fct_name)
adds a Neumann-0 with on the interface
Definition: dom_disc_embb.h:535
static void AssembleErrorEstimator(const std::vector< IElemError< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, const vector_type &u)
Definition: dom_disc_embb.h:420
LSGFGlobAssembler()
class constructor (may not have any arguments!)
Definition: dom_disc_embb.h:193
void prepare_interface_bc(SmartPtr< approx_space_type > spApproxSpace)
prepares the boundary conditions at the interface: sets all them to Dirichlet-0
Definition: dom_disc_embb.h:482
virtual void set_outer_values(vector_type &u, const DoFDistribution *dd, number time)
sets the values at the outer vertices to given values
Definition: dom_disc_embb.h:630
extrapolation_type m_extrapol
the extrapolation at the interface
Definition: dom_disc_embb.h:459
void exclude_subsets(SmartPtr< approx_space_type > spApproxSpace, const char *subset_names)
excludes a (boundary) subsets from the extrapolation
Definition: dom_disc_embb.h:545
void AssembleLinear(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &A, vector_type &rhs, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:1264
virtual void set_outer_matrices(matrix_type &A, const DoFDistribution *dd) const
sets the matrices at outer vertices to identity
Definition: dom_disc_embb.h:639
void extrapolate_by_lsf(size_t num_co, number *u, size_t fct) const
extrapolates a component the solution to the vertices behind the interface (by averaging)
Definition: dom_disc_embb.h:597
void set_plain_Dirichlet_on_if_for(SmartPtr< approx_space_type > spApproxSpace, const char *fct_name, SmartPtr< CplUserData< number, dim > > func)
adds a "plain" Dirichlet BC with a given value on the interface
Definition: dom_disc_embb.h:513
static void AssembleRhs(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, vector_type &rhs, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, const std::vector< number > &vScaleMass, const std::vector< number > &vScaleStiff, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb.h:329
int check_elem_lsf(size_t n_co, GridObject *pElem, int si, int g_level, bool use_hanging, const MathVector< dim > vCornerCoords[], number time)
checks whether the element is intersected by the interface, or what, and prepares the data
Definition: dom_disc_embb.h:570
static void AssembleErrorEstimator(const std::vector< IElemError< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, std::vector< number > vScaleMass, std::vector< number > vScaleStiff, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol)
Definition: dom_disc_embb.h:437
extrapolation_type & extrapolation()
returns the extrapolation
Definition: dom_disc_embb.h:566
TExtrapolation extrapolation_type
Extrapolation type.
Definition: dom_disc_embb.h:178
bool m_bAssembleOnlyCut
Definition: dom_disc_embb.h:467
ApproximationSpace< domain_type > approx_space_type
type of approximation space
Definition: dom_disc_embb.h:169
void AssembleStiffnessMatrix(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &A, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:60
void FinishTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:1925
void PrepareTimestepElem(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, ConstSmartPtr< VectorTimeSeries< vector_type > > vSol, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:1778
void set_LSF(SmartPtr< ls_grid_func_type > spLSF)
set the level-set function and check it
Definition: dom_disc_embb.h:473
bool corner_inside(size_t co) const
returns true if the corner is "inside" (use after check_elem_lsf)
Definition: dom_disc_embb.h:608
algebra_type::vector_type vector_type
Vector type in the algebra.
Definition: dom_disc_embb.h:172
algebra_type::matrix_type matrix_type
Matrix type in the algebra.
Definition: dom_disc_embb.h:175
void AssembleJacobian(const std::vector< IElemDisc< domain_type > * > &vElemDisc, ConstSmartPtr< domain_type > spDomain, ConstSmartPtr< DoFDistribution > dd, TIterator iterBegin, TIterator iterEnd, int si, bool bNonRegularGrid, matrix_type &J, const vector_type &u, ConstSmartPtr< AssemblingTuner< TAlgebra > > spAssTuner)
Definition: dom_disc_embb_impl.h:376
Factory providing LuaUserData.
Definition: lua_user_data.h:180
static SmartPtr< LuaUserData< TData, dim, TRet > > create(const std::string &name)
Definition: lua_user_data.h:223
Wrapper for sequential matrices to handle them in parallel.
Definition: parallel_matrix.h:65
time series of solutions and corresponding time point
Definition: solution_time_series.h:59
const NullSmartPtr SPNULL
The equivalent to NULL for smart pointers.
Definition: smart_pointer.h:90
#define UG_ASSERT(expr, msg)
Definition: assert.h:70
#define UG_THROW(msg)
Definition: error.h:57
double number
Definition: types.h:124
CPUAlgebra::vector_type vector_type
@ CT_DIRICHLET
Definition: ass_tuner.h:59
function func(x, y, z, t, si)
SmartPtr< T, FreePolicy > make_sp(T *inst)
returns a SmartPtr for the passed raw pointer
Definition: smart_pointer.h:836
function ProblemDisc new(problemDesc, dom)