Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 70bf5e9
  • /
  • findHF.c
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:abc433f6093fa11ca40862c65f1031b7a5bd76ff
directory badge
swh:1:dir:70bf5e99543362ad259e4f1a4ade4d7219a68ef3

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
findHF.c
/* Title: Getting Energy
# Author: Vatsal Sanjay
# vatsalsanjay@gmail.com
# Physics of Fluids
*/
#include "axi.h"
#include "navier-stokes/centered.h"
#include "fractions.h"

trace
double interface_energy (scalar c){
  double se = 0.;
  foreach (reduction(+:se)){
    if (c[] > 1e-6 && c[] < 1. - 1e-6) {
      coord p, n = interface_normal (point, c);
      double alpha = plane_alpha (c[], n);
      double len = line_length_center(n, alpha, &p);
      se += 2.*pi*( y + p.y*Delta )*(len*Delta); // 2*pi*\int_l (r_c)dl
    }
  }
  return se;
}

scalar f1[], f2[], *interfaces = {f1, f2};
double se1, se2;

char filename[80], nameEnergy[80];
// boundary conditions
u.t[left] = dirichlet(0.0);
f1[left] = dirichlet(0.0);
f2[left] = dirichlet(1.0);

int main(int a, char const *arguments[]) {
  sprintf (filename, "%s", arguments[1]);
  sprintf(nameEnergy, "%s", arguments[2]);

  FILE *fp;
  fp = fopen (nameEnergy, "a");
  restore (file = filename);

  f1.prolongation = fraction_refine;
  f2.prolongation = fraction_refine;

  boundary((scalar *){f1, f2, u.x, u.y});

  /*
  Do calculations start
  */
  se1 = 0., se2 = 0.;

  se1 = interface_energy (f1);
  se2 = interface_energy (f2);

  boundary((scalar *){f1, f2, u.x, u.y});

  double Zmin1 = 0.;
  foreach_boundary(bottom){
    if (f2[] > 1e-6 && f2[] < 1. - 1e-6) {
      Zmin1 = x;
      // fprintf(ferr, "%f\n", x);
    }
  }
  /*
  Do calculations end
  */

 if (t == 0){
    fprintf(ferr, "t se1 se2 Zmin\n");
    fprintf(fp, "t se1 se2 Zmin\n");
  }

  fprintf(ferr, "%f %f %f %f\n", t, se1, se2, Zmin1);
  fprintf(fp, "%f %f %f %f\n", t, se1, se2, Zmin1);
  fclose(fp);
}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API