Information request - ViennaFEM
Hello ,
I am student researcher the National Institute of Health and Medical
Research in France, I use your library ViennaFEM in my project, in order to
solve the equation was derived in part via the finite element method.
But I find some difficulties to solve a simple function to test the
library: Equation poisson_equ_1 = viennamath :: make_equation (viennamath
:: laplace (u) +1, -1);
as soon as I added one in this equation, I get an error. could you help me
please ?
please find enclosed the code I use:
_______________________________________________________________________________
int main ()
{
typedef viennagrid :: Config :: line_1d ConfigType;
typedef viennagrid :: :: result_of domain <ConfigType> :: type DomainType;
typedef viennagrid :: :: result_of ncell_range <DomainType, 0> :: type
VertexContainer;
typedef viennagrid result_of :: :: iterator <VertexContainer> :: type
VertexIterator;
typedef viennagrid :: :: result_of Ncell <ConfigType, 2> :: type CellType;
typedef boost :: numeric :: :: uBLAS compressed_matrix <viennafem ::
numeric_type> matrixType;
typedef boost :: numeric :: uBLAS :: vector <viennafem :: numeric_type>
VectorType;
typedef viennamath :: function_symbol FunctionSymbol;
typedef :: viennamath equation Equation;
typedef viennafem :: boundary_key BoundaryKey;
//
// Create a domain from file
//
DomainType my_domain;
//my_domain.create_segments(2);
try
{
viennagrid :: io :: netgen_reader my_reader;
my_reader (my_domain, "square224.mesh"); //../ examples / data /
line8.mesh
}
catch (...)
{
std :: cerr << ". File-Reader program failed Aborting ..." << std ::
endl;
EXIT_FAILURE return;
}
//
// Specify two PDEs:
//
FunctionSymbol u (0, viennamath :: unknown_tag <> ()); // An unknown
function used for PDE specification
Equation = poisson_equ_1 viennamath :: make_equation (viennamath ::
laplace (u) +1, -1);
// Equation poisson_equ_2 = viennamath :: make_equation (viennamath ::
laplace (u), 0);
MatrixType system_matrix_1, system_matrix_2;
VectorType load_vector_1, load_vector_2;
//
// Setting boundary information on domain (this shoulds come from device
specification)
//
// Setting Some boundary flags:
VertexContainer vertices = viennagrid :: ncells <0> (my_domain);
std :: cout << "Step 4" << std :: endl;
for (VertexIterator lives vertices.begin = ();
= vertices.end lives (!);
++ Lives)
{
// Boundary for first equation: Homogeneous Dirichlet everywhere
if ((* lives) [0] == || 0.0 (* lives) [0] == 1.0)
viennafem :: set_dirichlet_boundary (* lives, 0.0, 0); // Simulation
with ID 0 uses homogeneous boundary data
// Boundary for second equation (ID 1): 0 at left boundary, 1 at right
boundary
if ((* lives) [0] == 0.0)
viennafem :: set_dirichlet_boundary (* lives, 0.0, 1);
else if ((* lives) [0] == 1.0)
viennafem :: set_dirichlet_boundary (* lives, 1.0, 1);
}
//
// Create PDE solver functors: (Discussion about proper interface
required)
//
viennafem :: pde_assembler fem_assembler;
//
// Solve system and write vector solution to pde_result:
// (Discussions about proper interface required. Introduce a pde_result
class?)
//
for (size_t i = 0; i <my_domain.segments () size ();. i ++)
{
fem_assembler (viennafem :: make_linear_pde_system (poisson_equ_1,
u,
viennafem ::
make_linear_pde_options (0,
viennafem :: lagrange_tag <0> ()
viennafem :: lagrange_tag <0> ())
)
my_domain.segments () [i]
system_matrix_1,
load_vector_1
);
// Fem_assembler (viennafem :: make_linear_pde_system (poisson_equ_2,
// U,
// Viennafem :: make_linear_pde_options (1,
// Viennafem :: lagrange_tag <1> ()
// Viennafem :: lagrange_tag <1> ())
//)
// My_domain.segments () [i]
// System_matrix_2,
// load_vector_2
//);
}
VectorType pde_result_1 = viennacl :: :: linalg solve (system_matrix_1,
load_vector_1, viennacl :: :: linalg cg_tag ());
std :: cout << "* solve (): Residual:" << norm_2 (prod (system_matrix_1,
pde_result_1) - load_vector_1) << std :: endl;
// VectorType pde_result_2 = viennacl :: :: linalg solve (system_matrix_2,
load_vector_2, viennacl :: :: linalg cg_tag ());
// Std :: cout << "* solve (): Residual:" << norm_2 (prod
(system_matrix_2, pde_result_2) - load_vector_2) << std :: endl;
//
// Writing solution back to domain (Discussion about proper way of
returning a solution required ...)
//
viennafem :: io :: write_solution_to_VTK_file (pde_result_1,
"poisson_1d_1" my_domain, 0);
// Io viennafem :: :: write_solution_to_VTK_file (pde_result_2,
"poisson_1d_2" my_domain, 1);
std :: cout << "*****************************************" < <std :: endl;
std :: cout << "* * Poisson solver finished successfully!" << std :: endl;
std :: cout << "*****************************************" < <std :: endl;
EXIT_SUCCESS return;
}
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are
consuming the most bandwidth. Provides multi-vendor support for NetFlow,
J-Flow, sFlow and other flows. Make informed decisions using capacity
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
ViennaCL-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/viennacl-support