How to get AssembleFEMatrices for a nonlinear and Time dependent PDE problem in PDEtool box
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
In MATLAB pde tool box, To get the assemble matrices for time dependent pde or nonlinear pde - ''FEM = assembleFEMatrices(___,state) '' this command is used. But how to get a assemble matrices for a pde with time dependent and nonlinear.
, k = 0.7 + 0.003*T, tlist = linespace(0,0.5,20); therefore my pde coefficients wills be d = 1, m = a = 0, c = k, f = 1; since c coefficent is non linear (dependent on T, temperature); How am i going to get AssembleFEMtrices at tlist(1) i.e. at t = 0 ?
clear,clc,close all;
model = createpde();
%% Geometry
R1 = [3;4;-1;1;1;-1;-1;-1;1;1];
g = decsg(R1);
heatmodel_geom = geometryFromEdges(model,g);
%% Mesh
msh = generateMesh(model,'GeometricOrder','linear');
[P,E,T] = meshToPet( msh );
%% Specify Coefficients
c = @(~,state) 0.7+0.003*state.u; % nonlinear coefficient
specifyCoefficients(model,'m',0,'d',1,'c',c,'a',0,'f',1);
%% Spacial BC
applyBoundaryCondition(model,'dirichlet','edge',[1 2 3 4],'u',0);
%% Initial guess
setInitialConditions(model,0);
%% assemble the finite elements matrices with imposed spacial BC
tlist = linspace(0,0.1,20);
Rnonlin = solvepde(model,tlist);
state.u = Rnonlin.NodalSolution;
state.time = tlist(1);
FEMn = assembleFEMatrices(model,'nullspace',state);
I could see lot of errors when i run this code. Am not sure if this approch is correct or not to get assemble FEMatrices... Please help me with a way to get assemble matrices for a pde which is nonlinear and time dependent?
My commands are based on the link given below
Thank you
0 Kommentare
Antworten (1)
Ravi Kumar
am 4 Mär. 2021
Solution matrix must of of the size NumPDEs x NumNodes. In your case, you are providing several solutions at all the time-steps as inputs. Change the line:.
state.u = Rnonlin.NodalSolution;
to
state.u = Rnonlin.NodalSolution(:,1)';
If you want matrices at multuple time steps, you need to updated state struct with corresponding solution and time values and call assembleFEMatrices.
Regards,
Ravi
0 Kommentare
Siehe auch
Kategorien
Mehr zu Geometry and Mesh finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!