Gabriel Crispin Silva Neumann

Embed Size (px)

Citation preview

  • 7/22/2019 Gabriel Crispin Silva Neumann

    1/23

    1

    INDICE

    INTRODUCCION 2

    CONCEPTOS PREVIOS 3

    FORMA VARIACIONAL 4

    METODO DE GALERKIN 5

    MODELO DISCRETO 5

    ELEMENTOS FINITOS LINEALES 5

    MATRIZ ENSAMBLAJE Y VECTOR DE CARGA 7

    CODIGO MATLAB 9

    EJECUCION DEL PROGRAMA 20

    CONCLUSIONES 22

    BIBLIOGRAFIA 23

  • 7/22/2019 Gabriel Crispin Silva Neumann

    2/23

    2

    INTRODUCCIONEl problema general de EDO, puede ser de tipo Dirichlet, Neumann o Mixto.

    La condicin de frontera impuesta a este problema es en general

    , las que se

    clasifican del siguiente modo: condic. esenciales condic. esenciales

    Tipo Dirichlet Tipo NeumannCuando se combina una condicin natural en un extremo y una condicin esencial en el otroextremo de [a b], el problema se le denomina PROBLEMA MIXTO.Durante este trabajo se abarcara el problema de contorno de tipo Neumann:

    (

    )

    Donde , - , - con y para todo , -

  • 7/22/2019 Gabriel Crispin Silva Neumann

    3/23

    3

    CONCEPTOS PREVIOS

    DEFINICION: Se dir que un espacio con producto interior es un espacio de Hilbertsiel espacio mtrico es completo.DEFINICION (ESPACIO COMPLETO):Diremos que un espacio mtrico

    es completo si

    toda sucesin de Cauchy es convergente.

    TEOREMA 1 (DE LAX-MILGRAM)Sea una funcin lineal, acotada y sea una forma bilineal continua ycoerciva, entonces existe un nico tal que .TEOREMA 2 (EXISTENCIA Y UNICIDAD DE LA SOLUCION DEBIL)Sea , -bajo estas condiciones existe una nica solucin a nuestro problema.

  • 7/22/2019 Gabriel Crispin Silva Neumann

    4/23

    4

    FORMA VARIACIONAL

    A partir del problema de contorno de tipo Neumann expresaremos en forma dbil o formavariacional.

    La ecuacin diferencial

    , la multiplico por

    y luego la integro

    de a . ( )

    Por integracin por partes aplicada a la primera integral, hago el cambio: (

    )

    (),- Pero

    () , luego queda de lasiguiente forma, llamada FORMA DBIL O FORMA VARIACIONAL:

    (

    )

    La formulacin dbil de este problema es dado por tal que donde

    En las condiciones consideradas, la forma bilineal es continua sobre y .As, gracias al lema de Lax-Milgram, para toda el problema () admite solucin nicay adems

  • 7/22/2019 Gabriel Crispin Silva Neumann

    5/23

    5

    METODO DE GALERKIN

    El mtodo aproxima la solucin no sobre todas las funciones en , sino sobre unconjunto ms pequeo de funciones que consisten en combinaciones lineales de ciertas funcionesde base Las funciones de base deben ser linealmente independientes y satisfacer

    As el mtodo consiste en encontrar

    las constantes tal que cumple el problema discreto dado por * +MODELO DISCRETOSea

    *

    , -

    + *

    +.

    As tenemos con este planteamiento de Galerkin el modelo discreto:Hallar /

    donde:

    ELEMENTOS FINITOS LINEALESEstas funciones de base del mtodo de Galerkin forman el espacio de elementosfinitos * +, las cuales pueden ser de diferente forma pero con lacaracterstica de que cumplen las condiciones de frontera del problema de contorno inicial.Se mostrara los elementos finitos lineales para los que las funciones de base

    son polinomios

    segmentarios lineales, las cuales forman el espacio de elementos finitos lineales

    * + veamos estas funciones de base.Consideremos una particin de ,-que, supondremos uniforme: As, el intervalo ,-queda dividi en subintervalos [ ], a cada uno de ellos seles denomina elemento.Consideremos ahora una base de que llamaremos base nodal formada por funciones .

  • 7/22/2019 Gabriel Crispin Silva Neumann

    6/23

    6

    Estas funciones vienen dadas por:

    , - , - {

  • 7/22/2019 Gabriel Crispin Silva Neumann

    7/23

    7

    MATRIZ ENSAMBLAJE Y VECTOR DE CARGATomando los y la solucin aproximada reemplazando en elproblema discreto, se tiene:

    Y se tiene el sistema lineal de donde los son las incgnitas

    Del cual resulta un sistema lineal dado por Dnde:La matriz

    es llamada matriz de ensamblaje y sus elementos son

    [ ] El vector b = b1 viene dado por y

    b2 es llamado vector de carga.bn+1

    El vector w = w1 es el vector incgnita.

    w2wn

  • 7/22/2019 Gabriel Crispin Silva Neumann

    8/23

    8

    Con estos coeficientes se tiene la solucin del problema discreto el cual es una solucin aproximada del problema de contorno dado en primerainstancia.

  • 7/22/2019 Gabriel Crispin Silva Neumann

    9/23

    9

    CODIGO MATLAB Neumann.m

    functionvarargout = Neumann(varargin)gui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...

    'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @Neumann_OpeningFcn, ...

    'gui_OutputFcn', @Neumann_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);

    ifnargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});

    end

    ifnargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

    elsegui_mainfcn(gui_State, varargin{:});

    end

    functionNeumann_OpeningFcn(hObject, eventdata, handles, varargin)handles.output = hObject;guidata(hObject, handles);axes(handles.axes2)axis off;axis([-8 9 -5 9]);

    text('Interpreter','latex','String','\textbf{\underline{Metodo ElementosFinitos - Tipo Neumann}}','Position',[-3.5 8],'FontSize',10);

    text('Interpreter','latex','String','$Sea:u(x):[0,L]\longrightarrow R$','Position',[-5 7],'FontSize',10);

    text('Interpreter','latex','String','$-(p(x)u^{\prime }(x))^{\prime}+q(x)u(x)=f(x)$','Position',[-5 6.5],'FontSize',10);

    text('Interpreter','latex','String','$u^{\prime}(0)= \alpha $','Position',[-56],'FontSize',10);

    text('Interpreter','latex','String','$u^{\prime}(L)= \beta $','Position',[-55.5],'FontSize',10);

    text('Interpreter','latex','String','\textbf{Matriz deEnsamblaje:}','Position',[-7 4.5],'FontSize',10);

    text('Interpreter','latex','String','$\qquad A_{ij}=\int_{0}^{L}(p(x)\varphi_{i}^{\prime}(x)\varphi_{j}^{\prime}(x)+ q(x)\varphi _{i}(x)\varphi_{j}(x))dx$','Position',[-7 4],'FontSize',10);

    text('Interpreter','latex','String','$\qquad A_{11}=\int_{0}^{L}(p(x)\varphi_{1}^{\prime}(x)\varphi_{1}^{\prime}(x)+ q(x)\varphi _{1}(x)\varphi _{1}(x))dx$','Position',[-7 3.25],'FontSize',10);

    text('Interpreter','latex','String','$\qquad A_{nn}=\int_{0}^{L}(p(x)\varphi_{n}^{\prime}(x)\varphi_{n}^{\prime}(x)+ q(x)\varphi _{n}(x)\varphi _{n}(x))dx$','Position',[-7 2.5],'FontSize',10);

    text('Interpreter','latex','String','$Con: $ ','Position',[-7 -1],'FontSize',10);

    text('Interpreter','latex','String','${ \ }\frac{1}{h}(x-x_{i-1}){ \ \ \ \ \ \}x_{i-1}\leq x\leq x_{i} $ ','Position',[-5.8 -1.3],'FontSize',10);

    text('Interpreter','latex','String','$\varphi _{i}=-\frac{1}{h}(x-x_{i+1}){ \ \\ \ \ \ }x_{i}\leq x\leq x_{i+1} $ ','Position',[-7 -2.0],'FontSize',10);

    text('Interpreter','latex','String','${ \ }0{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \\ \ \ }x\notin [x_{i-1},x_{i+1}]$ ','Position',[-5.8 -2.7],'FontSize',10);

    text('Interpreter','latex','String','${ \ }\frac{1}{h}{ \ \ \ \ \ \ \ \ \ \ \ \\ \ \ \ \ \ \ }x_{i-1}\leq x\leq x_{i} $ ','Position',[-5.8 -3.5],'FontSize',10);

  • 7/22/2019 Gabriel Crispin Silva Neumann

    10/23

    10

    text('Interpreter','latex','String','$\varphi _{i}^{\prime }=-\frac{1}{h}{ \ \\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }x_{i}\leq x\leq x_{i+1} $ ','Position',[-7 -4.2],'FontSize',10);

    text('Interpreter','latex','String','${ \ }0{ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \}x\notin [x_{i-1},x_{i+1}]$ ','Position',[-5.8 -4.9],'FontSize',12);

    text('Interpreter','latex','String','\textbf{Vector de Carga:}','Position',[-71.5],'FontSize',10);

    text('Interpreter','latex','String','$\qquadb_{i}=\int_{0}^{L}(f(x)\varphi_{i}(x))dx$','Position',[-7 1],'FontSize',10);

    text('Interpreter','latex','String','$\qquadb_{1}=\int_{0}^{L}(f(x)\varphi_{1}(x))dx - {p(0)\alpha}$','Position',[-70.4],'FontSize',10);

    text('Interpreter','latex','String','$\qquadb_{n}=\int_{0}^{L}(f(x)\varphi_{n}(x))dx + {p(L)\beta}$ ','Position',[-7 -0.3],'FontSize',10);

    functionvarargout = Neumann_OutputFcn(hObject, eventdata, handles)

    functionpushbutton1_Callback(hObject, eventdata, handles)

    %CONDICIONES DEL PROBLEMA%INGRESO DE DATOS CORRECTAMENTEQQQ=0;LLL=0;HHH=0;condicion=0;set(handles.alfaerror,'String',' ');set(handles.text36,'String',' ');set(handles.text37,'String',' ');set(handles.text38,'String',' ');set(handles.text39,'String',' ');set(handles.text40,'String',' ');set(handles.text41,'String',' ');format longsyms xdel;t0=str2double(get(handles.a,'string'));t1=str2double(get(handles.b,'string'));L=str2double(get(handles.ele,'string'));if(L

  • 7/22/2019 Gabriel Crispin Silva Neumann

    11/23

    11

    if(rc2)

  • 7/22/2019 Gabriel Crispin Silva Neumann

    12/23

    12

    set(handles.text41,'String','h>=2');end

    return;end

    f11=vectorize(f);

    ifisempty(diff(t))f11=num2str(f);

    end

    syms hk=h1-2;%numero de funciones base menos los extremosA=zeros(k+2,k+2);F=zeros(k+2,1);hh=q(2)-q(1);b(1)=q(1)+h*0;fori=2:h1

    b(i)=b(1)+h*(i-1);end

    %MATRIZ DE ENSAMBLAJEfori=1:k+2forj=1:k+2

    ifi==jifi==1

    %CALCULA LA PRIMER VALOR DE LA DIAGONALn=int((r/(h^2))+(t*(x-b(j+1))^2/(h^2)),b(j),b(j+1));

    A(i,j)=subs(n,hh);endifi==k+2

    %CALCULA EL ULTIMO ELEMENTO DE LA DIAGONALm=int((r/(h^2))+(t*(x-b(j-1))^2/(h^2)),b(j-1),b(j));A(i,j)=subs(m,hh);

    endifi>1 && i

  • 7/22/2019 Gabriel Crispin Silva Neumann

    13/23

    13

    F(i)=subs(bc,hh);end

    ifi==k+2D=int((f*(x-b(i-1))/h),b(i-1),b(i));bc=D+subs(r,b(k+2))*(t1);% se le suma el valor teoricoF(i)=subs(bc,hh);

    end

    ifi>=2 && i

  • 7/22/2019 Gabriel Crispin Silva Neumann

    14/23

    14

    y2=-w(i)*(x2-q(i+1))/(q(i+1)-q(i));pp2=plot(x2,y2,'--r');

    endifi==k+2 && w(i)~=0

    x1=q(i-1):h1:q(i);y1=w(i)*(x1-q(i-1))/(q(i)-q(i-1));plot(x1,y1,'--r');

    endifi>1 && i

  • 7/22/2019 Gabriel Crispin Silva Neumann

    15/23

    15

    ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionele_Callback(hObject, eventdata, handles)

    functionele_CreateFcn(hObject, eventdata, handles)ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionfun_Callback(hObject, eventdata, handles)functionfun_CreateFcn(hObject, eventdata, handles)ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionp_Callback(hObject, eventdata, handles)functionp_CreateFcn(hObject, eventdata, handles)ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionq_Callback(hObject, eventdata, handles)functionq_CreateFcn(hObject, eventdata, handles)ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionaxes3_CreateFcn(hObject, eventdata, handles)

    functionh_Callback(hObject, eventdata, handles)functionh_CreateFcn(hObject, eventdata, handles)ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

  • 7/22/2019 Gabriel Crispin Silva Neumann

    16/23

    16

    % --- Executes during object creation, after setting all properties.functionuipanel1_CreateFcn(hObject, eventdata, handles)

    % hObject handle to uipanel1 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % --- Executes during object creation, after setting all properties.

    functionalfaerror_Callback(hObject, eventdata, handles)% hObject handle to alfaerror (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of alfaerror as text

    % str2double(get(hObject,'String')) returns contents of alfaerror as a double

    % --- Executes during object creation, after setting all properties.functionalfaerror_CreateFcn(hObject, eventdata, handles)% hObject handle to alfaerror (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionedit10_Callback(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of edit10 as text% str2double(get(hObject,'String')) returns contents of edit10 as a double

    % --- Executes during object creation, after setting all properties.functionedit10_CreateFcn(hObject, eventdata, handles)% hObject handle to edit10 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.

  • 7/22/2019 Gabriel Crispin Silva Neumann

    17/23

    17

    ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionedit11_Callback(hObject, eventdata, handles)% hObject handle to edit11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of edit11 as text% str2double(get(hObject,'String')) returns contents of edit11 as a double

    % --- Executes during object creation, after setting all properties.functionedit11_CreateFcn(hObject, eventdata, handles)% hObject handle to edit11 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionedit12_Callback(hObject, eventdata, handles)

    % hObject handle to edit12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of edit12 as text% str2double(get(hObject,'String')) returns contents of edit12 as a double

    % --- Executes during object creation, after setting all properties.functionedit12_CreateFcn(hObject, eventdata, handles)% hObject handle to edit12 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

  • 7/22/2019 Gabriel Crispin Silva Neumann

    18/23

    18

    functionedit13_Callback(hObject, eventdata, handles)% hObject handle to edit13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of edit13 as text% str2double(get(hObject,'String')) returns contents of edit13 as a double

    % --- Executes during object creation, after setting all properties.functionedit13_CreateFcn(hObject, eventdata, handles)% hObject handle to edit13 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');

    end

    functionedit14_Callback(hObject, eventdata, handles)% hObject handle to edit14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of edit14 as text% str2double(get(hObject,'String')) returns contents of edit14 as a double

    % --- Executes during object creation, after setting all properties.functionedit14_CreateFcn(hObject, eventdata, handles)% hObject handle to edit14 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionedit15_Callback(hObject, eventdata, handles)% hObject handle to edit15 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of edit15 as text% str2double(get(hObject,'String')) returns contents of edit15 as a double

  • 7/22/2019 Gabriel Crispin Silva Neumann

    19/23

    19

    % --- Executes during object creation, after setting all properties.functionedit15_CreateFcn(hObject, eventdata, handles)% hObject handle to edit15 (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

    functionresultado_Callback(hObject, eventdata, handles)% hObject handle to resultado (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)

    % Hints: get(hObject,'String') returns contents of resultado as text% str2double(get(hObject,'String')) returns contents of resultado as a double

    % --- Executes during object creation, after setting all properties.functionresultado_CreateFcn(hObject, eventdata, handles)% hObject handle to resultado (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called

    % Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))

    set(hObject,'BackgroundColor','white');end

  • 7/22/2019 Gabriel Crispin Silva Neumann

    20/23

    20

    EJECUCION DEL PROGRAMA EN MATLAB

    Teniendo en cuenta el siguiente problema:

    Notemos que la solucin exacta es la funcin .

  • 7/22/2019 Gabriel Crispin Silva Neumann

    21/23

    21

    >>x=0:pi/8:pi;>>sin(x)

  • 7/22/2019 Gabriel Crispin Silva Neumann

    22/23

    22

    CONCLUSIONES

    El trabajo nos muestra la solucin por el MEF de las ecuaciones diferenciales ordinariascon condiciones de tipo Neumann, el cual nos da la posibilidad de dar una respuestarpida y tener idea del comportamiento de la solucin.

    El mtodo de Elementos Finitos con condiciones de Neumann posee una funcin de baseadicional en comparacin con el de condiciones de Dirichet, es decir n+1 funciones debase.

    La forma variacional del problema con condiciones de Neumann depende de lascondiciones iniciales dadas, en nuestro caso estas condiciones influyen que nuestra formavariacional sea ms compleja comparada con el de condiciones de Dirichet.

    El mtodo de Elementos Finitos con condiciones de Neumann difiere con el de

    condiciones de Dirichet en el vector de carga esto debido a las condiciones inicialestomada en el problema.

    Cuanto mayor sea el nmero de intervalos en nuestro mtodo de Elementos Finitos mejorser nuestra aproximacin, sin embargo el costo computacional es mayor.

  • 7/22/2019 Gabriel Crispin Silva Neumann

    23/23

    23

    BIBLIOGRAFA

    [1]. MARRERO, Isabel. Espacios de Hilbert. Universidad de La Laguna.

    [2]. CALDERON, Giovanni. Introduccin al Mtodo de los Elementos Finitos: un enfoquematemtico.

    [3]. CARRILLO, Antonio. Mtodo de los Elementos Finitos. Instituto de Geofsica UNAM

    [4]. GASPAR, Francisco Jos. Mtodo de los Elementos Finitos. Universidad de Zaragoza,Espaa