How to apply the boundary conditons to the mass and stiffness matrices?

6 views (last 30 days)
I'm using the Partial Differential equation toolbox for getting the mass and stiffness matrices of a cube and liked to apply boundary conditions on the faces. My code looks like that:
gm = multicuboid(2,2,2);
model = createpde;
model.Geometry = gm;
specifyCoefficients(model,'m',0,'d',1,'c',1,'a',0,'f',1);
applyBoundaryCondition(model,'dirichlet','Face',1:6,'u',0);
mesh = generateMesh(model,'GeometricOrder','linear', ...
'Hmax', 2^-2);
FEM = asembleFEMatricess(model);
M = FEM.M; K = FEM.K;
How can I apply the boundary conditions to the matrices M and K. I know, that FEM also contains the matrices
FEM =
struct with fields:
K: [919×919 double]
A: [919×919 double]
F: [919×1 double]
Q: [919×919 double]
G: [919×1 double]
H: [452×919 double]
R: [452×1 double]
M: [919×919 double]
where G,H,R,M store some sort of information about the boundary conditions, but I'm not sure how to combine that with M and K. I'm also not sure if which matrices the 'nullspace' options returns.
PS: I need the matrices for solving the heat equation with a space-time-method, that is why a don't use the solve option from the model.
PPS: This should also work for quadratic meshs, thats why I can't just delete rows and columns.
  6 Comments
Sravan Kumar Putta
Sravan Kumar Putta on 25 Feb 2021
I am in extreme need of help dear, can u pls look into this problem
https://in.mathworks.com/matlabcentral/answers/755649-how-to-solve-semi-discretized-pde-matrices-with-a-time-derivative-in-pde-tool-box-using-ode-solvers?s_tid=srchtitle

Sign in to comment.

Accepted Answer

Ravi Kumar
Ravi Kumar on 18 Jun 2019
Use the 'nullspace' as second argument, you will get matrices with BC imposed by eleminating dirichlet DoFs.
Regards,
Ravi
  3 Comments
Sravan Kumar Putta
Sravan Kumar Putta on 25 Feb 2021
Once you got matrices from nullspace or stiff-spring, How did you solve it using space - time method ? If you have used ODE solvers then how did you frame the ode function?
Can any one explain me?

Sign in to comment.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!