- Check the implementation of the “getStationaryFEMatrices” method in your code. Make sure that it is correctly using the coefficient functions from your model to produce the K matrix.
- Verify that the inputs to the “getStationaryFEMatrices” method are correct. Ensure that “u0” does not contain any NaN values and that tdummy is set to 0.
- Debug the “getStationaryFEMatrices” method by adding breakpoints and inspecting the intermediate calculations. This will help you identify where the NaN values are coming from and why they are being propagated to the K matrix.
PDE Toolbox: conversion of my linear PDE model from the old "[p,e,t]" based workflow to the newer object-based work flow
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have been using the PDE Toolbox for many years with the old [p,e,t] workflow, and want to upgrade my code to newer PDEmodel object - based workflow with 2nd order finite elements. I am solving a set of linear elliptic 2D PDEs to find the normal wave modes in an inhomogeneous medium. I feel that I have converted all of my functions to give the correct outputs for the specifyCoefficients(model,...) and applyBoundaryCondition(model,...), in which function handles of the form C_fun(Loc,State) (etc) are used, however for some reason, the command solvepde(model) returns an error indicating that the specified model is detected as nonlinear. I can't find the method by which the toolbox identifies whether or not a problem is nonlinear in the documentation - and I can't find how my coefficient or boundary condition functions might mistakenly indicate that the problem is nonlinear (e.g. the State input is unused in all of these functions). Can you please help me to find the right way to code these functions that ensures the problem is treated as a linear problem?
One further observation: I noticed that solvepde.m calls the function DiscretizedPDEModel.m, which detects whether a problem is nonlinear by inputting state.u = NaN to the coefficient functions and flagging whether a NaN output is returned. I put a break in this function and eventually found that the function [K,A,F,Q,G,H,R] = self.getStationaryFEMatrices(u0,tdummy) (with tdummy = 0) returns NaNs in K even if u0 does not contain NaNs, however the coefficient functions from my model contained in self.coefstruct.Coefficients (that I guess should be used to produce K...) do not return NaNs...
0 Kommentare
Antworten (1)
Sanju
am 3 Jan. 2024
I understand that you are encountering an error indicating that the model is being detected as nonlinear when you believe it should be treated as a linear problem. It seems like you have made the necessary changes to your code to use the PDEmodel object-based workflow with 2nd order finite elements.
To determine whether a problem is nonlinear, the PDE Toolbox uses the “DiscretizedPDEModel.m” function, which inputs state.u = NaN to the coefficient functions and checks if any NaN outputs are returned. If NaNs are detected, the problem is considered nonlinear.
In your case, you mentioned that the function [K,A,F,Q,G,H,R] = self.getStationaryFEMatrices(u0,tdummy) returns NaNs in K even if “u0” does not contain NaNs. This suggests that there might be an issue with the implementation of the “getStationaryFEMatrices” function.
To further investigate this issue, you can try the following steps:
If you are unable to identify the issue, it would be helpful to provide the code for the “getStationaryFEMatrices” function and any relevant coefficient functions so that I can assist you further.
You can also refer to the below documentation on solving PDE functions if required,
Hope this Helps!
Thanks.
0 Kommentare
Siehe auch
Kategorien
Mehr zu General PDEs 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!