Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- `PcSaftFunctional` now always uses `Joback` as ideal gas model if parameters are available. [#25](https://github.com/feos-org/feos-pcsaft/pull/25)

## [0.1.0] - 2022-01-12
### Added
Expand Down
2 changes: 1 addition & 1 deletion src/dft/hard_chain.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::parameters::PcSaftParameters;
use feos_core::EosError;
use feos_dft::fundamental_measure_theory::FMTProperties;
use feos_dft::{
FunctionalContributionDual, WeightFunction, WeightFunctionInfo, WeightFunctionShape,
};
use feos_core::EosError;
use ndarray::*;
use num_dual::DualNum;
use std::fmt;
Expand Down
14 changes: 13 additions & 1 deletion src/dft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ use crate::eos::PcSaftOptions;
use crate::parameters::PcSaftParameters;
use association::AssociationFunctional;
use dispersion::AttractiveFunctional;
use feos_core::joback::Joback;
use feos_core::parameter::Parameter;
use feos_core::MolarWeight;
use feos_core::{IdealGasContribution, MolarWeight};
use feos_dft::adsorption::FluidParameters;
use feos_dft::fundamental_measure_theory::{FMTContribution, FMTProperties, FMTVersion};
use feos_dft::solvation::PairPotential;
Expand All @@ -28,6 +29,7 @@ pub struct PcSaftFunctional {
fmt_version: FMTVersion,
options: PcSaftOptions,
contributions: Vec<Box<dyn FunctionalContribution>>,
joback: Joback,
}

impl PcSaftFunctional {
Expand Down Expand Up @@ -85,11 +87,17 @@ impl PcSaftFunctional {
}
}

let joback = match &parameters.joback_records {
Some(joback_records) => Joback::new(joback_records.clone()),
None => Joback::default(parameters.m.len()),
};

let func = Self {
parameters: parameters.clone(),
fmt_version,
options: saft_options,
contributions,
joback,
};

DFT::new_homosegmented(func, &parameters.m)
Expand All @@ -114,6 +122,10 @@ impl HelmholtzEnergyFunctional for PcSaftFunctional {
fn contributions(&self) -> &[Box<dyn FunctionalContribution>] {
&self.contributions
}

fn ideal_gas(&self) -> &dyn IdealGasContribution {
&self.joback
}
}

impl MolarWeight<SIUnit> for PcSaftFunctional {
Expand Down