Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F86284050
variables_interface.hpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Oct 5, 13:24
Size
5 KB
Mime Type
text/x-c++
Expires
Mon, Oct 7, 13:24 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
21391861
Attached To
rSPECMICP SpecMiCP / ReactMiCP
variables_interface.hpp
View Options
/* =============================================================================
Copyright (c) 2014-2017 F. Georget <fabieng@princeton.edu> Princeton University
Copyright (c) 2017 F. Georget <fabien.georget@epfl.ch> EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
============================================================================= */
#ifndef REACTMICP_CHLORIDE_VARIABLESINTERFACE_HPP
#define REACTMICP_CHLORIDE_VARIABLESINTERFACE_HPP
#include "specmicp_common/types.hpp"
#include <memory>
#include "variables.hpp"
#include "specmicp_database/database_holder.hpp"
namespace
specmicp
{
namespace
reactmicp
{
namespace
systems
{
namespace
chloride
{
class
SPECMICP_DLL_PUBLIC
ChlorideVariablesInterface:
public
database
::
DatabaseHolder
,
public
units
::
UnitBaseClass
{
public
:
ChlorideVariablesInterface
(
RawDatabasePtr
adata
,
mesh
::
Mesh1DPtr
amesh
,
const
units
::
UnitsSet
&
tunits
);
// other data
ChlorideVariablesPtr
get_variables
()
{
return
m_vars
;
}
ChlorideVariables
*
get_raw_variables
()
{
return
m_vars
.
get
();
}
mesh
::
Mesh1DPtr
get_mesh
()
{
return
m_mesh
;}
// Main variables
//! \brief Set the adimensional solutions and related variables
//!
//! Also set the main variables, porosity, and inert volume fraction
void
set_adim_solutions
(
std
::
vector
<
index_t
>
indices
,
std
::
vector
<
AdimensionalSystemSolution
>
solutions
);
//! \brief Set the fluid velocity
void
set_fluid_velocity
(
scalar_t
fluid_vel
);
// Diffusion
// =========
//! \brief Diffusion coefficient of components in a water
//!
//! The size of vec_diff must be the number of components
//! (all not just aqueous components)
void
set_diffusion_coefficient_components
(
Vector
&
vec_diff
)
{
specmicp_assert
(
vec_diff
.
rows
()
==
m_data
->
nb_component
());
m_vars
->
m_intrinsic_diffusion_i
=
vec_diff
;
}
//! \brief Diffusion coefficient of a component in a water
void
set_diffusion_coefficient_component
(
std
::
string
label
,
scalar_t
value
)
{
m_vars
->
m_intrinsic_diffusion_i
(
get_database
()
->
get_id_component
(
label
))
=
value
;
}
//! \brief Diffusion coefficient of a component in a water
void
set_diffusion_coefficient_component
(
index_t
i
,
scalar_t
value
)
{
m_vars
->
m_intrinsic_diffusion_i
(
i
)
=
value
;
}
//! \brief Set the default value for the diffusion coefficients of the component
void
set_default_diffusion_coefficient_component
(
scalar_t
value
);
//! \brief Diffusion coefficient of aqueous species in a water
//!
//! The size of vec_diff must be the number of secondary aqueous species
void
set_diffusion_coefficient_aqueous
(
Vector
&
vec_diff
)
{
specmicp_assert
(
vec_diff
.
rows
()
==
m_data
->
nb_aqueous
());
m_vars
->
m_intrinsic_diffusion_j
=
vec_diff
;
}
//! \brief Diffusion coefficient of an aqueous species in a water
void
set_diffusion_coefficient_aqueous
(
index_t
j
,
scalar_t
value
)
{
m_vars
->
m_intrinsic_diffusion_j
(
j
)
=
value
;
}
//! \brief Diffusion coefficient of an aqueous species in a water
void
set_diffusion_coefficient_aqueous
(
std
::
string
label
,
scalar_t
value
)
{
m_vars
->
m_intrinsic_diffusion_j
(
get_database
()
->
get_id_aqueous
(
label
))
=
value
;
}
//! \brief Set the default value for the diffusion coefficients of the aq. species
void
set_default_diffusion_coefficient_aqueous
(
scalar_t
value
);
//! \brief Set the resistance factors
//!
//! The size of 'vec_res' must be the number of nodes
void
set_diffusion_resistance_factors
(
Vector
&
vec_res
)
{
specmicp_assert
(
vec_res
.
rows
()
==
m_mesh
->
nb_nodes
());
m_vars
->
m_resistance_factor
=
vec_res
;
}
//! \brief Set the resistance factor for a node
void
set_diffusion_resistance_factor
(
index_t
node
,
scalar_t
value
)
{
m_vars
->
m_resistance_factor
(
node
)
=
value
;
}
//! \brief Set the default resistance factor
void
set_default_diffusion_resistance_factor
(
scalar_t
value
);
//! \brief Set the potential
void
set_potential
(
index_t
node
,
scalar_t
value
);
private
:
mesh
::
Mesh1DPtr
m_mesh
;
std
::
shared_ptr
<
ChlorideVariables
>
m_vars
{
nullptr
};
void
init_storage
(
index_t
nnp
,
index_t
ndof
);
void
set_from_adim_solution
(
index_t
node
,
const
AdimensionalSystemSolution
&
solution
);
};
}
// namespace chloride
}
// namespace systems
}
// namespace reactmicp
}
// namespace specmicp
#endif
// REACTMICP_CHLORIDE_VARIABLESINTERFACE_HPP
Event Timeline
Log In to Comment