MATLAB Answers

3D Multi-Domain PDE Modelling

47 views (last 30 days)
ADSW121365
ADSW121365 on 6 Jan 2020
Edited: ADSW121365 on 15 Jun 2020
The associated geometry for my problem is given below, where cell 1 is the current containing region and cell 2 is the surrounding space. The mesh is produced via gmsh and imported to MATLAB to deal with the limitations noted here:
An example code to do this is given below, please excuse the terrible use of global variables in this piece of demo code:
clear,close all; clc;
N = 3; %Number of Equations
model = createpde(N); %Value = #Variables
%% Import gmsh mesh:
Total_Smoothed_Hollow_TwoCell
elements = msh.TETS;
geom2 = geometryFromMesh(model,nodes,elements);
%% Variables:
global I_mag N_wire L_inner L_outer Z_height mu_o
I_mag = 20;
N_wire = 861;
Z_height = 8.89e-2;
L_inner = 10.42e-2;
L_outer = 15.24e-2;
mu_o = 4*pi*10^(-7);
%% Region 1:
c_coeff = zeros(9*N^2,1);
c_coeff = c_coeffassign_2v(c_coeff,N);
specifyCoefficients(model,'m',0,'d',0,'c',c_coeff,'a',0,'f',@f_coeffunction,'Cell',1); %Outer
%% UNCOMMENT ME FOR NON-SINGULAR 'RESULTS' %%
%applyBoundaryCondition(model,'dirichlet','Face',[1,2,3,4,5,6,7,8,9,10],'u',[0;0;0]);
%% Region 2:
c_coeff = zeros(9*N^2,1);
c_coeff = c_coeffassign_2v(c_coeff,N);
specifyCoefficients(model,'m',0,'d',0,'c',c_coeff,'a',0,'f',[0;0;0],'Cell',2);
applyBoundaryCondition(model,'dirichlet','Face',[11,12,13,14,15,16],'u',[0;0;0]);
%% Solving:
results = solvepde(model);
vals = results.NodalSolution;
The code as given provides error message:
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.084396e-18.
> In pde.EquationModel/solveStationary (line 49)
In pde.PDEModel/solvepde (line 74)
In MATHWORKS_PDETOOL_SIMPIF (line 54)
Other Attempts and Related Work:
The addition of a second boundary condition on this (the commented out one in the above) removes this singular warning however the solution is then nearly all zeros.
I have also tried using neumann conditions in various formats for the two regions to no avail. Combinations of dirichlet for one region and Neumann for the other have also been considered.
In the context of the PDE Toolbox, what does the singular warning actually mean? I'm assuming there is some error in my setup somewhere.

  0 Comments

Sign in to comment.

Accepted Answer

Ravi Kumar
Ravi Kumar on 7 Jan 2020
Thanks for taking time to explain the problem with such a detail and for providing the reproduction code. I tried to understand and reproduce the behavior. However, one function you have used in f_coeffunction_2v.m, quad_find(), is missing from the attachment. It would help if you can attach that.
While I still don’t fully understand the setup of f-coefficient, I don’t have access to the paper, I think I sort have a clue what is going on. First, we need to understand how the two volumes (subdomains C1 and C2) that form the problem domain are related. As per the current setup, I don’t see any coupling between C1 and C2. That is C1 will have its own set of elements and C2 will have its own. Refer to this mesh plot below that I obtained using the commands:
elementsSection = model.Mesh.findElements('box',[0.0,0.5],[-0.6,0.6],[-0.6,0.6]);
figure
pdemesh(model.Mesh.Nodes,model.Mesh.Elements(:,elementsSection))
figure
pdemesh(model.Mesh.Nodes,model.Mesh.Elements(:,elementsSection),'FaceAlpha',0.4)
ElementSection1.png
ElementSection2.png
I guess this is not what you intend to model, right? I am guessing you want model the conductor at the center and volume of air around it to solve for A in that air domain. If so, then I think you need subdomains that don’t overlap but share interface boundaries. Would you have able to generate the mesh in gmsh such that two volumes stay separate?
Regards,
Ravi

  6 Comments

Show 3 older comments
ADSW121365
ADSW121365 on 4 Mar 2020
I have now solved this issue, you were correct and it was a mesh issue. Thanks!
JJC
JJC on 13 May 2020
How was the mesh issue solved?
ADSW121365
ADSW121365 on 15 Jun 2020
The Coherence; command at the start of my GMSH script.

Sign in to comment.

More Answers (0)


Translated by