Implementing symmetry boundary condition for the diffusion equation

Click For Summary

Discussion Overview

The discussion revolves around implementing boundary conditions for a 1D diffusion equation model, specifically focusing on symmetry and infinite boundary conditions in the context of fluid flow in a porous medium. Participants explore how these conditions affect the numerical solution and its correlation with analytical models.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant inquires about implementing a symmetry boundary condition where the temperature at the 10th node is equal to that at the 9th node.
  • Another participant questions the rationale behind this symmetry condition and its relevance to the diffusion problem.
  • A participant clarifies that they aim to model a scenario where the right boundary has no impact on fluid head or heat flow, correlating it with a zero flux condition at the boundary.
  • There is a suggestion that zero flux at the right boundary implies an impermeable barrier, which would affect the solution.
  • One participant proposes that the boundary condition can be expressed mathematically using the diffusion equation at the endpoint.
  • A request is made for clarification on how to implement the infinite boundary condition in the context of the provided numerical model.

Areas of Agreement / Disagreement

Participants express differing views on the implications of symmetry and infinite boundary conditions, with no consensus reached on the best approach to implement these conditions in the numerical model.

Contextual Notes

Participants discuss the mathematical representation of boundary conditions and their physical interpretations, highlighting the complexity of modeling boundaries in numerical simulations.

Atr cheema
Messages
67
Reaction score
0
The following lines of codes implements 1D diffusion equation on 10 m long rod with fixed temperature at right boundary and right boundary temperature varying with time.
Code:
    xsize   =   10;               % Model size, m
xnum    =   10;                 % Number of nodes
xstp    =   xsize/(xnum-1);     % Grid step
tnum    =   504;                 % number of timesteps
kappa   =   833.33;            %     k/rhocp;            % Thermal diffusivity, m^2/s
dt     =   300;                      % Timestep
x       =   0:xstp:xsize;         %Creating vector for nodal point positions
tlbc = sin(linspace(0.1,2.9,tnum));      % left boundary condition
%Define initial temperature profile
tback   =   0;               % background temperature, K

for i=1:1:xnum
    % Background profile   
    t0imp(i)    =   tback;      % profile for implicit solving
    end
end
% Time cycle
timesum=0; % Elapsed time
for t=1:1:tnum

    % Matrix of coefficients initialization for implicit solving
    L       =       sparse(xnum,xnum);
    % Vector of right part initialization for implicit solving
    R       =       zeros(xnum,1);

    % Implicit solving of 1D temperature equation: dT/dt=kappa*d2T/dx2
    % Composing matrix of coefficients L()
    % and vector (column) of right parts R()
    % First point: T=tback
    L(1,1)  =       1;
    R(1,1)  =       tlbc(t);
    % Intermediate points
    for i=2:1:xnum-1
        % dT/dt=kappa*d2T/dx2
        % Tnew(i)/dt-kappa*(Tnew(i-1)-2*Tnew(i)+Tnew(i+1))/dx^2=Told(i)/dt
        %%% Eq 10.6
        L(i,i-1)    =   -kappa/xstp^2;
        L(i,i)      =   1/dt+2*kappa/xstp^2;
        L(i,i+1)    =   -kappa/xstp^2;
        R(i,1)      =   t0imp(i)/dt;
    end
    % Last point:T=tback
    L(xnum,xnum)    =   1;

    R(xnum,1)       =  tback;
    % Obtaining solution for implicit temperature profile
    t1imp           =   L\R;

end

My question is how can I implement a symmetry boundary condition. I mean the temperature calculated for 9th node is assigned to 10th node? Also I want to know how can I implement infinite boundary condition?
 
Technology news on Phys.org
Atr cheema said:
I mean the temperature calculated for 9th node is assigned to 10th node?
Node10=Node9 ...?
I don't understand why you would want to do this though. Can you explain how this relates to the diffusion problem stated?
Atr cheema said:
Also I want to know how can I implement infinite boundary condition?
For numerical solvers, you can't do this in general. I'm also not aware of any physical problem which would require an infinite boundary condition. If you want an infinite boundary for whatever reason, the best you can do numerically is assign a very large value at the needed boundary.
 
NFuller said:
Node10=Node9 ...?
I don't understand why you would want to do this though. Can you explain how this relates to the diffusion problem stated?
I want to implement a boundary condition where presence of boundary has no impact . I am using diffusion equation to model fluid flow in porous medium and want to correlate the numerical model with an analytical model where flux at right boundary is zero i.e. ## \frac{\partial u}{\partial x} = 0 ## . Consider u as fluid head instead of temperature. I think in this case, having zero flux at right boundary means that right boundary is having no impact on fluid head/heat flow in x direction.
 
Atr cheema said:
I think in this case, having zero flux at right boundary means that right boundary is having no impact on fluid head/heat flow in x direction.
Zero flux is equivalent to one end having an impermeable barrier, and would definitely have an impact on the solution. If your goal is to model the absence of a boundary or a boundary at infinity, then your boundary condition can be taken as the diffusion equation at the end point,
$$\frac{\partial u}{\partial t}=D\frac{\partial^{2}u}{\partial x^{2}}\bigg |_{x=10}$$
Depending on how your algorithm works, this can be done with a one-sided finite difference at the boundary.
 
NFuller said:
Depending on how your algorithm works, this can be done with a one-sided finite difference at the boundary.
Could you please explain this that in the given case, how can this infinity boundary condition be implemented here?
 

Similar threads

Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
2
Views
2K
  • · Replies 8 ·
Replies
8
Views
1K
  • · Replies 17 ·
Replies
17
Views
3K
Replies
0
Views
1K
Replies
1
Views
3K