I'm new to numerical modeling and trying to figure out how things work inside business codes.

Consider a 1D domain divided into small cells of width dx and at the East and West a Neumann conditions boundary is affected (zero flow in the East and constant in the West). In the center, we have an upward outgoing flow. Here is an illustration image:

problem illustration image

The PDE governing this problem is given by the following:

PDE governing the problem and BC conditions


  1. The model is in 1D and the flow w is done along the fictitious axis y. How do we define it as a boundary condition in our model?

  2. Are the defined boundary conditions calculated independently of the PDEP or should they be incorporated into the discrete form of the EDP as below (example with q2)?

BC at the Western coin

  1. I also question the correctness of the formulation of the condition on qa. Indeed, it is an outgoing flow towards the outside (thus according to the fictitious axis y). Is my way of writing it correct?

Thank you in advance!

EDIT: Pseudo-code

For all points contained in my domain except the well and boundary points:
    Apply (1) S * du/dt = T * d2u/dx2 + w

At my well level (Neumann boundary condition)
    Apply (2) S * du/dt = T * d2u/dx2 + q

At my boundary points (Left and rigth) -> Neumann condition
    q = Tdu/dx -> discretize and replace it in (3)
    (3) S * du/dt = T * d2u/dx2

Is it right?

  • $\begingroup$ As a quick answer: 1) You divided your domain into cells; and the inflow of 'w' likely just corresponds to adding it (whatever it represents) to appropriate 'u_i' cell/node. Make sure that the units are correct when you do that. 2) They should definitely be incorporated into your discrete equations, as I notice you are solving an implicit FD problem which typically has no solution unless the boundary conditions are specified. 3) I don't understand your question (where does the formulation come from, what do you mean with 'qa', how does the fictitious y axis come into play?). Can you clarify? $\endgroup$
    – Erik
    Oct 23 at 21:07
  • $\begingroup$ Incidentally, if you look online for "implicit finite-difference for 1D heat equation" you'll find a lot of material to solve the same equation as you're solving. $\endgroup$
    – Erik
    Oct 23 at 21:19
  • $\begingroup$ @Erik thank you for your answer and also for the link. What I would like to know is: if I have a 1D aquifer that receives recharge everywhere and zero flow in the East and West boundaries as well as pumping in the middle, how should I represent my problem mathematically? Should I apply the discrete form of the equation in all cells without the source / sink terms and modify the discrete form to include the conditions imposed at the appropriate points? $\endgroup$ Oct 23 at 21:28
  • $\begingroup$ the source/sink term should've been part of the PDE from the get-go, en.wikipedia.org/wiki/… , so the "receiving recharge everywhere and pumping in the middle" are all part of variable "G" at the Wikipedia link. So you can discretize the PDE form without modification (though I'm not sure what you mean with that exactly. BTW, if you share your current code, it'll be easier to discuss where you are more vs where you are less stuck. Does your code work? Does it not?). $\endgroup$
    – Erik
    Oct 24 at 7:03
  • $\begingroup$ @Erik I added a pseudo-code. Is it right to do that like presented above? $\endgroup$ Oct 24 at 13:00

In any solution to a PDE, whether analytical or numerical, you will always need as many BCs as the number of derivative steps. For examples:

$$dY/dt = k Y$$

needs one BC while

$$\partial Y/\partial t = k \nabla^2 Y$$

needs three BCs. The second case is germane to your problem. You will need one BC on time $t$ because one derivative is on time. You will need two independent BCs on position because two derivatives are applied on position.

We set BCs to make an otherwise general equation apply specifically to the physical system at hand. For heat transfer problems, viable conditions can include the following:

Time Domain

  • temperature at a given time

Spatial Domain

  • temperature at a given location
  • heat flux at a given location

In regard to the spatial domain in a 1-D flow, one cannot set a heat flux BC at one point and set a heat flux BC at a second location. The two BCs are not independent. They are tied together by an energy balance on the overall system or across any spatial extent in the system.

Now, specifically to your questions.

  1. The system as illustrated is being modeled in a way that is equivalent to a 1-D fin. The heat flow $w$ into the component is "lumped". The temperature gradient in the component along its axis is ignored. You could easily have one cell along that direction and simplify the analysis. You have no BCs on that direction. Your alternative is to switch to a 2-D model to include the heat flow in the component along the $y$ direction. The "topmost" cell takes $w$ in and distributes it along $x$ and $y$. The bottom-most cell takes heat from the topmost cell and distributes it along $x$ (presuming the bottom is insulated).

  2. The BCs are defined independently of the equations. In analytical evaluations, they are used to obtain the constants in the general integrations steps to the partial differential equation. In the numerical evaluations, they are used to initialize the computational routines or to pass solutions from one cell to another properly.

  3. We apply a BC on heat flow after the first spatial integration. We apply a spatial BC on temperature after the second spatial integration. We apply a temporal BC on temperature after the integration on time. You seem to be trying to incorporate the BCs directly into the general equation.

  • $\begingroup$ Thank you for your detailed answer. So it's a bad idea to incorporate BCs directly into the equation? Isn't it ever done to incorporate them? $\endgroup$ Oct 27 at 15:14
  • $\begingroup$ Use BCs to obtain the specific values for the constants to the general analytical solutions when integrating a PDE. Use BCs to set initial numerical values or to match numerical values at boundaries of a cell during numerical integrations of a PDE. $\endgroup$ Oct 27 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.