Skip to content
Snippets Groups Projects
Commit 60c61359 authored by Ned Coltman's avatar Ned Coltman
Browse files

Merge branch 'feature/fixRandomConstPoro' into 'master'

Random-ConstantPorosity Geometry Algorithm

Closes #1

See merge request !4
parents a240efe6 c3f864bf
No related branches found
No related tags found
1 merge request!4Random-ConstantPorosity Geometry Algorithm
...@@ -123,7 +123,8 @@ void buildRandomConstantPorosityPoreGeometry(PoreBlockList& poreBlockList, ...@@ -123,7 +123,8 @@ void buildRandomConstantPorosityPoreGeometry(PoreBlockList& poreBlockList,
volumeSize[0] = (porousMediaBox.second[0] - porousMediaBox.first[0]) / numVolumes[0]; volumeSize[0] = (porousMediaBox.second[0] - porousMediaBox.first[0]) / numVolumes[0];
volumeSize[1] = (porousMediaBox.second[1] - porousMediaBox.first[1]) / numVolumes[1]; volumeSize[1] = (porousMediaBox.second[1] - porousMediaBox.first[1]) / numVolumes[1];
const Scalar volumeLength = volumeSize[1]; const Scalar volumeLength = volumeSize[1];
const Scalar poreLength = std::sqrt(volumeLength * volumeLength - (volumeLength * volumeLength * porosity)); const Scalar poreLength = std::sqrt(volumeLength * volumeLength * (1 - porosity));
const Scalar boxOffset = volumeLength - poreLength;
for (int i = 0; i < numVolumes[0]; i++) for (int i = 0; i < numVolumes[0]; i++)
{ {
...@@ -134,8 +135,8 @@ void buildRandomConstantPorosityPoreGeometry(PoreBlockList& poreBlockList, ...@@ -134,8 +135,8 @@ void buildRandomConstantPorosityPoreGeometry(PoreBlockList& poreBlockList,
poreBlock.gridBoxMin[1] = porousMediaBox.first[1] + (volumeSize[1] * j); poreBlock.gridBoxMin[1] = porousMediaBox.first[1] + (volumeSize[1] * j);
poreBlock.gridBoxMax[0] = porousMediaBox.first[0] + (volumeSize[0] * (i+1)); poreBlock.gridBoxMax[0] = porousMediaBox.first[0] + (volumeSize[0] * (i+1));
poreBlock.gridBoxMax[1] = porousMediaBox.first[1] + (volumeSize[1] * (j+1)); poreBlock.gridBoxMax[1] = porousMediaBox.first[1] + (volumeSize[1] * (j+1));
poreBlock.centerPoint[0] = (poreBlock.gridBoxMax[0] + poreBlock.gridBoxMin[0]) / 2.0; poreBlock.centerPoint[0] = (boxOffset + poreBlock.gridBoxMin[0]);
poreBlock.centerPoint[1] = (poreBlock.gridBoxMax[1] + poreBlock.gridBoxMin[1]) / 2.0; poreBlock.centerPoint[1] = (boxOffset + poreBlock.gridBoxMin[1]);
double r1 = ( (double) std::rand() / (RAND_MAX)); double r1 = ( (double) std::rand() / (RAND_MAX));
poreBlock.poreBlockMin[0] = poreBlock.gridBoxMin[0] + ((poreBlock.centerPoint[0] - poreBlock.gridBoxMin[0]) * r1); poreBlock.poreBlockMin[0] = poreBlock.gridBoxMin[0] + ((poreBlock.centerPoint[0] - poreBlock.gridBoxMin[0]) * r1);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment