Skip to content

MoeidHeidari/PDE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nonhomogeneous PDE - Heat Equation

Developed by Moeid Heidari and Omar Mohammed
Non homogeneous Heat conduction equation implementation in C++.

eq1p                                                                  1

Strategy:

Step 1. We first obtain the eigenfunctions in x, Gn(x), that satisfy the PDE and boundary conditions (I) and (II)
Step 2. Expand u(x,t), f(x,t), and P(x) in series of Gn(x). This will convert the nonhomogeneous PDE to a set of simple nonhomogeneous ODEs.
Step 3. We Solve the nonhomogeneous ODEs, use their solutions to reassemble the complete solution for the PDE.

For the current example, our eigenfunctions are Gn(x) = sin(nπx), so we should try


eq-2-3-4p eq-2-3-4p1



From Eqs. (3) and (4), qn(t) and un(0) have already been determined. Our task is to solve un(t) and express it in un(0) (the initial condition of un(t)) and qn(t) (the forcing that acts on un(t)).

Plugging Eq. (2) into the original PDE, we have

mathpix-2021-01-13-18-07-19

mathpix-2021-01-13-18-14-14

mathpix-2021-01-13-18-31-06
mathpix-2021-01-13-18-32-21

or,

mathpix-2021-01-13-18-42-05                 1

Equation (5) has the standard solution,

mathpix-2021-01-13-19-31-20 1

Since un(0) and qn(t) are known from Eqs. (3) and (4), we have the complete solution once the integral in Eq. (6)
is evaluated to obtain un(t) ; u(x,t) can be evaluated by Eq. (2) once un(t) is known.

Thus, the expansion in Eq. (2) is reduced to just two terms,

The final solution:
mathpix-2021-01-13-19-44-16          1

Where,

mathpix-2021-01-13-20-04-26                            1

mathpix-2021-01-13-20-12-09    1

Installation

Use the Makefile to make the source code

IDIR =include
CC=g++
CFLAGS=-I$(IDIR)

ODIR=obj
LDIR =lib

_DEPS = PDE.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))

_OBJ = pde.o main.o
OBJ = $($(ODIR)/%,$(_OBJ))


$(ODIR)/%.o: main.cpp $(DEPS)
	$(CC) -c -o $@ $< $(CFLAGS)

all: $(OBJ)
	$(CC) $(CFLAGS) $(LIBS) src/main.cpp -o main

.PHONY: clean

clean:
	rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~

#use make in the root directory of the project

make

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Skheydari@stud.etu.ru
Omokhammed@stud.etu.ru

License

MIT

About

Nonhomogeneous PDE - Heat equation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published