Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f4cb039
starting basic structure of the properties databases
bhargavakula01 Mar 30, 2025
c68dfd4
updating the cargo.toml file for the oscps-lib library module
bhargavakula01 Mar 30, 2025
2dafbdd
cleaning up the properties.rs file
bhargavakula01 Mar 30, 2025
f589427
adding a new library crate for postgresql db management
bhargavakula01 Mar 30, 2025
cf3db48
updating branch with some minor additions
bhargavakula01 Apr 2, 2025
baa8618
adding properties of the 'PureSpeciesProperties' struct
bhargavakula01 Apr 4, 2025
b14841d
adding a workflow that would update the documentation on github pages…
bhargavakula01 Apr 4, 2025
1623840
added warning flag
bhargavakula01 Apr 4, 2025
a441fd0
starting to implement ability to retrieve information about chemical …
bhargavakula01 May 10, 2025
1dd5192
updating oscps-db
bhargavakula01 May 10, 2025
3f40230
updating branch
bhargavakula01 May 10, 2025
9062fd5
changed 'ThermoState' to 'StreamThermoState' for more specificity
bhargavakula01 May 25, 2025
c0e3703
added some more comments for better understanding of the struct's pur…
bhargavakula01 May 25, 2025
9211a73
renaming connector to stream
bhargavakula01 May 25, 2025
2a88641
updating the main lib.rs file
bhargavakula01 May 25, 2025
f2369aa
added author and edition information :)
bhargavakula01 May 25, 2025
a252056
updating repo and attempting to add autodiff for thermo module
bhargavakula01 Jun 4, 2025
479d716
fixed some compiler issues
bhargavakula01 Jun 4, 2025
c5a70b1
updating comments and using third party autodiff package until experi…
bhargavakula01 Jun 5, 2025
cc78612
made minor changes
bhargavakula01 Jun 8, 2025
19745d4
minor updates to branch
bhargavakula01 Jun 8, 2025
929322a
Merge branch 'develop' into implement_property_modules
bhargavakula01 Jul 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/create-doc-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Generate and Deploy Rust Docs

on:
pull_request:
branches:
- main

jobs:
rust-docs:
name: Generate Rust Documentation
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Generate documentation
run: cargo doc --no-deps

- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
7 changes: 7 additions & 0 deletions oscps-db/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "oscps-db"
version = "0.1.0"
authors = ["Nathaniel Thomas <nathaniel@swbell.net>", "Bhargav Akula <mail.bhargavakula@gmail.com>"]
edition = "2021"

[dependencies]
13 changes: 13 additions & 0 deletions oscps-db/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
///#OSCPS-db
///
///Main library folder for the OSCPS-db library crate
///
///will hold the methods to pull information from the POSTGRES database and from relevant APIs
///
///Will hold property information for chemcial property calculation
///Will hold information about the user's simulation


pub mod postgres_db;
pub mod properties_db;

28 changes: 28 additions & 0 deletions oscps-db/src/postgres_db.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// #PostgresDB
///
/// Will provide methods to connect to a postgres database to pull relevant property and/or
/// simulation information
///
/// properties:
/// 1. db_name
/// 2. query
/// 3. status
/// 4. connection_key

use sqlx::PgPool;
use uuid::Uuid;


enum DBStatus {
Successful,
Failure,
InProgress
}

pub struct PostgresDB {
pub db_name: String,
pub input_query: String,
pub request_status: DBStatus,
db_key: Uuid,
db_pool: PgPool,
}
4 changes: 4 additions & 0 deletions oscps-db/src/properties_db.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
///# PropertiesDB
///
///Will formulate the right queries required for 'DBConnector'
///
2 changes: 1 addition & 1 deletion oscps-gui/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "oscps-gui"
version = "0.1.0"
authors = ["Nathaniel Thomas <nathaniel@swbell.net>", "Bhargav Akula <bhargavakula01>"]
authors = ["Nathaniel Thomas <nathaniel@swbell.net>", "Bhargav Akula <mail.bhargavakula@gmail.com>"]
edition = "2021"

[dependencies]
Expand Down
6 changes: 4 additions & 2 deletions oscps-lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
[package]
name = "oscps-lib"
version = "0.1.0"
authors = ["Nathaniel Thomas <nathaniel@swbell.net>", "Bhargav Akula <mail.bhargavakula@gmail.com>"]
edition = "2021"

[dependencies]
uom = "0.36.0"
uom = "0.37.0"
once_cell = "1.17.1"
pubchem = "0.1.1"
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1", features = ["full"] }
anyhow = "1.0"
autodiff = "0.7.0"
oscps-db = { path = "../oscps-db" }
163 changes: 0 additions & 163 deletions oscps-lib/src/component.rs

This file was deleted.

5 changes: 5 additions & 0 deletions oscps-lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

#![warn(missing_docs)]

extern crate uom;
extern crate once_cell;
extern crate serde;
extern crate anyhow;

pub mod blocks;
pub mod component;
pub mod simulation;
Expand Down
107 changes: 107 additions & 0 deletions oscps-lib/src/properties.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
//! # Properties
//!
//! Contains chemical properties for species in the simulation.

extern crate uom;
extern crate pubchem;
///Importing pure species properties
pub mod pure_species_properties;

use anyhow::Result;
use uom::si::f64::*;
use std::{thread,time::Duration};
use serde::{Serialize, Deserialize};

#[allow(dead_code)]
/// Used by the "Chemical" struct to create the pubchem::Compound obj based on
/// either the chemical name or the pubchem id of the chemical
pub enum ChemicalIdentifier {
/// The PubChem ID of the component.
PubchemID(u32),
/// The actual name of the component.
CompoundName(String),
}


#[allow(dead_code)]
/// A struct to store information regarding the chemical properties of a
/// particular substance. The "Chemical" struct is a wrapper for the
/// pubchem::Compound object
pub struct Chemical {
/// The (PubChem)[<https://pubchem.ncbi.nlm.nih.gov/>] CID of a compound.
pub pubchem_obj: pubchem::Compound,
/// Physical properties of a compound.
pub properties: ChemicalProperties,
}

#[allow(dead_code)]
/// Implementation of the chemical of interest.
impl Chemical {
/// Constructs a new chemical.
pub fn new(identifier: ChemicalIdentifier) -> Result<Self> {
let pubchem_chemical_object = match identifier {
ChemicalIdentifier::PubchemID(id) => pubchem::Compound::new(id),
ChemicalIdentifier::CompoundName(name) => pubchem::Compound::with_name(name.as_str()),
};
let mut request_counter = 0;
let mut cid_vec = None;
while request_counter <= 10 {
match pubchem_chemical_object.cids(){
Ok(cid_list) => {
cid_vec = Some(cid_list);
break;
},
_ => {
request_counter += 1;
thread::sleep(Duration::from_secs(10));
}
};
}

// let cid_vec = pubchem_chemical_object.cids().unwrap();
let cid: i32 = cid_vec.unwrap()[0];
let prop = ChemicalProperties::new(cid).unwrap();
Ok(Chemical {
pubchem_obj: pubchem_chemical_object,
properties: prop,
})
}
/// Returns the pubchem object for the compound.
pub fn get_pubchem_obj(&self) -> &pubchem::Compound {
&self.pubchem_obj
}

/// Returns the "ChemicalProperties" object for the "Chemical" object.
pub fn get_properties(&self) -> &ChemicalProperties {
&self.properties
}
}

#[allow(dead_code)]
/// Struct containing properties of a chemical
pub struct ChemicalProperties {
/// Pure species properties
pub critical: Option<CriticalProperties>,

/// Heat capacity coefficients (optional, stored as an array)
pub heat_capacity: Option<HeatCapacityCoefficients>,

/// Transport properties (optional, could include viscosity, etc.)
pub transport: Option<TransportProperties>,

/// Additional chemical property categories
// Here we might add properties related to binary interactions, etc...
pub other_properties: Option<Vec<OtherProperty>>,
}

/// Trait to group all property libraries
trait PropertyLibrary {
/// default function for connecting the database to pull relevant property information
fn oscps_db_connection(&self) -> &db_connection;
}



#[cfg(test)]
mod chemical_species_tests {
}
Loading
Loading