Skip to content

Natural Convection Example #164

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Nov 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
f1cd10a
Added natural convection example.
BryanRumsey Sep 15, 2021
dc2b646
Fixed namespace conflict.
BryanRumsey Sep 16, 2021
7b21f5c
Updated the example better fit the paper and lammp file.
BryanRumsey Oct 1, 2021
597c699
Updates to example notebook
BryanRumsey Oct 4, 2021
4401a78
Merge branch 'develop' of https://github.com/spatialpy/SpatialPy into…
BryanRumsey Oct 7, 2021
33d02ad
Final updates to the Natural Convection example.
BryanRumsey Oct 7, 2021
a215842
Merge branch 'develop' of github.com:stochss/SpatialPy into natural-c…
briandrawert Oct 11, 2021
7d9c571
Added Buoyancy Force for Natural_Convection
briandrawert Oct 12, 2021
cdce514
Resolved merge conflicts
briandrawert Oct 12, 2021
b145104
Merge branch 'tspan-fix' of github.com:stochss/SpatialPy into natural…
briandrawert Oct 12, 2021
8b7dfae
Fixed BouyancyForce to work on force
briandrawert Oct 12, 2021
b9f97f7
Debuggnig the infinite loop error in the NRM
briandrawert Oct 15, 2021
a101752
slight update to notebook
briandrawert Oct 15, 2021
d306dd9
Merge branch 'tspan-fix' of github.com:stochss/SpatialPy into natural…
briandrawert Oct 15, 2021
2ecdc2c
Merge branch 'develop' of github.com:stochss/SpatialPy into natural-c…
briandrawert Oct 18, 2021
057be80
Fixing the [-Wreorder] warnings
briandrawert Oct 19, 2021
f8c3f8f
Bug found: need to .clear() theHashTable on each build()
briandrawert Oct 20, 2021
f042242
cleaned up debugging statements
briandrawert Oct 20, 2021
a0be1f7
cleaned up debugging statements
briandrawert Oct 20, 2021
0359d2c
Natural Convection Notebook seems to be working
briandrawert Oct 20, 2021
f411d7b
Full run of notebook
briandrawert Oct 21, 2021
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
551 changes: 551 additions & 0 deletions examples/Natural_Convection/Natural_Convection.ipynb

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions spatialpy/Solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,22 +500,22 @@ def __create_propensity_file(self, file_name=None):
outstr += "};"
input_constants += outstr + "\n"

outstr = "static double input_data_fn[{0}] = ".format(len(self.model.listOfDataFunctions)*ncells)
outstr += "{"
for ndf, df in enumerate(self.model.listOfDataFunctions):
for i in range(ncells):
if i > 0 and ndf==0:
outstr += ','
c = self.model.domain.coordinates()
outstr += str(df.map( [c[i,0],c[i,1],c[i,2]] ))
outstr += "};"
input_constants += outstr + "\n"
if len(self.model.listOfDataFunctions)>0:
outstr = "static double input_data_fn[{0}] = ".format(len(self.model.listOfDataFunctions)*ncells)
outstr += "{"
for ndf, df in enumerate(self.model.listOfDataFunctions):
for i in range(ncells):
if i > 0 and ndf==0:
outstr += ','
c = self.model.domain.coordinates()
outstr += str(df.map( [c[i,0],c[i,1],c[i,2]] ))
outstr += "};"
input_constants += outstr + "\n"
else:
input_constants += "static int input_N_dense[0] = {};\n"
input_constants += "static size_t input_irN[0] = {};\n"
input_constants += "static size_t input_jcN[0] = {};\n"
input_constants += "static int input_prN[0] = {};\n"
input_constants += "static double input_data_fn[0] = {};\n"

G = self.model._create_dependency_graph()
outstr = "static size_t input_irG[{0}] = ".format(len(G.indices))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ namespace Spatialpy{
double previousFiringTime; //keep the time of the last reaction that fired (from last call of selectReaction)

//these two could be combined
//std::vector<firingTimeT> nextFiringTime;//for each reaction channel
//std::vector<std::pair<int,int> > binIndexAndPositionInBin;//for each reaction channel
std::unordered_map<reactionIndexT,firingTimeT> nextFiringTime;
std::unordered_map<reactionIndexT,std::pair<int,int> > binIndexAndPositionInBin; //for each reaction channel

Expand Down
14 changes: 6 additions & 8 deletions spatialpy/ssa_sdpd-c-simulation-engine/include/particle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace Spatialpy{
struct EventNode;

struct Particle{
Particle(ParticleSystem *sys, unsigned int id=0, double x=0, double y=0, double z=0,
int type=0, double nu=0.01, double mass=1, double c=0,
Particle(ParticleSystem *sys, unsigned int id=0, double xl=0, double yl=0,
double zl=0, int type=0, double nu=0.01, double mass=1, double c=0,
double rho=1, int solidTag=0);
ParticleSystem *sys;
unsigned int id;
Expand All @@ -53,10 +53,10 @@ namespace Spatialpy{
double x[3];
double v[3];
double vt[3];
double mass;
double rho;
double nu;
double mass;
double c;
double rho;
int solidTag;
double bvf_phi;
double normal[3];
Expand All @@ -68,10 +68,8 @@ namespace Spatialpy{
//std::shared_ptr<double[]> data_fn;
// chem_rxn_system
unsigned int*xx; // populaion of discrete/stochastic species
double *C;
double *Q;
//std::shared_ptr<double[]> C; // concentration of chem species
//std::shared_ptr<double[]> Q; // flux of chem species
double *C; // concentration of chem species
double *Q; // flux of chem species
// below here for simulation
std::vector<NeighborNode> neighbors;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ namespace Spatialpy{
char boundary_conditions[3];
bool static_domain;
size_t num_types;
size_t num_data_fn;

ChemRxnFun* chem_rxn_rhs_functions;
size_t num_chem_species;
Expand All @@ -91,6 +90,7 @@ namespace Spatialpy{
PropensityFun* stoch_rxn_propensity_functions;
size_t num_stoch_species;
size_t num_stoch_rxns;
size_t num_data_fn;

const char * const* species_names;

Expand Down
Loading