Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
faf838f
Empty commit
AndreaQuerio Dec 2, 2022
826d4a4
Add Hello
AndreaQuerio Dec 2, 2022
4017333
Update simple case
AndreaQuerio Dec 2, 2022
fb3e4d0
Update simplified case
AndreaQuerio Dec 2, 2022
4a88542
Modify controlDict files
AndreaQuerio Dec 12, 2022
3cde787
Remove old version of the session
AndreaQuerio Jan 12, 2023
4b30c7b
Updating simpleCases branch
AndreaQuerio Jan 12, 2023
b7469f9
Change Dockerfile
AndreaQuerio Jan 12, 2023
0ddb341
Change Docker file
AndreaQuerio Jan 12, 2023
6690567
Change Dockerfile
AndreaQuerio Jan 12, 2023
d8a6b47
Corrections
AndreaQuerio Jan 12, 2023
af9dacf
Other changes
AndreaQuerio Jan 12, 2023
5b4bd71
Testing
AndreaQuerio Jan 13, 2023
69c0654
Testing
AndreaQuerio Jan 13, 2023
ad99c67
Testing
AndreaQuerio Jan 13, 2023
7eec662
Testing
AndreaQuerio Jan 13, 2023
0c484c0
Testing
AndreaQuerio Jan 13, 2023
59576e9
Testing
AndreaQuerio Jan 13, 2023
58a3104
Testing
AndreaQuerio Jan 13, 2023
917ef72
Testing
AndreaQuerio Jan 13, 2023
6ffa05c
Correcting reactDivision file
AndreaQuerio Jan 13, 2023
92dfe04
Correcting reactDivision file
AndreaQuerio Jan 13, 2023
b320af2
Change Dockerfile
AndreaQuerio Jan 13, 2023
90a67a9
Testing
AndreaQuerio Jan 13, 2023
5f6b903
Testing
AndreaQuerio Jan 13, 2023
afc31f9
Testing
AndreaQuerio Jan 13, 2023
58d9dcd
Testing
AndreaQuerio Jan 13, 2023
a0b456f
Testing
AndreaQuerio Jan 13, 2023
ed5f315
Testing
AndreaQuerio Jan 13, 2023
fb2f456
Testing
AndreaQuerio Jan 13, 2023
ceff0fc
Testing
AndreaQuerio Jan 13, 2023
58c19fe
Testing
AndreaQuerio Jan 13, 2023
dd84aee
Testing
AndreaQuerio Jan 13, 2023
adde699
Testing
AndreaQuerio Jan 13, 2023
85b8407
Testing
AndreaQuerio Jan 13, 2023
e1c1214
Testing
AndreaQuerio Jan 13, 2023
23ca165
Testing
AndreaQuerio Jan 13, 2023
ce2f624
Testing
AndreaQuerio Jan 13, 2023
e08a737
Testing
AndreaQuerio Jan 13, 2023
9317999
Testing
AndreaQuerio Jan 13, 2023
6e1f341
Testing
AndreaQuerio Jan 13, 2023
dc03695
Testing
AndreaQuerio Jan 13, 2023
e8082dd
Testing
AndreaQuerio Jan 13, 2023
4454843
Testing
AndreaQuerio Jan 13, 2023
0a3bba3
Testing
AndreaQuerio Jan 13, 2023
ee3dbb7
Testing
AndreaQuerio Jan 13, 2023
3f6fefc
Testing
AndreaQuerio Jan 13, 2023
686877b
Testing
AndreaQuerio Jan 13, 2023
71571a0
Testing
AndreaQuerio Jan 13, 2023
abe5ad4
Testing
AndreaQuerio Jan 13, 2023
9807a63
Testing
AndreaQuerio Jan 13, 2023
8a0fcaa
Testing
AndreaQuerio Jan 13, 2023
99290f0
Testing
AndreaQuerio Jan 13, 2023
e502ccc
Testing
AndreaQuerio Jan 13, 2023
ce5be0d
Correct reconstruct_log_norm_dist
AndreaQuerio Jan 18, 2023
79c403f
Changes
AndreaQuerio Jan 20, 2023
0e0b1b4
Changes
AndreaQuerio Jan 20, 2023
fe30515
Change setup.py
AndreaQuerio Jan 20, 2023
b54d842
Change setup.py
AndreaQuerio Jan 20, 2023
2be74e6
Remove docker_install.sh
AndreaQuerio Jan 20, 2023
d498124
Cahnges packageinfo.py
AndreaQuerio Jan 20, 2023
1a30e36
Change Dockerfile
AndreaQuerio Jan 23, 2023
3e08b7d
Changes
AndreaQuerio Jan 24, 2023
cc4a14b
Correction
AndreaQuerio Jan 24, 2023
af1bb91
Correction
AndreaQuerio Jan 24, 2023
15b4381
Corrections
AndreaQuerio Jan 24, 2023
ba0ba29
Correction
AndreaQuerio Jan 24, 2023
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
33 changes: 21 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
ARG OSP_CORE_IMAGE=simphony/osp-core:latest
FROM $OSP_CORE_IMAGE
FROM ubuntu:20.04
LABEL maintainer="mohsen.shiea@polito.it"
LABEL dockerfile.version="1.1"

ENV DEBIAN_FRONTEND=noninteractive

# Install requirements
RUN apt-get update && apt-get -y upgrade && apt-get install -y \
git graphviz wget build-essential g++ gfortran libgfortran5 openmpi-bin libopenmpi-dev make libssl-dev libblas-dev liblapack-dev \
apt-transport-https software-properties-common openssh-client bash-completion bash-builtins libnss-wrapper vim nano tree curl unzip
git graphviz wget build-essential g++ gfortran libgfortran5 openmpi-bin \
libopenmpi-dev make libssl-dev libblas-dev liblapack-dev \
apt-transport-https software-properties-common openssh-client \
bash-completion bash-builtins libnss-wrapper vim nano tree curl unzip \
python3-pip

RUN wget -c https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh && \
/bin/bash Anaconda3-2020.02-Linux-x86_64.sh -bfp /usr/local && \
conda update conda && conda create --name wet-synthesis

RUN conda install mkl-service

RUN cd / && mkdir cmake && cd cmake && \
CMAKE_VERSION=3.20.1 && \
Expand All @@ -29,10 +39,9 @@ RUN cd / && mkdir sundials && cd sundials && \
make install && \
cd .. && rm -r builddir cvode-${CVODE_VERSION} cvode-${CVODE_VERSION}.tar.gz

RUN cd /usr/bin && rm python3 && ln -s python3.6 python3 && \
wget -O - http://dl.openfoam.org/gpg.key | apt-key add - && add-apt-repository http://dl.openfoam.org/ubuntu && \
RUN wget -O - http://dl.openfoam.org/gpg.key | apt-key add - && add-apt-repository http://dl.openfoam.org/ubuntu && \
apt-get update && apt-get install -y --no-install-recommends openfoam8 && \
cd /usr/bin && rm python3 && ln -s python3.7 python3 && rm -rf /var/lib/apt/lists/*
rm -rf /var/lib/apt/lists/*

ENV user=simdomeuser HOME=/home/simdomeuser

Expand All @@ -52,10 +61,10 @@ RUN mkdir -p $HOME/simdome/wrappers/simdome_wet_synthesis && \
COPY --chown=$user . $HOME/simdome/wrappers/simdome_wet_synthesis
WORKDIR $HOME/simdome/wrappers/simdome_wet_synthesis

ENV PATH=$PATH:$HOME/.local/bin
ENV PATH=$HOME/.local/bin:$PATH

RUN pip install matplotlib scipy \
&& pico install ontology.wet_synthesis.yml \
&& python setup.py install --user
RUN pip install matplotlib scipy numpy sklearn mpi4py
RUN pip install .
RUN pico install ontology.wet_synthesis.yml

CMD ["/bin/bash", "-c", "source /opt/openfoam8/etc/bashrc && /bin/bash" ]
CMD ["/bin/bash", "-c", "source /opt/openfoam8/etc/bashrc && /bin/bash && source activate wet-synthesis" ]
37 changes: 0 additions & 37 deletions docker_install.sh

This file was deleted.

5 changes: 2 additions & 3 deletions examples/cfd_pbe_precNMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from osp.core.utils import pretty_print
from osp.core.utils import Cuds2dot

print('Hello')

def main(argv):

Expand Down Expand Up @@ -108,9 +109,7 @@ def main(argv):
session.run()

pretty_print(wrapper.get(oclass=wet_synthesis.SizeDistribution)[0])

plot_size_dist(
wrapper.get(oclass=wet_synthesis.SizeDistribution)[0])
plot_size_dist(wrapper.get(oclass=wet_synthesis.SizeDistribution)[0])

except Exception as e:
print(e)
Expand Down
137 changes: 103 additions & 34 deletions examples/compartment_precNMC.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,128 @@
# Example to use compartment wrapper
import sys
import numpy as np
import traceback
import argparse
import matplotlib.pyplot as plt

from osp.wrappers.wet_synthesis_wrappers import CompartmentSession
from osp.wrappers.wet_synthesis_wrappers.utils import plot_size_dist
from osp.core.namespaces import wet_synthesis
from osp.core.utils import pretty_print
from osp.core.utils import Cuds2dot


# create a wrapper session and run it
with CompartmentSession(
engine="fluent", case="precNMC", delete_simulation_files=False,
end_time=10) as session:
wrapper = wet_synthesis.WetSynthesisWrapper(session=session)
def main(argv):

accuracy_level = wet_synthesis.SliderAccuracyLevel(number=1)
wrapper.add(accuracy_level)
parser = argparse.ArgumentParser(description='Process command-line inputs')

pressure = wet_synthesis.Pressure(value=101325, unit='Pa')
wrapper.add(pressure)
parser.add_argument('--delete', action='store_true')
parser.add_argument('--dummy', action='store_true')
parser.add_argument('-n', '--numproc', type=int, default=1)
parser.add_argument('-t', '--endtime', type=float, default=None)
parser.add_argument('-w', '--writeinterval', type=int, default=None)

rotationalSpeed = wet_synthesis.RotationalSpeed(value=-1005, unit='rpm')
wrapper.add(rotationalSpeed)
args, _ = parser.parse_known_args(argv)

metal_flowRate = wet_synthesis.FlowRate(value=2.1977, unit='lit/hr')
nh3_flowRate = wet_synthesis.FlowRate(value=0.2184, unit='lit/hr')
naoh_flowRate = wet_synthesis.FlowRate(value=0.9171, unit='lit/hr')
# create a wrapper session and run it
with CompartmentSession(
engine="pisoPrecNMC", case="precNMC",
delete_simulation_files=args.delete, end_time=args.endtime,
write_interval=args.writeinterval, num_moments=4,
num_proc=args.numproc, dummy=args.dummy) as session:

metalFeed = wet_synthesis.Feed(name='metals')
nh3Feed = wet_synthesis.Feed(name='nh3')
naohFeed = wet_synthesis.Feed(name='naoh')
wrapper = wet_synthesis.WetSynthesisWrapper(session=session)

metalFeed.add(metal_flowRate, rel=wet_synthesis.hasPart)
accuracy_level = wet_synthesis.SliderAccuracyLevel(number=0)
wrapper.add(accuracy_level)

nh3Feed.add(nh3_flowRate, rel=wet_synthesis.hasPart)
pressure = wet_synthesis.Pressure(value=101325, unit='Pa')
wrapper.add(pressure)

naohFeed.add(naoh_flowRate, rel=wet_synthesis.hasPart)
temperature = wet_synthesis.Temperature(value=298.15, unit='K')
wrapper.add(temperature)

wrapper.add(metalFeed)
wrapper.add(nh3Feed)
wrapper.add(naohFeed)
rotationalSpeed = wet_synthesis.RotationalSpeed(value=200, unit='rpm')
wrapper.add(rotationalSpeed)

Cuds2dot(wrapper).render()
density = wet_synthesis.Density(value=3953, unit='kg/m^3')
molecularWeight = wet_synthesis.MolecularWeight(
value=92.338, unit='g/mol')
shapeFactor = wet_synthesis.ShapeFactor(value=0.523599, unit='')

compartmentNetwork = wet_synthesis.CompartmentNetwork()
wrapper.add(compartmentNetwork)
solidParticle = wet_synthesis.SolidParticle()
solidParticle.add(density, rel=wet_synthesis.hasProperty)
solidParticle.add(molecularWeight, rel=wet_synthesis.hasProperty)
solidParticle.add(shapeFactor, rel=wet_synthesis.hasProperty)
wrapper.add(solidParticle)

pretty_print(wrapper.get(oclass=wet_synthesis.CompartmentNetwork)[0])
ni_conc = wet_synthesis.MolarConcentration(value=1.6, unit='mol/lit')
mn_conc = wet_synthesis.MolarConcentration(value=0.2, unit='mol/lit')
co_conc = wet_synthesis.MolarConcentration(value=0.2, unit='mol/lit')
so4_conc = wet_synthesis.MolarConcentration(value=2.0, unit='mol/lit')
nh3_conc = wet_synthesis.MolarConcentration(value=10, unit='mol/lit')
na_conc = wet_synthesis.MolarConcentration(value=5, unit='mol/lit')

try:
# run the session
session.run()
ni = wet_synthesis.Component(name='nickel')
mn = wet_synthesis.Component(name='manganese')
co = wet_synthesis.Component(name='cobalt')
so4 = wet_synthesis.Component(name='so4')
nh3 = wet_synthesis.Component(name='nh3')
na = wet_synthesis.Component(name='na')

ni.add(ni_conc, rel=wet_synthesis.hasPart)
mn.add(mn_conc, rel=wet_synthesis.hasPart)
co.add(co_conc, rel=wet_synthesis.hasPart)
so4.add(so4_conc, rel=wet_synthesis.hasPart)
nh3.add(nh3_conc, rel=wet_synthesis.hasPart)
na.add(na_conc, rel=wet_synthesis.hasPart)

metal_flowRate = wet_synthesis.FlowRate(value=1.5330924, unit='lit/hr')
nh3_flowRate = wet_synthesis.FlowRate(value=0.30666132, unit='lit/hr')
naoh_flowRate = wet_synthesis.FlowRate(value=1.226646, unit='lit/hr')

metalFeed = wet_synthesis.Feed(name='metals')
nh3Feed = wet_synthesis.Feed(name='nh3')
naohFeed = wet_synthesis.Feed(name='naoh')

metalFeed.add(ni, mn, co, so4, rel=wet_synthesis.hasPart)
metalFeed.add(metal_flowRate, rel=wet_synthesis.hasPart)

nh3Feed.add(nh3, rel=wet_synthesis.hasPart)
nh3Feed.add(nh3_flowRate, rel=wet_synthesis.hasPart)

naohFeed.add(na, rel=wet_synthesis.hasPart)
naohFeed.add(naoh_flowRate, rel=wet_synthesis.hasPart)

wrapper.add(metalFeed)
wrapper.add(nh3Feed)
wrapper.add(naohFeed)

Cuds2dot(wrapper).render()

sizeDistribution = wet_synthesis.SizeDistribution()
wrapper.add(sizeDistribution)
compartmentNetwork = wet_synthesis.CompartmentNetwork()
wrapper.add(compartmentNetwork)

pretty_print(wrapper.get(oclass=wet_synthesis.SizeDistribution)[0])
pretty_print(wrapper.get(oclass=wet_synthesis.CompartmentNetwork)[0])

except Exception as e:
print(e)
traceback.print_exc()
# session._delete_simulation_files = True
try:
# run the session
session.run()

pretty_print(wrapper.get(oclass=wet_synthesis.SizeDistribution)[0])
plot_size_dist(wrapper.get(oclass=wet_synthesis.SizeDistribution)[0])

pretty_print(wrapper.get(oclass=wet_synthesis.CompartmentNetwork)[0])

except Exception as e:
print(e)
traceback.print_exc()
# session._delete_simulation_files = True


if __name__ == "__main__":

main(sys.argv[1:])
120 changes: 0 additions & 120 deletions examples/test_compartment_precNMC.py

This file was deleted.

Loading