Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuhao Liu
ogs
Commits
0f4a8465
Commit
0f4a8465
authored
3 years ago
by
renchao.lu
Browse files
Options
Downloads
Patches
Plain Diff
[CL] create MoleBasedSurfaceSite.
parent
e2301f2b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ChemistryLib/PhreeqcIOData/CreateSurface.cpp
+52
-21
52 additions, 21 deletions
ChemistryLib/PhreeqcIOData/CreateSurface.cpp
ChemistryLib/PhreeqcIOData/CreateSurface.h
+11
-3
11 additions, 3 deletions
ChemistryLib/PhreeqcIOData/CreateSurface.h
with
63 additions
and
24 deletions
ChemistryLib/PhreeqcIOData/CreateSurface.cpp
+
52
−
21
View file @
0f4a8465
...
...
@@ -8,48 +8,79 @@
*
*/
#include
<optional>
#include
"CreateSurface.h"
#include
"BaseLib/ConfigTree.h"
#include
"MeshLib/Mesh.h"
#include
"Surface.h"
namespace
ChemistryLib
{
namespace
PhreeqcIOData
{
std
::
vector
<
SurfaceSite
>
createSurface
(
std
::
optional
<
BaseLib
::
ConfigTree
>
const
&
config
)
std
::
vector
<
std
::
variant
<
DensityBasedSurfaceSite
,
MoleBasedSurfaceSite
>>
createSurface
(
std
::
optional
<
BaseLib
::
ConfigTree
>
const
&
config
,
MeshLib
::
Mesh
&
mesh
)
{
if
(
!
config
)
{
return
{};
}
std
::
vector
<
SurfaceSite
>
surface
;
for
(
auto
const
&
site_config
:
//! \ogs_file_param{prj__chemical_system__surface__site}
config
->
getConfigSubtreeList
(
"site"
))
std
::
vector
<
std
::
variant
<
DensityBasedSurfaceSite
,
MoleBasedSurfaceSite
>>
surface
;
auto
const
surface_site_unit
=
//! \ogs_file_attr{prj__chemical_system__surface__site_unit}
config
->
getConfigAttribute
<
std
::
string
>
(
"site_unit"
,
"mole"
);
if
(
surface_site_unit
==
"density"
)
{
//! \ogs_file_param{prj__chemical_system__surface__site__name}
auto
name
=
site_config
.
getConfigParameter
<
std
::
string
>
(
"name"
);
for
(
auto
const
&
site_config
:
//! \ogs_file_param{prj__chemical_system__surface__site}
config
->
getConfigSubtreeList
(
"site"
))
{
//! \ogs_file_param{prj__chemical_system__surface__site__name}
auto
name
=
site_config
.
getConfigParameter
<
std
::
string
>
(
"name"
);
auto
const
site_density
=
//! \ogs_file_param{prj__chemical_system__surface__site__site_density}
site_config
.
getConfigParameter
<
double
>
(
"site_density"
);
auto
const
specific_surface_area
=
//! \ogs_file_param{prj__chemical_system__surface__site__specific_surface_area}
site_config
.
getConfigParameter
<
double
>
(
"specific_surface_area"
);
auto
const
mass
=
//! \ogs_file_param{prj__chemical_system__surface__site__mass}
site_config
.
getConfigParameter
<
double
>
(
"mass"
);
auto
const
site_density
=
//! \ogs_file_param{prj__chemical_system__surface__site__site_density}
site_config
.
getConfigParameter
<
double
>
(
"site_density"
);
surface
.
push_back
(
DensityBasedSurfaceSite
(
std
::
move
(
name
),
site_density
,
specific_surface_area
,
mass
));
}
return
surface
;
}
if
(
surface_site_unit
==
"mole"
)
{
for
(
auto
const
&
site_config
:
//! \ogs_file_param{prj__chemical_system__surface__site}
config
->
getConfigSubtreeList
(
"site"
))
{
//! \ogs_file_param{prj__chemical_system__surface__site__name}
auto
name
=
site_config
.
getConfigParameter
<
std
::
string
>
(
"name"
);
auto
const
specific_surface_area
=
//! \ogs_file_param{prj__chemical_system__surface__site__specific_surface_area}
site_config
.
getConfigParameter
<
double
>
(
"specific_surface_area"
);
auto
const
molality
=
MeshLib
::
getOrCreateMeshProperty
<
double
>
(
mesh
,
name
,
MeshLib
::
MeshItemType
::
IntegrationPoint
,
1
);
auto
const
mass
=
//! \ogs_file_param{prj__chemical_system__surface__site__mass}
site_config
.
getConfigParameter
<
double
>
(
"mass"
);
surface
.
push_back
(
MoleBasedSurfaceSite
(
std
::
move
(
name
),
molality
));
}
surface
.
emplace_back
(
std
::
move
(
name
),
site_density
,
specific_surface_area
,
mass
);
return
surface
;
}
return
surface
;
OGS_FATAL
(
"Surface site unit should be either of 'density' or 'mole'."
)
;
}
}
// namespace PhreeqcIOData
}
// namespace ChemistryLib
This diff is collapsed.
Click to expand it.
ChemistryLib/PhreeqcIOData/CreateSurface.h
+
11
−
3
View file @
0f4a8465
...
...
@@ -11,6 +11,7 @@
#pragma once
#include
<optional>
#include
<variant>
#include
<vector>
namespace
BaseLib
...
...
@@ -18,13 +19,20 @@ namespace BaseLib
class
ConfigTree
;
}
namespace
MeshLib
{
class
Mesh
;
}
namespace
ChemistryLib
{
namespace
PhreeqcIOData
{
struct
SurfaceSite
;
struct
DensityBasedSurfaceSite
;
struct
MoleBasedSurfaceSite
;
std
::
vector
<
SurfaceSite
>
createSurface
(
std
::
optional
<
BaseLib
::
ConfigTree
>
const
&
config
);
std
::
vector
<
std
::
variant
<
DensityBasedSurfaceSite
,
MoleBasedSurfaceSite
>>
createSurface
(
std
::
optional
<
BaseLib
::
ConfigTree
>
const
&
config
,
MeshLib
::
Mesh
&
mesh
);
}
// namespace PhreeqcIOData
}
// namespace ChemistryLib
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment