{"id":19708968,"url":"https://github.com/markcmiller86/hello-numerical-world","last_synced_at":"2025-10-12T08:37:06.647Z","repository":{"id":49592848,"uuid":"278759939","full_name":"markcmiller86/hello-numerical-world","owner":"markcmiller86","description":null,"archived":false,"fork":false,"pushed_at":"2024-09-10T04:02:24.000Z","size":2804,"stargazers_count":7,"open_issues_count":3,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-18T05:49:51.379Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markcmiller86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-11T00:37:37.000Z","updated_at":"2025-04-23T15:06:20.000Z","dependencies_parsed_at":"2025-04-29T17:47:49.786Z","dependency_job_id":null,"html_url":"https://github.com/markcmiller86/hello-numerical-world","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/markcmiller86/hello-numerical-world","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markcmiller86%2Fhello-numerical-world","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markcmiller86%2Fhello-numerical-world/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markcmiller86%2Fhello-numerical-world/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markcmiller86%2Fhello-numerical-world/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markcmiller86","download_url":"https://codeload.github.com/markcmiller86/hello-numerical-world/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markcmiller86%2Fhello-numerical-world/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010793,"owners_count":26084807,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T21:45:48.703Z","updated_at":"2025-10-12T08:37:06.624Z","avatar_url":"https://github.com/markcmiller86.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hello Numerical World\n![example workflow](https://github.com/Josee1031/hello-numerical-world/actions/workflows/main.yml/badge.svg)\n\nFor a complete, hands-on lesson involving this simple HPC/CSE application, please see the [ATPESC-2020 hands on lesson](lessons/hand_coded_heat/).\n\nThis is an implementation of an application for solving one dimensional heat conduction\nproblems. It is the functional equivalent of a *Hello World* application for HPC/CSE.\n\nIn general, heat [conduction](https://en.wikipedia.org/wiki/Thermal_conduction) is governed\nby the partial differential equation ([PDE](https://en.wikipedia.org/wiki/Partial_differential_equation))...\n\n| | |\n|:---:|:---:|\n|![](http://latex.codecogs.com/gif.latex?%5Cfrac%7B%5Cpartial%20u%7D%7B%5Cpartial%20t%7D%20-%20%5Cnabla%20%5Ccdot%20%5Calpha%20%5Cnabla%20u%20%3D%200)|(1)|\n\nwhere _u_ is the temperature at spatial positions, _x_, and times, _t_,\n![](http://latex.codecogs.com/gif.latex?%5Calpha) is the _thermal diffusivity_\nof the material through which heat is flowing. This PDE\nis known as the _Diffusion Equation_ and also the [_Heat Equation_](https://en.wikipedia.org/wiki/Heat_equation).\n\n### Simplifying Assumptions\n\nOur implemenation makes some simplifying assumptions...\n\n1. The thermal diffusivity, ![](http://latex.codecogs.com/gif.latex?%5Calpha),\n   is constant for all _space_ and _time_.\n1. The only heat _source_ is from the initial and/or boundary conditions.\n1. We will deal only with the _one dimensional_ problem in _Cartesian coordinates_.\n\nIn this case, the PDE simplifies to...\n\n| | |\n|:---:|:---:|\n|![](http://latex.codecogs.com/gif.latex?%5Cfrac%7B%5Cpartial%20u%7D%7B%5Cpartial%20t%7D%20%3D%20%5Calpha%20%5Cfrac%7B%5Cpartial%5E2%20u%7D%7B%5Cpartial%20x%5E2%7D)|(2)|\n\nFrom this highly simplified basic problem, there are a number of [extensions](http://hplgit.github.io/num-methods-for-PDEs/doc/pub/diffu/html/._diffu001.html) available for a more in-depth computational science study.\n\nCurrently, three different numerical algorithms are implemented here\n\n* [Foward Time Centered Space (FTCS)](https://en.wikipedia.org/wiki/FTCS_scheme), an\n[explicit](https://en.wikipedia.org/wiki/Explicit_and_implicit_methods) method\n* [Crank-Nicholson](https://en.wikipedia.org/wiki/Crank–Nicolson_method),\nan [implicit](https://en.wikipedia.org/wiki/Explicit_and_implicit_methods) method\n* [Dufort-Frankel](http://folk.ntnu.no/leifh/teaching/tkt4140/._main064.html#ch5:sec42), another\n[explicit](https://en.wikipedia.org/wiki/Explicit_and_implicit_methods) method\nwith higher temporal order than FTCS.\n\nIn addition, the application can be built with half, single, double and long-double precision.\n\nDetails are described more fully in this [ATPESC](https://extremecomputingtraining.anl.gov)\n[Hands-On Lesson](https://josee1031.github.io/hello-numerical-world/lessons/hand_coded_heat/)\n\n---\n\n### Compiling and Using\n\nThe command...\n\n```\nmake\n```\n\nwill output help about available make targets.\n\n```\nTargets:\n    heat: makes the default heat application (double precision)\n    heat-omp: makes heat with OpenMP parallel threading (double precision)\n    heat-half: makes the heat application with half precision\n    heat-single: makes the heat application with single precision\n    heat-double: makes the heat application with double precision\n    heat-long-double: makes the heat application with long-double precision\n    PTOOL=[gnuplot,matplotlib,visit] RUNAME=\u003crun-dir-name\u003e plot: plots results\n    check: runs various tests confirming steady-state is linear\n\n```\n\n`make heat` will make the heat application with *default* (double) precision.\nAfter making the application, the command...\n\n```\n./heat --help\n```\n\ngives help and example command-line argument usage...\n\n```\nUsage: ./heat \u003carg\u003e=\u003cvalue\u003e \u003carg\u003e=\u003cvalue\u003e...\n    runame=\"heat_results\"               name to give run and results dir (char*)\n    alpha=0.2         material thermal diffusivity (sq-meters/second) (fpnumber)\n    lenx=1                                   material length (meters) (fpnumber)\n    dx=0.1                x-incriment. Best if lenx/dx==int. (meters) (fpnumber)\n    dt=0.004                                    t-incriment (seconds) (fpnumber)\n    maxt=2       \u003e0:max sim time (seconds) | \u003c0:min l2 change in soln (fpnumber)\n    bc0=0                   boundary condition @ x=0: u(0,t) (Kelvin) (fpnumber)\n    bc1=1             boundary condition @ x=lenx: u(lenx,t) (Kelvin) (fpnumber)\n    ic=\"const(1)\"               initial condition @ t=0: u(x,0) (Kelvin) (char*)\n    alg=\"ftcs\"                             algorithm ftcs|dufrank|crankn (char*)\n    savi=0                                   save every i-th solution step (int)\n    save=0                              save error in every saved solution (int)\n    outi=100                      output progress every i-th solution step (int)\n    noout=0                                       disable all file outputs (int)\n    prec=2           precision 0=half/1=float/2=double/3=long double (int const)\nExamples...\n    ./heat dx=0.01 dt=0.0002 alg=ftcs\n    ./heat dx=0.1 bc0=273 bc1=273 ic=\"spikes(273,5,373)\"\n```\n\n### Plotting results\n\nThere are scripts for running [gnuplot](http://www.gnuplot.info), [matplotlib](https://matplotlib.org) and [VisIt](https://visit.llnl.gov) to produce curve plots of the results.\nWhatever option you select, the associated tool must be in your path.\nFor example, to use `gnuplot`, use the command...\n\n```\n   make PTOOL=gnuplot RUNAME=heat_results plot\n```\n\nWhere the `RUNAME` option is the name of the directory/folder containing the results to be plotted.\n\n### Setting the Initial Condition (`ic=`)\n\nThe initial condition argument, `ic=`, handles various cases...\n    \n* **Constant**, `ic=\"const(V)\"`: Set initial condition to constant value, `V`\n* **Ramp**, `ic=\"ramp(L,R)\"`: Set initial condition to a linear ramp having value `L` @ `x=0` and `R` @ `x=L_x`.\n* **Step**, `ic=\"step(L,Mx,R)\"`: Set initial condition to a step function having value `L` for all `x\u003cMx` and value `R` for all `x\u003e=Mx`.\n* **Random**, `ic=\"rand(S,B,A)\"`: Set initial condition to random values in the range `[B-A,B+A]` using seed value `S`.\n* **Sin**, `ic=\"sin(A,w)\"`: Set initial condition to `A*sin(pi*w*x)`.   \n* **Spikes**, `ic=\"spikes(C,A0,X0,A1,X1,...)\"`: Set initial condition to a constant value, `C` with any number of _spikes_ where each spike is the pair, `Ai` specifying the spike amplitude and `Xi` specifying its position in, `x`.\n* **File**, `ic=\"file(foo.dat)\"` : read initial condition data from the file `foo.dat`.\n\n\n**Note**: The boundary condition arguments, `bc0=` and `bc1=` should be specified such that they *combine* smoothly with the specified initial condition.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkcmiller86%2Fhello-numerical-world","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkcmiller86%2Fhello-numerical-world","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkcmiller86%2Fhello-numerical-world/lists"}