[Getdp] How to calculate a numerical quantity with GetDP ?
Olivier Castany
castany at quatramaran.ens.fr
Fri Aug 25 16:53:01 CEST 2006
Hello,
after I have solved a problem with GetDP, I would like to compute some
numerical quantities with GetDP
1) is it possible ?
For example, if I've got a field {T}, how can I do the following :
2) calculate the flux "- lambda[] * {d T}" throught a surface S of
the mesh
3) calculate the same flux, but through a surface of the _dual_ mesh,
close to a surface S of the mesh (how can one define such a
surface in GetDP ?)
4) calculate the average temperature on a surface S
Following is a sample file for which I would like to compute the
above-mentioned quantities. The surfaces of interest could be
surfaces SA and SV.
And a last question (not related to the former) :
5) In the problem I solved, I need to write "Support Region [{D,SA}]" in
the FunctionSpace. Simply writing "Support D" yields irrelevant results.
However, all the nodes of SA are nodes of D.
Could somebody explain why I need to do that ? What exaclty is this
"Support group-def" ? Isn't it the set of nodes in the "group-def" ?
Have a nice day,
Olivier C.
-------------------
barre.geo :
/*
Metal rod
*/
lc_ext = 0.03;
rayon = 0.05;
longueur = 0.5;
Point(1) = {0,0,0,1};// longueur caractéristique du centre sans utilité
Point(2) = {rayon,0,0,lc_ext};
Point(3) = {-rayon,0,0,lc_ext};
Point(4) = {0,-rayon,0,lc_ext};
Point(5) = {0,rayon,0,lc_ext};
Circle(1) = {2,1,5};
Circle(2) = {5,1,3};
Circle(3) = {3,1,4};
Circle(4) = {4,1,2};
Line Loop(5) = {1,2,3,4};
Plane Surface(6) = {5};
Extrude {0,0,longueur} {
Surface{6}; Layers{ 30,1 }; Recombine;
}
Physical Surface(31) = {6};
Physical Surface(32) = {27,15,19,23,28};
Physical Volume(33) = {1};
/* Remark : gmsh statistics show :
Geometry : 24 lines... it should be : 12
Mesh : 296 nodes on lines... it should be : 132
400 nodes on surfaces... it should be : 260
*/
-------------
barre.pro :
/*
Temperature in a metal rod :
- the temperature is imposed at one end (surface SV)
- convection happens on all other surfaces (surface SA) (j.n = h(T -
T_ext))
- conduction of heat in the material (volume D) (j = - lambda Grad(T))
- equilibrium situation (Div(j)=0)
*/
Group{
D = Region[33];// Entire volume
SV = Region[31];// Surface with imposed temperature
SA = Region[32];// Other surfaces with air convection
}
Function {
h[] = 30.;// Wm-2K-1 (strong natural air convection)
lambda[] = 20.;// Wm-1K-1 (some highly allied steel)
T_ext[] = 30.;// °C (air temperature)
}
// Temperature imposed on surface SV :200°C
Constraint {
{ Name temperature_sur_SV ; Type Assign;
Case {
{ Region SV ; Value 200. ; }
}
}
}
FunctionSpace {
{ Name temperature_dans_barre ; Type Form0 ;
BasisFunction {
{ Name w_n ; NameOfCoef T_n ; Function BF_Node ;
Support Region [{D,SA}] ; Entity NodesOf[ All ] ; }
}
Constraint {
{ NameOfCoef T_n ; EntityType NodesOf ;
NameOfConstraint temperature_sur_SV ; }
}
}
}
Jacobian {
{ Name JVol ;
Case {
{ Region All ; Jacobian Vol ; }
}
}
{ Name JSur ;
Case {
{ Region All ; Jacobian Sur ; }
}
}
}
Integration {
{ Name I ;
Case {
{ Type Gauss ;
Case {
{ GeoElement Point ; NumberOfPoints 1 ; }
{ GeoElement Line ; NumberOfPoints 3 ; }
{ GeoElement Triangle ; NumberOfPoints 4 ; }
{ GeoElement Quadrangle ; NumberOfPoints 4 ; }
{ GeoElement Tetrahedron ; NumberOfPoints 4 ; }
{ GeoElement Hexahedron ; NumberOfPoints 6 ; }
{ GeoElement Prism ; NumberOfPoints 6 ; }
}
}
}
}
}
/****************** Integral formulation to solve :
find T such that :
\int_D lambda Grad(T).Grad(T') + \int_SA h (T - T_ext) T' = 0
holds for all T' with T' = 0 on SV
******************************************/
Formulation {
{ Name formulation_du_probleme ; Type FemEquation ;
Quantity {
{ Name T ; Type Local ; NameOfSpace temperature_dans_barre ; }
}
Equation {
Galerkin { [ lambda[] * Dof{d T} , {d T} ] ;
In D ; Jacobian JVol ; Integration I ; }
Galerkin { [ h[] * Dof{T} , {T} ] ;
In SA ; Jacobian JSur ; Integration I ; }
Galerkin { [ -h[] * T_ext[] , {T} ] ;
In SA ; Jacobian JSur ; Integration I ; }
}
}
}
Resolution {
{ Name resolution_du_probleme ;
System {
{ Name A ; NameOfFormulation formulation_du_probleme ; }
}
Operation {
Generate[A] ; Solve[A] ; SaveSolution[A] ;
}
}
}
PostProcessing {
{ Name post_processing ; NameOfFormulation formulation_du_probleme ;
Quantity {
{ Name T; Value { Local { [ {T} ] ; In SA ; Jacobian JSur ; }}}
}
}
}
PostOperation {
{ Name post_operations ; NameOfPostProcessing post_processing;
Operation {
Print[ T, OnElementsOf SA, File "T.pos"] ;
}
}
}
------------------