Beispiel #1
0
void Spheres::makePores() {

    for (int i=0; i < m_numberOfPores; i++) {

        // center of random sphere
        vec3 sphereCenter;
        sphereCenter[0] = Random::nextDouble()*m_system->systemSize().x();
        sphereCenter[1] = Random::nextDouble()*m_system->systemSize().y();
        sphereCenter[2] = Random::nextDouble()*m_system->systemSize().z();

        // random radius 2nm-3nm
        double sphereRadius = m_radius0 + Random::nextDouble()*(m_radius1 - m_radius0);
        std::cout << sphereRadius << std::endl;

        // freeze all atoms inside sphere
        for (Atom *atom : m_system->atoms()) {
            vec3 dr = atom->position - sphereCenter;
            double distanceFromCenter = dr.length();

            if (distanceFromCenter < sphereRadius) {
                atom->setMovingAtom(false);
                atom->setName("NM");
            }
        }
    }
    computePorosity();
    halfDensity();
}
    /// @brief Computes total absorbed polymer mass over all grid cells.
    /// With compressibility
    /// @param[in]  grid      grid
    /// @param[in]  props     fluid and rock properties.
    /// @param[in]  polyprops polymer properties
    /// @param[in]  state     fluid state variable
    /// @param[in]  rock_comp rock compressibility (depends on pressure)
    /// @return               total absorbed polymer mass.
    double computePolymerAdsorbed(const UnstructuredGrid& grid,
                                  const BlackoilPropertiesInterface& props,
                                  const Opm::PolymerProperties& polyprops,
                                  const PolymerBlackoilState& state,
                                  const RockCompressibility* rock_comp
                                  )
    {
	const int num_cells = props.numCells();
        const double rhor = polyprops.rockDensity();
        std::vector<double> porosity;
        if (rock_comp && rock_comp->isActive()) {
            computePorosity(grid, props.porosity(), *rock_comp, state.pressure(), porosity);
        } else {
            porosity.assign(props.porosity(), props.porosity() + num_cells);
        }
        double abs_mass = 0.0;
        const std::vector<double>& cmax = state.getCellData( state.CMAX );
	for (int cell = 0; cell < num_cells; ++cell) {
            double c_ads;
            polyprops.simpleAdsorption(cmax[cell], c_ads);
            abs_mass += c_ads*grid.cell_volumes[cell]*(1.0 - porosity[cell])*rhor;
	}
        return abs_mass;
    }