1次元・2次元の熱伝導方程式を Python と Fortran で解くための作業ディレクトリです。
heat_equation/
├── src/
│ ├── python/ # Python source files
│ ├── fortran/ # Fortran source files
│ └── julia/ # Julia source files
├── scripts/ # Plotting and helper scripts
├── figure/ # Figures and animations
├── output/ # Simulation output files
└── bin/ # Executable files
make build # Build Fortran executables
make run-python # Run Python 1-D and 2-D solvers
make run-fortran # Run Fortran 1-D and 2-D solvers
make animation # Create Python/Fortran animations
make clean # Remove generated output, figures, and Fortran binariespython3 src/python/run_1d.py --initial gaussian --boundary neumann
python3 src/python/run_2d.py --initial sine --boundary periodicAvailable initial conditions:
- 1-D:
semicircle,gaussian,sine - 2-D:
square,gaussian,sine
Available boundary conditions:
dirichletneumannperiodic
Default outputs:
output/python/1d/temp.0000,temp.0000.vtk, ...output/python/2d/field.0000,field.0000.vtk, ...output/python/2d/result.datoutput/python/2d/result.vtk
The .vtk files can be opened in ParaView.
python3 scripts/animate_heat_1d.py
python3 scripts/animate_heat_2d.pyDefault outputs:
figure/heat_1d.mp4figure/heat_1d.giffigure/heat_2d.mp4figure/heat_2d.gif
make build
./bin/heat_1d output/fortran/1d gaussian neumann
./bin/heat_2d output/fortran/2d sine periodicDefault build output:
bin/heat_1dbin/heat_2dsrc/fortran/tmp/*.mod
Fortran positional arguments:
heat_1d [output_dir] [initial] [boundary] [no-vtk]
heat_2d [output_dir] [initial] [boundary] [no-vtk]