Giter Site home page Giter Site logo

stephenhillier / geotech-utils Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 1.0 210 KB

Utilities for geotechnical analysis and lab calculations (for JavaScript projects)

License: MIT License

JavaScript 100.00%
geotechnical-engineering civil-engineering javascript

geotech-utils's Introduction

geotech-utils

Build Status Coverage Status

A library of utilities for geotechnical analysis and lab calculations written in JavaScript

module: sieve.js

Contains helper classes for storing the results of a grain size analysis (or sieve) test.

Background:

A grain size analysis is a common laboratory test used to help determine the engineering properties of soil and aggregate. A soil sample is mechanically sorted using a stack of sieves, and each sieve retains particles of a different size. The results indicate the percentage of gravels, sands, and fine particles (i.e. silt and clay) in the sample.

Quick start:

import { SieveTest } from 'sieve';

// create an array containing the sizes (in mm) of each sieve
const sizes = [25, 20, 14, 10, 5, 2.5, 1.25, 0.630, 0.315, 0.160, 0.08];

// define the soil sample to be tested
const sample = {
  name: 'Sample 1',
  wetMass: 2100,
  dryMass: 2000,
  washedMass: 1900
};

// pass in an object with the sizes and the sample to create a new SieveTest object
const test = new SieveTest({ sizes, sample });

An array of sieves is created:

stack collection example

This simple data structure can be used with a modern web framework (like Vue.JS) to generate input fields/models and store data for a lab testing or sample database application.

Each sieve object has a "retained" property, denoting the mass of soil retained (recorded during the test). Continuing from the example above:

// record the retained value for the 16 mm sieve by passing a number into retained()
test.sieve(16).retained(155);

// get the retained value by calling it with no arguments
console.log(test.sieve(16).retained());
>>> 155

Finally, to calculate the results of the test:

SieveTest.prototype.passing() - returns an array of "percent passing" values (to be plotted).

Additional prototype methods

Use the following prototype methods to modify your SieveTest instance:

SieveTest.prototype.addSieve(size) - adds a sieve of a given size

SieveTest.prototype.removeSieve(size) - removes the specified sieve

SieveTest.prototype.sieve(size) - returns the sieve object with the specified size

FAQ

I have forms that allow users to record masses, but my results aren't calculated properly.

HTML forms return a string, even if <input type="number">. Numeric values need to be of type Number. Vue.JS can typecast input; use this syntax:

<input v-model.number="sieve.mass" type="number">

I've plotted the sieve results, but my grain size distribution curve doesn't start at 100%.

For the grain size distribution to start at 100%, you need to record a size that 100% of the soil sample passed through. In other words, you should have at least one sieve size (the largest size) where sieve.mass === 0.

Development:

To install dev dependencies and run unit tests, clone this repository and run:

npm install
npm run test

geotech-utils's People

Contributors

dependabot[bot] avatar stephenhillier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

lizemin5235

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.