Sven Friedel
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
27 lug 2010, 03:37 GMT-4
Hi Linlin,
I suggest defining a support function k(x,y) that is one only in your desired subsection and elsewhere zero and then integrate \int u(x,y)*k(x,y) dV. (assuming that u is your desired variable to be integrated.
Sven
Hi Linlin,
I suggest defining a support function k(x,y) that is one only in your desired subsection and elsewhere zero and then integrate \int u(x,y)*k(x,y) dV. (assuming that u is your desired variable to be integrated.
Sven
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
27 lug 2010, 08:49 GMT-4
Hi lili, Hi Sven,
I think I have an other solution.
ie, You can transform each mesh in one subdomain. Then, you use the "postint" function for good subdomains.
I think this solution is very time and memory consuming (specialy for fine mesh), but you don't have to create the space function "k(x,y)".
otherwise, [mesh1,mesh2]= postint ( fem, ' (x>...)*(y>...)*( variable ) ' , ' (x>...)*(y>...)*(var)' , edim , ..., dl, ....).
I don't know how to specify directly a range of mesh to integrate over. There is the "meshintegrate" function but it integrate over simplex (if I remember correctly).
to change each mesh in subdomain (just after meshinit)
el=get(fem.mesh,'el'); % Index des vertex{1},edge{2},face{3},mesh{4}
p=get(fem.mesh,'p'); % coordonnées des noeuds
tol=0.0001;
% Modification de ce maillage %
A=find(p);
input4=[];
for i=1:length(A)-1
in4=['el{4}.elem==',num2str(A(i))];
input4=[input4 in4 ,'|' ];
end
input4=[input4,'el{4}.elem==',num2str(A(end))];
evalc(['B4=find((',input4,'))']);
C4=(el{4}.elem);C4(B4)=0;D4=find(sum(C4,1)==0);
el{4}.dom(D4)=(max(el{4}.dom)+1:max(el{4}.dom)+size(D4,2))';
fem.mesh = femmesh(p,el);
meshexport('meshexp.mphtxt',fem.mesh);
mim = meshimport('meshexp.mphtxt');
fem.mesh = mim{1};
fem = rmfield(fem,'geom');
% Paramétrage du modèle %
fem = mesh2geom(fem,'srcdata','MESH','destfield',{'geom','mesh'});
Sven, do you think this solution is a good solution to construct an inverse problem for the Electrical Resistivity Tomography method. ie : I transform each mesh corresponding to inversion cell. I compute sensitivities (adjoint state method) with the postint function for each inversion cell. I compute the inverse solution, and finaly, I change electrical resistivity of my model.
Thanks,
Yannick
Hi lili, Hi Sven,
I think I have an other solution.
ie, You can transform each mesh in one subdomain. Then, you use the "postint" function for good subdomains.
I think this solution is very time and memory consuming (specialy for fine mesh), but you don't have to create the space function "k(x,y)".
otherwise, [mesh1,mesh2]= postint ( fem, ' (x>...)*(y>...)*( variable ) ' , ' (x>...)*(y>...)*(var)' , edim , ..., dl, ....).
I don't know how to specify directly a range of mesh to integrate over. There is the "meshintegrate" function but it integrate over simplex (if I remember correctly).
to change each mesh in subdomain (just after meshinit)
el=get(fem.mesh,'el'); % Index des vertex{1},edge{2},face{3},mesh{4}
p=get(fem.mesh,'p'); % coordonnées des noeuds
tol=0.0001;
% Modification de ce maillage %
A=find(p);
input4=[];
for i=1:length(A)-1
in4=['el{4}.elem==',num2str(A(i))];
input4=[input4 in4 ,'|' ];
end
input4=[input4,'el{4}.elem==',num2str(A(end))];
evalc(['B4=find((',input4,'))']);
C4=(el{4}.elem);C4(B4)=0;D4=find(sum(C4,1)==0);
el{4}.dom(D4)=(max(el{4}.dom)+1:max(el{4}.dom)+size(D4,2))';
fem.mesh = femmesh(p,el);
meshexport('meshexp.mphtxt',fem.mesh);
mim = meshimport('meshexp.mphtxt');
fem.mesh = mim{1};
fem = rmfield(fem,'geom');
% Paramétrage du modèle %
fem = mesh2geom(fem,'srcdata','MESH','destfield',{'geom','mesh'});
Sven, do you think this solution is a good solution to construct an inverse problem for the Electrical Resistivity Tomography method. ie : I transform each mesh corresponding to inversion cell. I compute sensitivities (adjoint state method) with the postint function for each inversion cell. I compute the inverse solution, and finaly, I change electrical resistivity of my model.
Thanks,
Yannick
Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
30 lug 2010, 11:54 GMT-4
Hi LinLin,
I have modified the meshintegration function to create the function MailleInt :
The output variable is a vector. The first element of this vector equal the integration of your postevaluate quantity over a the first mesh of your model. The second element ....
Then you just have to sum integrate quantities over specified range of meshes.
I hope this function will help you.
Yannick Fargier
Hi LinLin,
I have modified the meshintegration function to create the function MailleInt :
The output variable is a vector. The first element of this vector equal the integration of your postevaluate quantity over a the first mesh of your model. The second element ....
Then you just have to sum integrate quantities over specified range of meshes.
I hope this function will help you.
Yannick Fargier