micro_constraints_periodic

PURPOSE ^

MICRO_CONSTRAINTS_PERIODIC Computes micro periodic boundary conditions matrix

SYNOPSIS ^

function [ConstraintMat, ConstraintRhs ]=micro_constraints_periodic(Constraints, MacroMap, MacroVertices,MicroElements, MicroCoordinates, refquadnode)

DESCRIPTION ^

MICRO_CONSTRAINTS_PERIODIC   Computes micro periodic boundary conditions matrix
   [CONSTRAINTMAT, CONSTRAINTRHS] = MICRO_CONSTRAINTS_PERIODIC(...
             CONSTRAINTS, MACROMAP, MACROVERTICES, MICROELEMENTS, ...
             MICROCOORDINATES, REFQUADNODE) 
   computes a matrix and corresponding vector used to enforce periodic
   boundary conditions on the micro problem. To do this, in hmm_stima_quad
   and hmm_stima_tri, respectively the matrix A_Micro will be augmented by
   CONSTRAINTMAT and boundary conditions are enforced using Langrange
   multipliers.

   CONSTRAINTS contains information about the micro boundary problem. 
   See make_contraints.m for details.

   MACROMAP is the transformation matrix for the affine map to the 
   reference element.

   MACROVERTICES contains the node coordinates of the macro elements.

   MICROELEMENTS has dimension (NMicro-1)^2 x 4 and contain the node
   numbers of the triangulation of the micro sampling domain.

   MICROCOORDINATES contains the coordinates of the nodes
   of the triangulation of the micro sampling domain.

   REFQUADNODES contains the quadrature nodes in the reference square

   CONSTRAINTMAT contains the matrix that will be used to enforce boundary
   conditions via Lagrange multipliers. This matrix together with the
   matrix A_MICRO will be used for the augmented matrix in hmm_stima_quad
   and hmm_stima_tri, respectively.

   CONSTRAINTRHS contains the corresponding right hand side.


   This function should not be modified.


   The code is available at http://anmc.epfl.ch/ and described in 
   further detail in 

   A. Abdulle and A. Nonnenmacher
   "A short and versatile finite element multiscale code for
   homogenization problems"
   Computer Methods in Applied Mechanics and Engineering,
   http://dx.doi.org/10.1016/j.cma.2009.03.019

   Please cite this article in any publication describing research
   performed using the software.


   Email           : assyr.abdulle@epfl.ch and achim.nonnenmacher@epfl.ch
   Last updated    : 04/29/2009 with MATLAB 7.4

   FE_HMM2D is Copyright (C) 2009 A. Abdulle and A. Nonnenmacher. 
   The software is provided free for non-commercial use unter the terms of 
   the GNU General Public License. See "copyright.m" for full details.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ConstraintMat, ConstraintRhs ]=...
0002     micro_constraints_periodic(Constraints, MacroMap, MacroVertices,...
0003     MicroElements, MicroCoordinates, refquadnode)
0004 %MICRO_CONSTRAINTS_PERIODIC   Computes micro periodic boundary conditions matrix
0005 %   [CONSTRAINTMAT, CONSTRAINTRHS] = MICRO_CONSTRAINTS_PERIODIC(...
0006 %             CONSTRAINTS, MACROMAP, MACROVERTICES, MICROELEMENTS, ...
0007 %             MICROCOORDINATES, REFQUADNODE)
0008 %   computes a matrix and corresponding vector used to enforce periodic
0009 %   boundary conditions on the micro problem. To do this, in hmm_stima_quad
0010 %   and hmm_stima_tri, respectively the matrix A_Micro will be augmented by
0011 %   CONSTRAINTMAT and boundary conditions are enforced using Langrange
0012 %   multipliers.
0013 %
0014 %   CONSTRAINTS contains information about the micro boundary problem.
0015 %   See make_contraints.m for details.
0016 %
0017 %   MACROMAP is the transformation matrix for the affine map to the
0018 %   reference element.
0019 %
0020 %   MACROVERTICES contains the node coordinates of the macro elements.
0021 %
0022 %   MICROELEMENTS has dimension (NMicro-1)^2 x 4 and contain the node
0023 %   numbers of the triangulation of the micro sampling domain.
0024 %
0025 %   MICROCOORDINATES contains the coordinates of the nodes
0026 %   of the triangulation of the micro sampling domain.
0027 %
0028 %   REFQUADNODES contains the quadrature nodes in the reference square
0029 %
0030 %   CONSTRAINTMAT contains the matrix that will be used to enforce boundary
0031 %   conditions via Lagrange multipliers. This matrix together with the
0032 %   matrix A_MICRO will be used for the augmented matrix in hmm_stima_quad
0033 %   and hmm_stima_tri, respectively.
0034 %
0035 %   CONSTRAINTRHS contains the corresponding right hand side.
0036 %
0037 %
0038 %   This function should not be modified.
0039 %
0040 %
0041 %   The code is available at http://anmc.epfl.ch/ and described in
0042 %   further detail in
0043 %
0044 %   A. Abdulle and A. Nonnenmacher
0045 %   "A short and versatile finite element multiscale code for
0046 %   homogenization problems"
0047 %   Computer Methods in Applied Mechanics and Engineering,
0048 %   http://dx.doi.org/10.1016/j.cma.2009.03.019
0049 %
0050 %   Please cite this article in any publication describing research
0051 %   performed using the software.
0052 %
0053 %
0054 %   Email           : assyr.abdulle@epfl.ch and achim.nonnenmacher@epfl.ch
0055 %   Last updated    : 04/29/2009 with MATLAB 7.4
0056 %
0057 %   FE_HMM2D is Copyright (C) 2009 A. Abdulle and A. Nonnenmacher.
0058 %   The software is provided free for non-commercial use unter the terms of
0059 %   the GNU General Public License. See "copyright.m" for full details.
0060 
0061 %
0062 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063 
0064 
0065 % determine whether we have macro triangles or quadrilaterals
0066 MacroNodes=size(MacroVertices, 1);
0067 
0068 % Constraint 1:
0069 % Periodic Boundary conditions
0070 NoOfPerNodes=size(Constraints,1);
0071 ConstraintMat=sparse(repmat(1:NoOfPerNodes,1,2), ...
0072     [Constraints(:,1) Constraints(:,2)], ...
0073     [ones(NoOfPerNodes,1); -ones(NoOfPerNodes,1)]);
0074 
0075 % coordinates of periodic boundary conditions
0076 % x_node1 and x_node2 are corresponding periodic nodes
0077 x_node1= MicroCoordinates(Constraints(:,1), :);
0078 x_node2= MicroCoordinates(Constraints(:,2), :);
0079  
0080 % coordinates in the reference quadrilateral corresponding to the nodes with
0081 % periodic boundary conditions
0082 x_node_ref1 = (MacroMap\(x_node1-repmat(MacroVertices(1,:), NoOfPerNodes,1))')';
0083 x_node_ref2 = (MacroMap\(x_node2-repmat(MacroVertices(1,:), NoOfPerNodes,1))')';
0084 
0085 % corresponding rhs
0086 if (MacroNodes==3) % we have macro triangles
0087     ConstraintRhs=shapefunction_tri(x_node_ref1)-...
0088         shapefunction_tri(x_node_ref2);
0089 end
0090 if (MacroNodes==4) % we have macro quadrilaterals
0091     ConstraintRhs=shapefunction_quad_lin(x_node_ref1, refquadnode)-...
0092         shapefunction_quad_lin(x_node_ref2, refquadnode);
0093 end
0094 
0095 
0096 % Constraint 2:
0097 % zero-average u^h-phi^H_i
0098 NoOfNodes = size(MicroCoordinates,1);
0099 b=sparse(NoOfNodes,1);
0100 
0101 for j=1:size(MicroElements,1)
0102     b(MicroElements(j,:))=b(MicroElements(j,:))+...
0103         det([1,1,1; MicroCoordinates(MicroElements(j,1:3),:)'])/4;
0104 end
0105 
0106 
0107 
0108 % merge both to one unified matrix / vector
0109 ConstraintMat=[b';ConstraintMat];
0110 ConstraintRhs=[zeros(1,MacroNodes);ConstraintRhs];
0111 
0112 end

Generated on Tue 21-Jul-2009 10:55:32 by m2html © 2003