Hi all, I have some questions when I read one of the prj file in TH2M modules’ benchmark which link is the following: TH2M benchmark
I found there the code of jacobian_assembler part is just like:
I know that the compoenet_magnitudes represents the representative magnitudes for the components of the solution vector of the process being assembled, which can be accessed from https://doxygen.opengeosys.org/d1/dd2/ogs_file_param__prj__processes__process__jacobian_assembler__centraldifferences__component_magnitudes
But why are there four or eight values for each vector since pressure and temperature are actually scalars? I think there should be only one value for either of them. Second, how to define these magnitudes for all components in this part that looks like a matrix? I read some examples but didn’t figure it out. Can anyone tell me the pattern?
I will appreciate it a lot if anyone can give me some help.
Hi, in the example you posted above you are on a 2D quad mesh with Taylor-Hood finite elements. It’s 2D, so displacement has 2 components (ux, uy). You are running a TH2M process with primary unknowns pG, pL, T, ux, uy (I’m not 100% sure about the order of pressures pG, pL or pL, pG). Each unknown corresponds to a line in your example.
The mesh consists of 2nd order quad elements with 8 nodes in total, thereof 4 corner nodes.
Displacements ux and uy are defined on all 8 nodes, pressures and temperature only on the corner nodes (“base nodes” in OGS lingo). Therefore (Taylor-Hood elements), the lines in your example have different numbers of entries.
In summary, you have to prescribe a component magnitude and a relative epsilon for every nodal degree of freedom on the mesh element. Order matters.
The documentation you are referring to is a bit misleading in that regard. The documentation is correct for the simpler case of all primary unknowns being defined on all nodes of the mesh element. For Taylor-Hood elements, however, you have to specify the full-blown input like in your example.
Note: There is no safety net, here. If you specify magnitudes and epsilons in the wrong order or a wrong number of them or change the element types of your mesh, it’s very likely that OGS will not notice the mistake.
Hi Mr.chleh
Thanks for your reply very much! That’s very nice of you to make it so clear that I can totally understand. Now I have some other questions about the codes of prj files in the TH2M module. I hope you could help me.
First, how to determine the values for each component_magnitude and relative_epsilons in the input? Maybe there are some standards which has to do with my parameter settings in prj, I am not sure.
Second, is it possible to add a pressure source term which represents a certain injection or production rate in TH2M module? Since there are two separate process-variables block for pressure(Pg and Pc), which is different from the single variable block( pressure P) in THM module, I have no idea whether it can be realized and how. Although my second question is not related to the current post, I sincerely hope that you can do me a favor to give me some advice. Thank you!
The values for component magnitudes are the representative order of magnitude for the primary variables. In the example here, absolute values of pressures are ~1 MPa, temperatures are ~300 K and displacements are roughly 1 cm.
For relative epsilons a value of 1e-8 usually is a good initial choice.
In the end, both values will be used to compute numerically the Jacobian used for solving the global equation system using the Newton-Raphson method. For that, the primary variables are perturbed by +/- magnitude * rel_eps.
Source terms can definitely be assigned in the TH2M process. You have to pick the right <process_variable> block, where the source term should go.
Since THM probably uses liquid pressure (does it? I’m not very familiar with that process), but TH2M uses gas pressure and capillary pressure as primary variables, you maybe have to apply a different source term to TH2M than to THM. But as I said, I’m not an expert. If you need further advice, please open a new question.
Thank you very much, Mr.Lehmann. You are right, in the THM process we indeed use liquid pressure referring to pressure variable. The source term in TH2M is surely different as there are two pressures i.e. Pg and Pc. And that’s just the thing confuses me most since there are no benchmarks adding pressure source term in TH2M process. I will try my best to make it work. If I have any questions, I will open a new post.