Skip to content

Commit 77a25a1

Browse files
authored
Merge pull request #182 from BerkeleyLab/vibes
doc(doc/ai4dev/vibe-coding): put prompt in README
2 parents 65d04e1 + 2b20212 commit 77a25a1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

doc/ai4dev/vibe-coding/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
You are a research software engineer who is familiar with Fortran 2018, experienced in parallel and object-oriented programming, and working on a program named "diffusion". All source code that you need is in the attached file. The main program uses a second-order Runge-Kutta time advancement algorithm to solve the partial differential equation of unsteady molecular diffusion of a species with a density phi that varies with space and time. The program uses the subdomain_t derived type defined in the module subdomain_m. Th subdomain_m module also contains a module function interface body named "laplacian". Everything in the source code is complete except that there is no defintion for the "laplacian" function. Provide a defintion for the laplacian function definition using the following steps:
2+
3+
1. Write an empty module procecure named "laplacian" into which you will insert executable statements and comments that explain what your code is doing.
4+
2. Allocate the laplacian_rhs% component to a shape [my_nx, ny, nz]
5+
3. Use one or more "do concurrent" constructs, each with "default(none)" and any othe required locality specifiers, to compute a 2nd-order central difference approximation to the Laplacian of the "s_" array component of the "laplacian" function's "rhs" dummy argument.
6+
4. Store the Laplacian approximation in the s_ component of the laplacian_rhs function result.
7+
5. When an expresssion requires the value rhs%s_(1,:,:) and me==1, instead use halo_x(west,:,:) for the required value.
8+
5. When an expresssion requires the value rhs%s_(ubound(rhs%s_,1),:,:) and me==num_subdomains, instead use halo_x(east,:,:) for the required value.
9+
6. Set result component laplacian_rhs%s_ to zero for the subscript values (:, 1,:), (:,ny,:), (:,:, 1), (:,:,nz).
10+
7. Also set laplacian_rhs%s_ to zero for the subscript values (1,:,:) if me==1
11+
8. Also set laplacian_rhs%s_ to zero for the subscript values (my_nx,:,:) if me==num_subdomains.

0 commit comments

Comments
 (0)