Henrik Sönnerlind
                                                                                                                                                    COMSOL Employee
                                                         
                            
                                                                                                                                                
                         
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                10 years ago                            
                            
                                22.02.2016, 02:33 GMT-5                            
                        
                        
                                                    HI,
In the piezoelectric material you always enter the full compliance (or stiffness) tensor. So if the material is isotropic, you have to fill in the off-diagonal terms too (which of course all are the same). So you have to calculate the three different numbers which appear in the matrix from E and nu.
Regards,
Henrik                                                
                                                
                            HI,
In the piezoelectric material you always enter the full compliance (or stiffness) tensor. So if the material is isotropic, you have to fill in the off-diagonal terms too (which of course all are the same). So you have to calculate the three different numbers which appear in the matrix from E and nu.
Regards,
Henrik                        
                                                
                                                                                                            
                                             
                                            
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                10 years ago                            
                            
                                22.02.2016, 11:45 GMT-5                            
                        
                        
                                                    Ok, that's what I tought but the isotropic option threw me off-guard.
Thank you Henrik.
Regards,
Pierre                                                
                                                
                            Ok, that's what I tought but the isotropic option threw me off-guard.
Thank you Henrik.
Regards,
Pierre                        
                                                
                                                                                                            
                                             
                        
                        
                                                
    
        Please login with a confirmed email address before reporting spam
     
    
 
                                                Posted:
                            
                                8 years ago                            
                            
                                25.07.2017, 11:53 GMT-4                            
                        
                        
                                                    Please, how can I output global displacement (U) in Comsol? I want to calculate the compliance of my model. (Please, see the attached Matlab code). 
compliance = U transpose x Global stiffness matrix x U
I have used these lines of code to obtain the global stiffness matrix (Kf).
MA = mphmatrix(model, 'sol1', 'out', {'K','E'})
K = MA.K; % stiffness vector
Kf = full(K);
Thank you.
Complete codes
%..............................
function [Kf,compliance] = examplestudy
%
% examplestudy.m
%
% Model exported on Jul 24 2017, 18:50 by COMSOL 5.2.1.152.
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelPath('C:\Users\sayinde\Dropbox\Comsol stuffs new');
model.label('examplestudy.mph');
model.comments(['Untitled\n\n']);
model.modelNode.create('comp1');
model.geom.create('geom1', 2);
model.mesh.create('mesh1', 'geom1');
model.geom('geom1').create('b1', 'BezierPolygon');
model.geom('geom1').feature('b1').set('p', {'-0.7' '-0.7' '0.05' '0.05' '0.5' '0.5' '-0.7';  ...
'-0.3' '0.3' '0.3' '0.6' '0.6' '-0.3' '-0.3'});
model.geom('geom1').feature('b1').set('w', {'1' '1' '1' '1' '1' '1' '1' '1' '1' '1'  ...
'1' '1'});
model.geom('geom1').feature('b1').set('degree', {'1' '1' '1' '1' '1' '1'});
model.geom('geom1').run;
model.material.create('mat1', 'Common', 'comp1');
model.material('mat1').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio');
model.physics.create('solid', 'SolidMechanics', 'geom1');
model.physics('solid').create('fix1', 'Fixed', 1);
model.physics('solid').feature('fix1').selection.set([1]);
model.physics('solid').create('disp1', 'Displacement0', 0);
model.physics('solid').create('disp2', 'Displacement0', 0);
model.physics('solid').feature('disp2').selection.set([5]);
model.mesh('mesh1').create('fq1', 'FreeQuad');
model.view('view1').axis.set('ymax', '1.7435424327850342');
model.view('view1').axis.set('xmax', '1.561381220817566');
model.view('view1').axis.set('ymin', '-1.7435424327850342');
model.view('view1').axis.set('xmin', '-1.561381220817566');
model.material('mat1').label('solid material 1');
model.material('mat1').propertyGroup('Enu').set('youngsmodulus', '1');
model.material('mat1').propertyGroup('Enu').set('poissonsratio', '0.3');
model.physics('solid').feature('disp1').set('Direction', {'1'; '1'; '0'});
model.physics('solid').feature('disp1').set('U0', {'-12.44'; '-3.45'; '0'});
model.physics('solid').feature('disp2').set('Direction', {'1'; '1'; '0'});
model.physics('solid').feature('disp2').set('U0', {'14.257'; '3.457'; '0'});
model.mesh('mesh1').run;
model.study.create('std1');
model.study('std1').create('stat', 'Stationary');
model.sol.create('sol1');
model.sol('sol1').study('std1');
model.sol('sol1').attach('std1');
model.sol('sol1').create('st1', 'StudyStep');
model.sol('sol1').create('v1', 'Variables');
model.sol('sol1').create('s1', 'Stationary');
model.sol('sol1').feature('s1').create('fc1', 'FullyCoupled');
model.sol('sol1').feature('s1').feature.remove('fcDef');
model.result.create('pg1', 'PlotGroup2D');
model.result.create('pg2', 'PlotGroup2D');
model.result('pg1').create('surf2', 'Surface');
model.result('pg2').create('surf1', 'Surface');
model.sol('sol1').attach('std1');
model.sol('sol1').runAll;
model.result('pg1').label('Stress (solid)');
model.result('pg1').feature('surf2').set('resolution', 'normal');
model.result('pg2').label('total disp');
model.result('pg2').feature('surf1').label('total displacement');
model.result('pg2').feature('surf1').set('resolution', 'normal');
MA = mphmatrix(model, 'sol1', 'out', {'K','E'})
K = MA.K; % stiffness vector
Kf = full(K);
% How can I output the global displacement in comsol
compliance = u'*Kf*u; % u is the global displacement I want to use to compute the compliance
out = model;
                                                
                                                
                            Please, how can I output global displacement (U) in Comsol? I want to calculate the compliance of my model. (Please, see the attached Matlab code). 
compliance = U transpose x Global stiffness matrix x U
I have used these lines of code to obtain the global stiffness matrix (Kf).
MA = mphmatrix(model, 'sol1', 'out', {'K','E'})
K = MA.K; % stiffness vector
Kf = full(K);
Thank you.
Complete codes
%..............................
function [Kf,compliance] = examplestudy
%
% examplestudy.m
%
% Model exported on Jul 24 2017, 18:50 by COMSOL 5.2.1.152.
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelPath('C:\Users\sayinde\Dropbox\Comsol stuffs new');
model.label('examplestudy.mph');
model.comments(['Untitled\n\n']);
model.modelNode.create('comp1');
model.geom.create('geom1', 2);
model.mesh.create('mesh1', 'geom1');
model.geom('geom1').create('b1', 'BezierPolygon');
model.geom('geom1').feature('b1').set('p', {'-0.7' '-0.7' '0.05' '0.05' '0.5' '0.5' '-0.7';  ...
'-0.3' '0.3' '0.3' '0.6' '0.6' '-0.3' '-0.3'});
model.geom('geom1').feature('b1').set('w', {'1' '1' '1' '1' '1' '1' '1' '1' '1' '1'  ...
'1' '1'});
model.geom('geom1').feature('b1').set('degree', {'1' '1' '1' '1' '1' '1'});
model.geom('geom1').run;
model.material.create('mat1', 'Common', 'comp1');
model.material('mat1').propertyGroup.create('Enu', 'Young''s modulus and Poisson''s ratio');
model.physics.create('solid', 'SolidMechanics', 'geom1');
model.physics('solid').create('fix1', 'Fixed', 1);
model.physics('solid').feature('fix1').selection.set([1]);
model.physics('solid').create('disp1', 'Displacement0', 0);
model.physics('solid').create('disp2', 'Displacement0', 0);
model.physics('solid').feature('disp2').selection.set([5]);
model.mesh('mesh1').create('fq1', 'FreeQuad');
model.view('view1').axis.set('ymax', '1.7435424327850342');
model.view('view1').axis.set('xmax', '1.561381220817566');
model.view('view1').axis.set('ymin', '-1.7435424327850342');
model.view('view1').axis.set('xmin', '-1.561381220817566');
model.material('mat1').label('solid material 1');
model.material('mat1').propertyGroup('Enu').set('youngsmodulus', '1');
model.material('mat1').propertyGroup('Enu').set('poissonsratio', '0.3');
model.physics('solid').feature('disp1').set('Direction', {'1'; '1'; '0'});
model.physics('solid').feature('disp1').set('U0', {'-12.44'; '-3.45'; '0'});
model.physics('solid').feature('disp2').set('Direction', {'1'; '1'; '0'});
model.physics('solid').feature('disp2').set('U0', {'14.257'; '3.457'; '0'});
model.mesh('mesh1').run;
model.study.create('std1');
model.study('std1').create('stat', 'Stationary');
model.sol.create('sol1');
model.sol('sol1').study('std1');
model.sol('sol1').attach('std1');
model.sol('sol1').create('st1', 'StudyStep');
model.sol('sol1').create('v1', 'Variables');
model.sol('sol1').create('s1', 'Stationary');
model.sol('sol1').feature('s1').create('fc1', 'FullyCoupled');
model.sol('sol1').feature('s1').feature.remove('fcDef');
model.result.create('pg1', 'PlotGroup2D');
model.result.create('pg2', 'PlotGroup2D');
model.result('pg1').create('surf2', 'Surface');
model.result('pg2').create('surf1', 'Surface');
model.sol('sol1').attach('std1');
model.sol('sol1').runAll;
model.result('pg1').label('Stress (solid)');
model.result('pg1').feature('surf2').set('resolution', 'normal');
model.result('pg2').label('total disp');
model.result('pg2').feature('surf1').label('total displacement');
model.result('pg2').feature('surf1').set('resolution', 'normal');
MA = mphmatrix(model, 'sol1', 'out', {'K','E'})
K = MA.K; % stiffness vector
Kf = full(K);
% How can I output the global displacement in comsol
compliance = u'*Kf*u; % u is the global displacement I want to use to compute the compliance
out = model;